Page 1 of 1

Problem compiling rocksanddiamonds on mac

Posted: Mon Jun 22, 2015 1:56 pm
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

Re: Problem compiling rocksanddiamonds on mac

Posted: Mon Jun 22, 2015 2:41 pm
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!

Re: Problem compiling rocksanddiamonds on mac

Posted: Wed Jun 24, 2015 10:54 pm
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

Re: Problem compiling rocksanddiamonds on mac

Posted: Wed Jun 24, 2015 11:47 pm
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.

Re: Problem compiling rocksanddiamonds on mac

Posted: Thu Jun 25, 2015 11:05 pm
by oawad79
hey,

thanks it worked. the last option did it. thanks for a great game!

Re: Problem compiling rocksanddiamonds on mac

Posted: Fri Jun 26, 2015 8:40 am
by Holger
Good to know that it works now! I've fixed that bug in the code now.