Problem compiling rocksanddiamonds on mac

Discussion about Rocks'n'Diamonds, Boulder Dash, Supaplex, Emerald Mine and any other BD hybrid.

Moderators: Flumminator, Zomis

Post Reply
oawad79
Posts: 6
Joined: Sun Jun 21, 2015 12:25 am

Problem compiling rocksanddiamonds on mac

Post by oawad79 »

Hello,

I keep getting missing -lsmpeg when compiling the source on mac, I have installed it using the

brew tap homebrew/headonly
brew install --HEAD smpeg

which seems to complete fine. then I try to recompile and keep getting the same issue.

what am I missing here ?

Thanks
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Problem compiling rocksanddiamonds on mac

Post by Holger »

Hello,

this may be a bug in my build system, which contains a "-lsmpeg" in the libraries to link, which aparently is not needed (and may indeed cause trouble, like in your case). (filbo already mentioned similar observations in another "General Discussion" thread just next to your thread.)

As far as I can see, both SDL_mixer and SDL2_mixer (for SDL2 based builds) dynamically link to (load) "libsmpeg.so" at runtime, so linking against it during compilation seems not to be needed. I assume that even when doing static builds (which I did for the Mac target in the past), linking with the statically built "libSDL_mixer.a" already contains the "libsmpeg.a" (but I'm not totally sure here and have to do some further investigations).

So please just try to remove references to "-lsmpeg" from the file "src/Makefile" and try building again.

Hope that helps!
oawad79
Posts: 6
Joined: Sun Jun 21, 2015 12:25 am

Re: Problem compiling rocksanddiamonds on mac

Post by oawad79 »

Hey, thanks for the reply

I have tried yo remove the lsmpeg and that didn't help , now getting

cc main.o conf_gfx.o conf_snd.o conf_mus.o conf_hlp.o init.o config.o events.o tools.o screens.o game.o editor.o files.o tape.o cartoons.o network.o netserv.o libgame/libgame.a game_em/game_em.a game_sp/game_sp.a -lSDL_image -lSDL_mixer -lSDL_net -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lm -o ../rocksndiamonds
Undefined symbols for architecture x86_64:
"_InitElementSmallImagesScaledUp", referenced from:
_InitElementSmallImages in init.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [../rocksndiamonds] Error 1
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Problem compiling rocksanddiamonds on mac

Post by Holger »

I did some investigations regarding that error, and I think I know the cause for the linking hiccup. Did you add a flag "-std=gnu99" or something similar? Something like this (C99 mode) most probably cause this problem. The following solutions should work:

- do not use "-std=gnu99" in "src/Makefile", or
- add "-finline-functions" or "-fgnu89-inline" or "-O3" in "src/Makefile", or
- change "inline void" to "inline static void" in "src/init.c", line 154

One of that should hopefully do it.

I will fix this in the source code and update the git repository accordingly.
oawad79
Posts: 6
Joined: Sun Jun 21, 2015 12:25 am

Re: Problem compiling rocksanddiamonds on mac

Post by oawad79 »

hey,

thanks it worked. the last option did it. thanks for a great game!
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Problem compiling rocksanddiamonds on mac

Post by Holger »

Good to know that it works now! I've fixed that bug in the code now.
Post Reply