[Ohrrpgce] FreeBASIC Mac OS X build

James Paige Bob at HamsterRepublic.com
Fri Oct 8 12:41:59 PDT 2010


On Sat, Oct 09, 2010 at 07:23:18AM +1300, Ralph Versteegen wrote:
> On 9 October 2010 07:08, Ralph Versteegen <teeemcee at gmail.com> wrote:
> > On 9 October 2010 06:54, James Paige <Bob at hamsterrepublic.com> wrote:
> >> On Sat, Oct 09, 2010 at 06:40:35AM +1300, Ralph Versteegen wrote:
> >>> On 9 October 2010 06:31, James Paige <Bob at hamsterrepublic.com> wrote:
> >>> >> > ...but now
> >>> >> >
> >>> >> > Linking Game...
> >>> >> > fbc -lang deprecated -x ohrrpgce-game -m game -mt -g -exx -entry
> >>> >> > SDL_main -Wl -macosx_version_min,10.4 -d IS_GAME  game.o bmod.o
> >>> >> > bmodsubs.o menustuf.o moresubs.o yetmore.o yetmore2.o savegame.o
> >>> >> > hsinterpreter.o   blit.o base64.o gfx_sdl.o music_sdl.o sdl_lumprwops.o
> >>> >> > allmodex.o backends.o lumpfile.o compat.o bam2mid.o common.o browse.o
> >>> >> > util.o loading.o reload.o reloadext.o slices.o mac/SDLMain.o -p
> >>> >> > /usr/lib/  -Wl -framework,SDL_mixer -Wl -framework,SDL -Wl
> >>> >> > -framework,Cocoa -Wl -F/Users/james/Library/Frameworks/
> >>> >> > ld: warning: in blit.o, file was built for unsupported file format which
> >>> >> > is not the architecture being linked (i386)
> >>> >> > ld: warning: in base64.o, file was built for unsupported file format
> >>> >> > which is not the architecture being linked (i386)
> >>> >> > ld: warning: in mac/SDLMain.o, file was built for unsupported file
> >>> >> > format which is not the architecture being linked (i386)
> >>> >> > Undefined symbols:
> >>> >> >  "_get_sys_err_string", referenced from:
> >>> >> >      _UPDATERECORDLENGTH in common.o
> >>> >> >  "_smoothzoomblit_8_to_8bit", referenced from:
> >>> >> >      _gfx_sdl_showpage in gfx_sdl.o
> >>> >> >  "_blitohrscaled", referenced from:
> >>> >> >      __Z10FRAME_DRAWP5FRAMEP9PALETTE16iiiiS0_ in allmodex.o
> >>> >> >  "_blitohr", referenced from:
> >>> >> >      _DRAWOHR in allmodex.o
> >>> >> >  "___divdi3", referenced from:
> >>> >> >      _LOADSCRIPT in moresubs.o
> >>> >> >      _UPDATERECORDLENGTH in common.o
> >>> >> >      _UPGRADE in common.o
> >>> >> >      _LOADTILEMAPS in loading.o
> >>> >> >      _LOAD_MAP_POS_SAVE_OFFSET in loading.o
> >>> >> >      _fb_FileTellEx in libfbmt.a(libfb_file_tell.o)
> >>> >> >  "_main", referenced from:
> >>> >> >      __start in crt1.o
> >>> >> >     (maybe you meant: _SDL_main)
> >>> >> >  "_base64_encode_alloc", referenced from:
> >>> >> >      __ZN6RELOAD11MEMORYUSAGEEPNS_3DOCE in reload.o
> >>> >> > ld: symbol(s) not found for inferred architecture i386
> >>> >> > make[1]: *** [ohrrpgce-game] Error 1
> >>> >>
> >>> >> Simply change
> >>> >> CC=gcc
> >>> >> to
> >>> >> CC=gcc -m32
> >>> >> and run make clean before attempted to rebuild.
> >>> >
> >>> > After make clean and manually deleting mac/SDLMain.o
> >>> > that got rid of those errors, but now:
> >>> >
> >>> > Linking Game...
> >>> > fbc -lang deprecated -x ohrrpgce-game -m game -mt -g -exx -entry
> >>> > SDL_main -Wl -macosx_version_min,10.4 -d IS_GAME  game.o bmod.o
> >>> > bmodsubs.o menustuf.o moresubs.o yetmore.o yetmore2.o savegame.o
> >>> > hsinterpreter.o   blit.o base64.o gfx_sdl.o music_sdl.o sdl_lumprwops.o
> >>> > allmodex.o backends.o lumpfile.o compat.o bam2mid.o common.o browse.o
> >>> > util.o loading.o reload.o reloadext.o slices.o mac/SDLMain.o -p
> >>> > /usr/lib/  -Wl -framework,SDL_mixer -Wl -framework,SDL -Wl
> >>> > -framework,Cocoa -Wl -F/Users/james/Library/Frameworks/
> >>> > Undefined symbols:
> >>> >  "___divdi3", referenced from:
> >>> >      _LOADSCRIPT in moresubs.o
> >>> >      _UPDATERECORDLENGTH in common.o
> >>> >      _UPGRADE in common.o
> >>> >      _LOADTILEMAPS in loading.o
> >>> >      _LOAD_MAP_POS_SAVE_OFFSET in loading.o
> >>> >      _fb_FileTellEx in libfbmt.a(libfb_file_tell.o)
> >>> > ld: symbol(s) not found for inferred architecture i386
> >>> > make[1]: *** [ohrrpgce-game] Error 1
> >>> >
> >>> > ---
> >>> > James
> >>>
> >>> IIRC ___divdi3 is in libgcc, which was gcc_s.1.dylib for me. Could you
> >>> run "otool -t -v /usr/lib/libgcc_s.1.dylib | grep divdi" (I assume
> >>> that's the location of that dylib). Also try "ls /usr/lib | grep
> >>> libgcc"
> >>
> >> Okay.
> >>
> >> broaste:~/src/ohr/wip james$ otool -t -v /usr/lib/libgcc_s.1.dylib |
> >> grep divdi
> >> ___divdi3:
> >> ___udivdi3:
> >>
> >> broaste:~/src/ohr/wip james$ ls /usr/lib | grep libgcc
> >> libgcc_s.1.dylib
> >> libgcc_s.10.4.dylib
> >> libgcc_s.10.5.dylib
> >>
> >> broaste:~/src/ohr/wip james$ ls -l /usr/lib | grep libgcc
> >> lrwxr-xr-x    1 root  wheel        17 Apr 27 10:02 libgcc_s.1.dylib ->
> >> libSystem.B.dylib
> >> lrwxr-xr-x    1 root  wheel        19 Sep 10 08:26 libgcc_s.10.4.dylib
> >> -> libgcc_s.10.5.dylib
> >> -rwxr-xr-x    1 root  wheel     40668 Apr 22 23:58 libgcc_s.10.5.dylib
> >>
> >> ---
> >> James
> >
> > Odd... why is the linker complaining? Also I'm surprised that it's
> > symlinked to libSystem. Try
> > file /usr/lib/libgcc_s.1.dylib
> > to see the architectures included,

broaste:~/src/ohr/wip james$ file /usr/lib/libgcc_s.1.dylib
/usr/lib/libgcc_s.1.dylib: symbolic link to libSystem.B.dylib

> > and edit Makefile to add -v to
> > FBFLAGS, and see what it passes to as.
>
> I meant ld, not as. But that's rather unlikely to be helpful.

Linking Game...
fbc -lang deprecated -x ohrrpgce-game -m game -mt -v -g -exx -entry 
SDL_main -Wl -macosx_version_min,10.4 -d IS_GAME  game.o bmod.o 
bmodsubs.o menustuf.o moresubs.o yetmore.o yetmore2.o savegame.o 
hsinterpreter.o   blit.o base64.o gfx_sdl.o music_sdl.o sdl_lumprwops.o 
allmodex.o backends.o lumpfile.o compat.o bam2mid.o common.o browse.o 
util.o loading.o reload.o reloadext.o slices.o mac/SDLMain.o -p 
/usr/lib/  -Wl -framework,SDL_mixer -Wl -framework,SDL -Wl 
-framework,Cocoa -Wl -F/Users/james/Library/Frameworks/
FreeBASIC Compiler - Version 0.22.0 (10-05-2010) for darwin 
(target:darwin)
Copyright (C) 2004-2010 The FreeBASIC development team.
Configured as standalone
objinfo disabled

linking:       -L"/usr/lib" -L"/Users/james/misc/fbc-mac/lib/darwin" 
-L"." "/usr/lib/crt1.o" 
"/Users/james/misc/fbc-mac/lib/darwin/operatornew.o" "game.o" "bmod.o" 
"bmodsubs.o" "menustuf.o" "moresubs.o" "yetmore.o" "yetmore2.o" 
"savegame.o" "hsinterpreter.o" "blit.o" "base64.o" "gfx_sdl.o" 
"music_sdl.o" "sdl_lumprwops.o" "allmodex.o" "backends.o" "lumpfile.o" 
"compat.o" "bam2mid.o" "common.o" "browse.o" "util.o" "loading.o" 
"reload.o" "reloadext.o" "slices.o" "mac/SDLMain.o" "$$fb_icon$$.o" -o 
"ohrrpgce-game" -lfbmt -lSystem -lncurses -lgcc_s.1 
"/Users/james/misc/fbc-mac/lib/darwin/fbrt0.o"  -macosx_version_min 10.4  
-framework SDL_mixer  -framework SDL  -framework Cocoa  
-F/Users/james/Library/Frameworks/ 
Undefined symbols:
  "___divdi3", referenced from:
      _LOADSCRIPT in moresubs.o
      _UPDATERECORDLENGTH in common.o
      _UPGRADE in common.o
      _LOADTILEMAPS in loading.o
      _LOAD_MAP_POS_SAVE_OFFSET in loading.o
      _fb_FileTellEx in libfbmt.a(libfb_file_tell.o)
ld: symbol(s) not found for inferred architecture i386
linking failed: error code 1
make: *** [ohrrpgce-game] Error 1
 
> > A desperate possibility for fix would be adding '-Wl -lgcc_s.10.4' to FBFLAGS
> 
> If that doesn't work, I wonder what else we can try linking to (I
> solved the __divdi3 link error when I first saw it by linking to stuff
> I saw gcc linking to until it went away). I wonder what this reveals
> about libgcc installation across different Macs:
> find /usr/lib -name libgcc*

As far as I can tell, that makes the command-line too long and causes it 
to be truncated :P

Linking Game...
fbc -lang deprecated -x ohrrpgce-game -m game -mt -Wl -lgcc_s.10.4 -g 
-exx -entry SDL_main -Wl -macosx_version_min,10.4 -d IS_GAME  game.o 
bmod.o bmodsubs.o menustuf.o moresubs.o yetmore.o yetmore2.o savegame.o 
hsinterpreter.o   blit.o base64.o gfx_sdl.o music_sdl.o sdl_lumprwops.o 
allmodex.o backends.o lumpfile.o compat.o bam2mid.o common.o browse.o 
util.o loading.o reload.o reloadext.o slices.o mac/SDLMain.o -p 
/usr/lib/  -Wl -framework,SDL_mixer -Wl -framework,SDL -Wl 
-framework,Cocoa -Wl -F/Users/james/Library/Frameworks/
ld: warning: directory '/Users/james/Library/Framewo' following -F not 
found
ld: framework not found SDL_mixer
make: *** [ohrrpgce-game] Error 1

> > It might also help to see what gcc passes to ld:
> > echo "int main() {return 0;}" > /tmp/test.c && gcc -m32 /temp/test.c -v

broaste:~/src/ohr/wip james$ echo "int main() {return 0;}" > /tmp/test.c 
&& gcc -m32 /tmp/test.c -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~38/src/configure 
--disable-checking --enable-werror --prefix=/usr --mandir=/share/man 
--enable-languages=c,objc,c++,obj-c++ 
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib 
--build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- 
--host=x86_64-apple-darwin10 --target=i686-apple-darwin10 
--with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
 /usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 -quiet -v -D__DYNAMIC__ 
/tmp/test.c -fPIC -quiet -dumpbase test.c -mmacosx-version-min=10.6.4 
-m32 -mtune=core2 -auxbase test -version -o 
/var/folders/P0/P0bnR5YsEUSyvhgP0kvDOE+++TI/-Tmp-//ccRXMtlC.s
ignoring nonexistent directory 
"/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-apple-darwin10/4.2.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
GNU C version 4.2.1 (Apple Inc. build 5664) (i686-apple-darwin10)
        compiled by GNU C version 4.2.1 (Apple Inc. build 5664).
GGC heuristics: --param ggc-min-expand=150 --param 
ggc-min-heapsize=131072
Compiler executable checksum: ed57b74ac13fadbcfe2fde31d35a0127
 /usr/libexec/gcc/i686-apple-darwin10/4.2.1/as -arch i386 
-force_cpusubtype_ALL -o 
/var/folders/P0/P0bnR5YsEUSyvhgP0kvDOE+++TI/-Tmp-//ccLBIZWM.o 
/var/folders/P0/P0bnR5YsEUSyvhgP0kvDOE+++TI/-Tmp-//ccRXMtlC.s
 /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 
-macosx_version_min 10.6.4 -weak_reference_mismatches non-weak -o a.out 
-lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1 
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1 
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. 
/var/folders/P0/P0bnR5YsEUSyvhgP0kvDOE+++TI/-Tmp-//ccLBIZWM.o -lSystem 
-lgcc -lSystem

---
James



More information about the Ohrrpgce mailing list