[Ohrrpgce] FreeBASIC Mac OS X build

Ralph Versteegen teeemcee at gmail.com
Fri Oct 8 11:08:15 PDT 2010


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, and edit Makefile to add -v to
FBFLAGS, and see what it passes to as.
A desperate possibility for fix would be adding '-Wl -lgcc_s.10.4' to FBFLAGS

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



More information about the Ohrrpgce mailing list