Building out of XCode possible? OSX / solved: scons instead

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Jens
Posts: 0
Joined: Sat Aug 26, 2006 7:24 pm
Location: Hamburg, Germany

Building out of XCode possible? OSX / solved: scons instead

Post by Jens »

Hi
To be able to checkout the newest development i would
like to have blender as an xcode-projekt.
But when trying to compile, i hit some strange problems.
Is it generally possible to use xcode and gcc 4 ?
Does someone have some tips ?
Would be nice to use this easy to handle apple-dev-tools.

Greetz...Jens
Last edited by Jens on Fri Jul 13, 2007 12:19 am, edited 1 time in total.

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv »

One tip is to be more specific when requesting help. Saying "i hit some strange problems." does not really give us anything to go on.

Jens
Posts: 0
Joined: Sat Aug 26, 2006 7:24 pm
Location: Hamburg, Germany

Post by Jens »

Hi Stiv
First of all, after reading a lot about compiling blender, i was not sure
if i can use xcode in generally.

This is my first attempt, so i downloaded the bf 2.44 and the libs to
checkout if it works. Just to compile a working source with nothing
experimental in it.

I started the xcode-project and tried to build out of the box, got some
warnings and errors:
makesdna.c:1: warning: -mdynamic-no-pic overrides -fpic or -fPIC
makesdna.c:846: warning: no previous prototype for 'make_structDNA'
makesdna.c:1145: error: DNA_brush_types.h: No such file or directory
makesdna.c:1145: error: DNA_brush_types.h: No such file or directory
I checked the files but they are there.

Seems i have to get much more expriences with xcode and handling
of the source, iám a newbee in that.
I don´t want to bore the experienced coders here, just a hint would do.
My aim is to have actual builds for OSX-Intel/PPC too, because the most
people seem to work on Linux- or Windows-Builds.

Thanks...Jens

matt_e
Posts: 410
Joined: Mon Oct 14, 2002 4:32 am
Location: Sydney, Australia
Contact:

Post by matt_e »

The xcode files that are in the blender source tree won't compile - they are very out of date and should be removed. You could try using cmake to auto-generate xcode project files, though I haven't had much luck with that in the past either...

Jens
Posts: 0
Joined: Sat Aug 26, 2006 7:24 pm
Location: Hamburg, Germany

Post by Jens »

Hi all
Yes, it is unsatisfying.
I did an "cmake -G "xcode" ../blender "first to have the xcode projektfiles.
Found out xcode must have "" around.
But the result is not working.
There must be a better way.
My hope was to have os-specific optimisation more easy with xcode,
´cause it is very tricky to set the right flags.
The different build-how-to´s are not clear to me, so it need´s more
investigation.
If someone did the trick for OSX-i386. please share the results to us.
In the meantime, i will try to contact devroo, who did working builds
at GRAFICALL.
I won´t give up yet, will post my results later.

Edit:
With the most appreciated help of devroo, who guided me through the
whole build-process, i managed to get a working build with new particles.
More info to come, if someone is interested.



Greetz...Jens

William
Posts: 0
Joined: Tue Jan 11, 2005 3:07 am

Post by William »

Hi Jens, would you mind posting a step-by-step guide about compiling Blender on OS X now that you got it?

There seems to be almost no documentation on building for OS X.

Jens
Posts: 0
Joined: Sat Aug 26, 2006 7:24 pm
Location: Hamburg, Germany

Post by Jens »

Hi william

I will do a hole description in time, now just the short version.

1. Install Appel-Dev-Tools from DVD or download.

2. Get SVN: http://downloads.open.collab.net/binaries.html
it is a binary, so no prob.Installs at: /usr/local/bin/svn

2a. Get scons, has to be compiled on Mac too.
http://www.scons.org/download.php
Compile and install with: setup.py install


3. Get the blender source libs, put it into a Blender-dev folder you created.

4. In terminal, go to this newly crated folder with lib-filder in and type:

/usr/local/bin/svn checkout https://svn.blender.org/svnroot/bf-blen ... nches/xxx/

where xxx is the wanted branch like "particles" for example.( will go on with it)

5. In finder, go to folder particles/config and open darwin-config.py
with an editor ( textedit will do). Change th first line so that it points to
the needed lib : LCGDIR = '#../lib/darwin-8.9.1-i386' (example)
Find the lines with: openAL, ffmpg, player an set variables to "false",
change iconv line from false to true.

5a.. Change Python lines to what you have ( 2.3 is preinstalled )
BF_PYTHON_VERSION = '2.3'
if BF_PYTHON_VERSION=='2.3':



6. in terminal go into particles directory and type: /Library/Frameworks/Python.framework/Versions/2.3/bin/scons.

7. maybe you have to get openEXR too: openexr-1.4.0a.tar.gz
just extract then ./configure and then sudo make install.
compile again.

This should work, try and report back.
Dunno how experienced you are, but we can work problems out.
If needed, we can do AIM-Chat.

Greetz..Jens

William
Posts: 0
Joined: Tue Jan 11, 2005 3:07 am

Post by William »

Thanks a million Jens. Very nice of you.

I did run into some problems though:

I installed Python 2.5 and so I found it logical that I should type
/Library/Frameworks/Python.framework/Versions/2.5/bin/scons
to build. However there seems to be no such directory.
So I went back to the config file and changed the Python variable back to 2.3. (Is this possible? to build with an older version number than is installed?)


Anyway, when I type /System/Library/Frameworks/Python.framework/Versions/Current/bin/scons

to build I get the following errors:

Code: Select all

Compiling ==> 'utilities.cpp'
intern/elbeem/intern/utilities.cpp:28:17: error: png.h: No such file or directory
intern/elbeem/intern/utilities.cpp: In function 'int writePng(const char*, unsigned char**, int, int)':
intern/elbeem/intern/utilities.cpp:134: error: 'PNG_COLOR_TYPE_RGBA' was not declared in this scope
intern/elbeem/intern/utilities.cpp:136: error: 'png_structp' was not declared in this scope
intern/elbeem/intern/utilities.cpp:136: error: expected `;' before 'png_ptr'
intern/elbeem/intern/utilities.cpp:137: error: 'png_infop' was not declared in this scope
intern/elbeem/intern/utilities.cpp:137: error: expected `;' before 'info_ptr'
intern/elbeem/intern/utilities.cpp:138: error: 'png_bytep' was not declared in this scope
intern/elbeem/intern/utilities.cpp:138: error: 'rows' was not declared in this scope
intern/elbeem/intern/utilities.cpp:145: error: 'png_ptr' was not declared in this scope
intern/elbeem/intern/utilities.cpp:147: error: 'PNG_LIBPNG_VER_STRING' was not declared in this scope
intern/elbeem/intern/utilities.cpp:147: error: 'png_create_write_struct' was not declared in this scope
intern/elbeem/intern/utilities.cpp:149: error: 'info_ptr' was not declared in this scope
intern/elbeem/intern/utilities.cpp:151: error: 'png_ptr' was not declared in this scope
intern/elbeem/intern/utilities.cpp:151: error: 'png_create_info_struct' was not declared in this scope
intern/elbeem/intern/utilities.cpp:154: error: 'png_ptr' was not declared in this scope
intern/elbeem/intern/utilities.cpp:154: error: 'png_jmpbuf' was not declared in this scope
intern/elbeem/intern/utilities.cpp:154: error: 'setjmp' was not declared in this scope
intern/elbeem/intern/utilities.cpp:156: error: 'png_ptr' was not declared in this scope
intern/elbeem/intern/utilities.cpp:156: error: 'png_init_io' was not declared in this scope
intern/elbeem/intern/utilities.cpp:158: error: 'info_ptr' was not declared in this scope
intern/elbeem/intern/utilities.cpp:158: error: 'PNG_INTERLACE_NONE' was not declared in this scope
intern/elbeem/intern/utilities.cpp:159: error: 'PNG_COMPRESSION_TYPE_BASE' was not declared in this scope
intern/elbeem/intern/utilities.cpp:159: error: 'PNG_FILTER_TYPE_BASE' was not declared in this scope
intern/elbeem/intern/utilities.cpp:159: error: 'png_set_IHDR' was not declared in this scope
intern/elbeem/intern/utilities.cpp:161: error: 'png_write_info' was not declared in this scope
intern/elbeem/intern/utilities.cpp:163: error: 'png_write_image' was not declared in this scope
intern/elbeem/intern/utilities.cpp:165: error: 'png_write_end' was not declared in this scope
intern/elbeem/intern/utilities.cpp:167: error: 'png_destroy_write_struct' was not declared in this scope
scons: *** [/Users/William/Blender-dev/build/darwin/intern/elbeem/intern/utilities.o] Error 1
scons: building terminated because of errors.
Sorry for the long text. Any ideas?

Cheers

Jens
Posts: 0
Joined: Sat Aug 26, 2006 7:24 pm
Location: Hamburg, Germany

Post by Jens »

Hm, unsure what happend there, seems missing lib´s.
You have all the libs? They are not a part of the branch !!!!
/usr/local/bin/svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/
That contains: freetype, gettext, jpeg, openal, openexr, png, sdl, tiff,
and is nearly 300MB.
Did you exaccly matched the foldername in line 1 of darwinconfig.py.?
Could be different, mine is : darwin-8.x.i386
so the line reads: LCGDIR = '#../lib/darwin-8.x.i386'

I have python 2.5 too, so scons is located after intsall in:
/Library/Frameworks/Python.framework/Versions/2.5/bin.
Thats the default anyway:
# python.org libs install in /library
BF_PYTHON_VERSION = '2.5'
if BF_PYTHON_VERSION=='2.5':
BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
else:
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
maybe we should contact directly: AIM : rikijensi
I will check the next hours, if you are there...

Greetz...Jens
Last edited by Jens on Sun Jul 15, 2007 9:58 pm, edited 2 times in total.

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Post by stiv »

error: png.h: No such file or directory
Almost always, this means either you do not have the header files installed (often part of a -dev or -devel package ) OR you do not have paths set correctly in your config file.

William
Posts: 0
Joined: Tue Jan 11, 2005 3:07 am

Post by William »

Jens: Oh, thanks again, sorry I was not online yesterday.

One thing is strange on my system. There is no '2.5' directiry in /System/Library/Frameworks/Python.framework/Versions/

I installed the precompiled os x distribution of Python, and I do have the MacPython 2.5 directory in /Applications/. Hmm..

Is this maybe because I installed scons before Python 2.5?

Oh, and I do have the darwin-8.x.i386 lib folder in my Blender-dev directory together with my source folder.

Stiv: Thanks for the tip. However, I am unsure how to get the header files?

Thanks alot.

Jens
Posts: 0
Joined: Sat Aug 26, 2006 7:24 pm
Location: Hamburg, Germany

Post by Jens »

Hm
I installed other Python versions first, they reside :

/Library/Frameworks/Python.framework/Versions/
There is 2.4 + 2.5 and current, which points to 2.5
in my case. There is my scons also.

In:/System/Library/Frameworks/Python.framework/Versions/
there is 2.3 and current, that points to 2.3.
Maybe it´s muddled ore osx-alike.
Type "python" in terminal
it should say 2.5 is the active version.

Important note :
When having python 2.5 intalled parallel to old 2.3, i found out
it´s the best way to us this in script to avoid mismatch errors later:
# python.org libs install in /library
BF_PYTHON_VERSION = '2.5'
if BF_PYTHON_VERSION=='2.5':
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
else:
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'

So only library ( not system/library ) directory is searched !!!

The Programs are o.k. in App-locacation. The are frontends.
Header-files are in lib, so should be o.k.
Do a spotlight-search to find scons.

Jens

William
Posts: 0
Joined: Tue Jan 11, 2005 3:07 am

Post by William »

Hah, finally!

Got the beast to compile!

I was a bit confused by the different libraries in os x.

I didn't have a scons file in /Library/Frameworks/Python.framework/Versions/2.5/bin but solved it by installing scons again, after Python 2.5.

Typing Python in terminal correctly says it's 2.5.1

Thanks for all the help, and I truly support your idea about writing a good guide for other OS X'ers to refer to.

Cheers

Jens
Posts: 0
Joined: Sat Aug 26, 2006 7:24 pm
Location: Hamburg, Germany

Post by Jens »

Hi william
Iám happy you got it working.
Didn´t hurt too much, eh ? :?
After doing this once, it becomes more clear then.
OSX is a little bit different but not too much.
I too had to dig in the libraries
for the first attempt.
Please share your experiences to other people as well....

Greetz...Jens

Papulizer
Posts: 0
Joined: Sat Apr 22, 2006 4:25 pm

Post by Papulizer »

I compile with XCode.
Steps to success:

read
https://svn.blender.org/svnroot/bf-blen ... -cmake.txt

* install dependencies
* run cmake -G "Xcode" ........sourcepath.......
* use ccmake "GUI" to configure your paths:
ccmake ....sourcepath....
* open Blender.xcodeproj
* select a target, e.g. "Release"
* build


I have a problem with alut so I set the path manually, in my
case /Users/stephan/blender/lib/darwin-8.x.i386/openal/include/AL/alut.h
(Either in the project or brute-force in the source-file intern/SoundSystem/openal/SND_OpenALDevice.cpp ) .

Post Reply