OSX build problems

Everything related to the code /
Tout ce qui touche au code
Post Reply
neuralshock
Posts: 28
Joined: Sun Apr 05, 2009 3:31 pm

OSX build problems

Post by neuralshock » Fri Apr 24, 2009 11:12 pm

Again a generic title, I suppose this could be a meeting place for everyone trying to build in OSX.
(Build instructions thread should be only for problems with the build instructions themselves)

So I checked out a copy of r1665 and tried to build it in OSX according to the current instructions. Everything OK with the instructions but the build fails:

Code: Select all

Linking CXX executable ../3dmeditor
[ 13%] Building CXX object src/scripts/CMakeFiles/scripts.dir/unit.script.interface.cpp.o
[ 13%] Building CXX object src/scripts/CMakeFiles/scripts.dir/ai.script.cpp.o
[ 13%] Building CXX object src/scripts/CMakeFiles/scripts.dir/script.data.cpp.o
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [3dmeditor] Error 1
make[1]: *** [src/CMakeFiles/3dmeditor.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 13%] Building CXX object src/scripts/CMakeFiles/scripts.dir/script.cpp.o
Linking CXX static library ../../bin/libs/Darwin/libscripts.a
[ 13%] Built target scripts
make: *** [all] Error 2
Also I found lots of these:

Code: Select all

warning: comparison between signed and unsigned integer expressions
Used following command to build (since the cpu in my laptop is dual-core)

Code: Select all

make -j 2
Update: using

Code: Select all

make -j 2 -k
to continue will throw errors in the end:

Code: Select all

[100%] Building CXX object src/CMakeFiles/ta3d.dir/TA3D_NameSpace.cpp.o
Linking CXX executable ../ta3d.app/Contents/MacOS/ta3d
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [ta3d.app/Contents/MacOS/ta3d] Error 1
make[2]: Target `src/CMakeFiles/ta3d.dir/build' not remade because of errors.
make[1]: *** [src/CMakeFiles/ta3d.dir/all] Error 2
make[1]: Target `all' not remade because of errors.
make: *** [all] Error 2
make: Target `default_target' not remade because of errors.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: OSX build problems

Post by zuzuf » Sat Apr 25, 2009 11:35 am

I don't know how the OSX kernel works, but on Linux it is usually faster to run make -j n with n > number of cpu cores. Of course it's not 3 or 4 times faster instead of 2 but it keeps all CPU cores busy (they never have to wait for IO commands to finish), but it requires a bit more memory.

PS: don't even try to run "make -j" without specifying the number of threads unless you really have lots of RAM.
=>;-D Penguin Powered

neuralshock
Posts: 28
Joined: Sun Apr 05, 2009 3:31 pm

Re: OSX build problems

Post by neuralshock » Sat Apr 25, 2009 12:10 pm

Thanks for the hint! Anyway I think I won't get past 2, since I'm building this in a laptop and normally I'm doing some things at the same time... as soon as I run make with -j 2, it looks like an airplane engine is running close by :P

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Re: OSX build problems

Post by milipili » Sat Apr 25, 2009 7:48 pm

make -j <number of core/cpu> is usually the best since you may do something else in the same time. The real problem is the hard drive access time, especially on MacBook (pro) which have a slow hard drive.

I'm sorry but the trunk compiles smoothly, if we don't take care of warnings... (r1669)

If you have any problem, please consider to remove CMakeCache.txt, and to try again.
Damien Gerard
Ta3d & Yuni Developer

neuralshock
Posts: 28
Joined: Sun Apr 05, 2009 3:31 pm

Re: OSX build problems

Post by neuralshock » Sat Apr 25, 2009 11:04 pm

milipili wrote:make -j <number of core/cpu> is usually the best since you may do something else in the same time. The real problem is the hard drive access time, especially on MacBook (pro) which have a slow hard drive.

I'm sorry but the trunk compiles smoothly, if we don't take care of warnings... (r1669)

If you have any problem, please consider to remove CMakeCache.txt, and to try again.
Tried to remove but I still have problems with crt1.10.5.o. It seems I have 10.4 and 10.5 SDKs, will that make a difference?

Code: Select all

monolith:~ admin$ find /Developer/ -name crt1.10.5.o -exec ls -l {}  \;
lrwxr-xr-x  1 root  wheel  46 Apr 25 23:24 /Developer//SDKs/MacOSX10.4u.sdk/usr/lib/crt1.10.5.o -> /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o
-rw-r--r--  1 root  wheel  17324 Oct 17  2008 /Developer//SDKs/MacOSX10.5.sdk/usr/lib/crt1.10.5.o
monolith:~ admin$ find /Developer/ -name crt1.o -exec ls -l {}  \;
lrwxr-xr-x  1 root  wheel  51 Apr 25 23:37 /Developer//SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o -> /Developer//SDKs/MacOSX10.5.sdk/usr/lib/crt1.10.5.o
-rw-r--r--  1 root  wheel  18204 Oct 17  2008 /Developer//SDKs/MacOSX10.5.sdk/usr/lib/crt1.o
So, can you help me to reproduce your build environment somehow?

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Re: OSX build problems

Post by milipili » Sun Apr 26, 2009 9:27 pm

It should not be a problem. I have them too.

Your error indicates that ta3d does not have a global exported function main(), which is called by crt.so, for any C Program.
Are you running a PPC version ? What is your Gcc version ? Please provide the output of CMake.

Code: Select all

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- TA3D -  v0.6.0 (Rev: 1670)
-- System: Darwin-9.6.0 (i386)
-- Default C++ flags set to `-O2 -g -Wall -ffast-math -pipe `
-- [DEBUG] The Debug mode has been enabled
-- [OpenGL] Mesa: NO
-- [OpenGL] GLu: YES
-- [OpenGL] Include dir: /System/Library/Frameworks/OpenGL.framework
-- [OpenGL] The GL library: /System/Library/Frameworks/OpenGL.framework
-- [OpenGL] The GLU library: /System/Library/Frameworks/AGL.framework
-- [OpenGL] Added Frameworks: AGL, OpenGL, Carbon
-- [SDL] SDL: YES
-- [SDL] SDL_image: YES
-- [SDL] SDL_mixer: YES
-- [SDL] SDL_net: YES
-- [SDL] Include dir: /opt/local/include/SDL
-- [SDL] The SDL library: /opt/local/lib/libSDLmain.a;/opt/local/lib/libSDL.dylib;-framework Cocoa
-- [SDL] The SDL_image library: /opt/local/lib/libSDL_image.dylib
-- [SDL] The SDL_mixer library: /opt/local/lib/libSDL_mixer.dylib
-- [SDL] The SDL_net library: /opt/local/lib/libSDL_net.dylib
-- GLEW Library : /opt/local/lib/libGLEW.dylib
-- FTGL Library : -framework OpenGL -L/opt/local/lib -lobjc -lfreetype -lz -lftgl
-- FTGL CFLags : -I/opt/local/include -I/opt/local/include/freetype2
-- TA3D will be installed in: /usr/local
-- [bundle] Adding resources 'sky'...
-- [bundle] Adding resources 'shaders'...
-- [bundle] Adding resources 'ai'...
-- [bundle] Adding resources 'gfx'...
-- [bundle] Adding resources 'gui'...
-- [bundle] Adding resources 'mods'...
-- [bundle] Adding resources 'objects3d'...
-- [bundle] Adding resources 'fonts'...
-- [bundle] Adding resources 'scripts'...
-- [bundle] Adding resources 'pictures'...
-- [bundle] Adding resources 'intro'...
-- [bundle] Adding resources 'languages'...
-- Configuring done
-- Generating done
It seems you have 3dmeditor compiled

Code: Select all

Shani-2 [milipili] ~/Projects/TA3D/trunk % otool -L ./3dmeditor
./3dmeditor:
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0)
	/opt/local/lib/libSDL-1.2.0.dylib (compatibility version 12.0.0, current version 12.2.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 12.0.0)
	/opt/local/lib/libSDL_image-1.2.0.dylib (compatibility version 2.0.0, current version 2.6.0)
	/opt/local/lib/libSDL_mixer-1.2.0.dylib (compatibility version 3.0.0, current version 3.6.0)
	/opt/local/lib/libSDL_net-1.2.0.dylib (compatibility version 1.0.0, current version 1.7.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
	/opt/local/lib/libGLEW.1.5.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
	/opt/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.20.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.17.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.43.0)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 34.0.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 677.22.0)
Gcc:

Code: Select all

Shani-2 [milipili] ~/Projects/TA3D/trunk % gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)

Code: Select all

Shani-2 [milipili] ~ % which gcc
/usr/bin/gcc

Code: Select all

port list installed :
[...]
coreutils                      @6.12           sysutils/coreutils
[...]
freetype                       @2.3.9          print/freetype
ftgl                           @2.1.2          graphics/ftgl
[...]
glew                           @1.5.1          graphics/glew
glib2                          @2.20.0         devel/glib2
glut                           @3.7            graphics/glut
[...]
libsdl                         @1.2.13         devel/libsdl
libsdl-framework               @1.2.13         devel/libsdl-framework
libsdl_gfx                     @2.0.18         devel/libsdl_gfx
libsdl_gfx-framework           @2.0.17         devel/libsdl_gfx-framework
libsdl_image                   @1.2.7          devel/libsdl_image
libsdl_image-framework         @1.2.6          devel/libsdl_image-framework
libsdl_mixer                   @1.2.8          audio/libsdl_mixer
libsdl_mixer-framework         @1.2.8          audio/libsdl_mixer-framework
libsdl_net                     @1.2.7          devel/libsdl_net
libsdl_net-framework           @1.2.7          devel/libsdl_net-framework
libsdl_pango                   @0.1.2          devel/libsdl_pango
libsdl_sound                   @1.0.3          audio/libsdl_sound
libsdl_sound-framework         @1.0.3          audio/libsdl_sound-framework
libsdl_ttf                     @2.0.9          devel/libsdl_ttf
libsdl_ttf-framework           @2.0.9          devel/libsdl_ttf-framework
Damien Gerard
Ta3d & Yuni Developer

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Re: OSX build problems

Post by milipili » Sun Apr 26, 2009 9:32 pm

Actually, provide the complete output produced by CMake + compilation of a clean checkout of the trunk. I would like to check something.
Damien Gerard
Ta3d & Yuni Developer

neuralshock
Posts: 28
Joined: Sun Apr 05, 2009 3:31 pm

Re: OSX build problems

Post by neuralshock » Wed Apr 29, 2009 8:14 pm

Checked out r1671 after removing local copy.

cmake output:

Code: Select all

monolith:TA3D pedro$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- TA3D -  v0.6.0 (Rev: 1671)
-- System: Darwin-9.6.0 (i386)
-- Default C++ flags set to `-O2 -g -Wall -ffast-math -pipe `
-- [DEBUG] The Debug mode has been enabled
-- [OpenGL] Mesa: NO
-- [OpenGL] GLu: YES
-- [OpenGL] Include dir: /System/Library/Frameworks/OpenGL.framework
-- [OpenGL] The GL library: /System/Library/Frameworks/OpenGL.framework
-- [OpenGL] The GLU library: /System/Library/Frameworks/AGL.framework
-- [OpenGL] Added Frameworks: AGL, OpenGL, Carbon
-- [SDL] SDL: YES
-- [SDL] SDL_image: YES
-- [SDL] SDL_mixer: YES
-- [SDL] SDL_net: YES
-- [SDL] Include dir: /Library/Frameworks/SDL.framework/Headers
-- [SDL] The SDL library: /Library/Frameworks/SDL.framework;-framework Cocoa
-- [SDL] The SDL_image library: /opt/local/lib/libSDL_image.dylib
-- [SDL] The SDL_mixer library: /opt/local/lib/libSDL_mixer.dylib
-- [SDL] The SDL_net library: /opt/local/lib/libSDL_net.dylib
-- GLEW Library : /opt/local/lib/libGLEW.dylib
-- FTGL Library : -framework OpenGL -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -L/opt/local/lib -lobjc -lfreetype -lz -lftgl
-- FTGL CFLags : -I/opt/local/include -I/opt/local/include/freetype2
-- TA3D will be installed in: /usr/local
-- [bundle] Adding resources 'sky'...
-- [bundle] Adding resources 'shaders'...
-- [bundle] Adding resources 'ai'...
-- [bundle] Adding resources 'gfx'...
-- [bundle] Adding resources 'gui'...
-- [bundle] Adding resources 'mods'...
-- [bundle] Adding resources 'objects3d'...
-- [bundle] Adding resources 'fonts'...
-- [bundle] Adding resources 'scripts'...
-- [bundle] Adding resources 'pictures'...
-- [bundle] Adding resources 'intro'...
-- [bundle] Adding resources 'languages'...
-- Configuring done
CMake Error in src/CMakeLists.txt:
  Cannot find source file "engine.cpp".  Tried extensions .c .C .c++ .cc .cpp
  .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx


-- Build files have been written to: /Users/pedro/TA3D
Looks like engine.cpp is not checked out at all. Anyway I downloaded the missing engine.cpp and engine.h, and:

Code: Select all

[ 13%] Building CXX object src/scripts/CMakeFiles/scripts.dir/ai.script.cpp.o
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [3dmeditor] Error 1
make[1]: *** [src/CMakeFiles/3dmeditor.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 13%] Building CXX object src/scripts/CMakeFiles/scripts.dir/script.data.cpp.o
[ 13%] Building CXX object src/scripts/CMakeFiles/scripts.dir/script.cpp.o
Linking CXX static library ../../bin/libs/Darwin/libscripts.a
[ 13%] Built target scripts
As for other stuff:

Code: Select all

monolith:TA3D pedro$ otool -L ./3dmeditor
otool: can't open file: ./3dmeditor (No such file or directory)

Code: Select all

monolith:TA3D pedro$ which gcc
/usr/bin/gcc
monolith:TA3D pedro$ gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)

Code: Select all

monolith:TA3D pedro$ port list installed | grep -e coreutils -e freetype -e ftgl -e ^gl -e ^libsdl
coreutils                      @7.2            sysutils/coreutils
coreutils                      @7.2            sysutils/coreutils
freetype                       @2.3.9          print/freetype
freetype                       @2.3.9          print/freetype
ftgl                           @2.1.2          graphics/ftgl
glew                           @1.5.1          graphics/glew
glib2                          @2.20.1         devel/glib2
glib2                          @2.20.1         devel/glib2
libsdl                         @1.2.13         devel/libsdl
libsdl-framework               @1.2.13         devel/libsdl-framework
libsdl_gfx                     @2.0.18         devel/libsdl_gfx
libsdl_gfx-framework           @2.0.17         devel/libsdl_gfx-framework
libsdl_image                   @1.2.7          devel/libsdl_image
libsdl_image-framework         @1.2.6          devel/libsdl_image-framework
libsdl_mixer                   @1.2.8          audio/libsdl_mixer
libsdl_mixer-framework         @1.2.8          audio/libsdl_mixer-framework
libsdl_net                     @1.2.7          devel/libsdl_net
libsdl_net-framework           @1.2.7          devel/libsdl_net-framework
libsdl_pango                   @0.1.2          devel/libsdl_pango
libsdl_sound                   @1.0.3          audio/libsdl_sound
libsdl_sound-framework         @1.0.3          audio/libsdl_sound-framework
libsdl_ttf                     @2.0.9          devel/libsdl_ttf
libsdl_ttf-framework           @2.0.9          devel/libsdl_ttf-framework
Attachments
svn_log.zip
(7.59 KiB) Downloaded 466 times

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Re: OSX build problems

Post by milipili » Wed Apr 29, 2009 8:40 pm

You have two SDL Frameworks installed on your system and there is a mix-up. Actually you are using the SDL Framework installed by the OS X installer from libsdl.org.
Try to remove (or move) /Library/Frameworks/SDL*, then remove CMakeCache.txt then try again.

If you're using this framework for other projects, it seems that is not a good idea (I always had problems with it but it is only my personal experience) and perhaps we should considerer to only use sdl-config under OS X.
Damien Gerard
Ta3d & Yuni Developer

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Re: OSX build problems

Post by milipili » Wed Apr 29, 2009 8:45 pm

`engine.cpp` and `engine.h` have been commited in r1672 (http://trac.ta3d.org/changeset/1672). Sorry for the inconvenience but there was a problem with svn.
Damien Gerard
Ta3d & Yuni Developer

neuralshock
Posts: 28
Joined: Sun Apr 05, 2009 3:31 pm

Re: OSX build problems

Post by neuralshock » Wed Apr 29, 2009 9:27 pm

milipili wrote:You have two SDL Frameworks installed on your system and there is a mix-up. Actually you are using the SDL Framework installed by the OS X installer from libsdl.org.
Try to remove (or move) /Library/Frameworks/SDL*, then remove CMakeCache.txt then try again.

If you're using this framework for other projects, it seems that is not a good idea (I always had problems with it but it is only my personal experience) and perhaps we should considerer to only use sdl-config under OS X.
I had installed from the libsdl.org installer to try out a console emulator quite a while ago and just left it there. Now it builds without any problems, thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests