Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.3 OSX Dependency Linking Issue  (Read 3158 times)

0 Members and 1 Guest are viewing this topic.

jmcmorris

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
SFML 2.3 OSX Dependency Linking Issue
« on: June 12, 2015, 06:50:55 pm »
Hello, hopefully this is a quick one to resolve. I just forked SFML 2.3 and made a few edits (https://github.com/jmcmorris/SFML) and then proceeded to compile without any issues. I was also able to compile my game but once it got to the linking stage it ran into a snag that I just cant seem to resolve.

ld: file not found: /Users/m/Prog/Projects/SFML/build_deps/libogg-1.3.2/build/1.3.2//i386/root/lib/libogg.0.dylib for architecture i386

Here is the full output (minus the plethora of .o files):
make: Circular standalone <- standalone dependency dropped.
c++ -O3 -arch i386 -headerpad_max_install_names -mmacosx-version-min=10.6 -stdlib=libstdc++ externals/frameworks/libboost_system.a externals/frameworks/libboost_filesystem.a externals/frameworks/libboost_python.a externals/frameworks/libboost_regex.a externals/frameworks/libboost_thread.a externals/frameworks/libboost_signals.a externals/frameworks/libRakNetLibStatic.a externals/frameworks/libfreetype.dylib externals/frameworks/liblog4cplus.dylib externals/frameworks/libCoherentUI.dylib externals/frameworks/libsteam_api.dylib -Fexternals/frameworks/ -Fexternals/frameworks/ -framework Python -framework Foundation -framework AppKit -framework IOKit -framework Carbon -framework OpenGL -framework ogg -framework FLAC -framework vorbis -framework vorbisenc -framework vorbisfile -framework OpenAL -framework sfml-audio -framework sfml-graphics -framework sfml-network -framework sfml-system -framework sfml-window -dynamiclib -undefined suppress -flat_namespace <all of the .o files>
ld: file not found: /Users/m/Prog/Projects/SFML/build_deps/libogg-1.3.2/build/1.3.2//i386/root/lib/libogg.0.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [siege.so] Error 1

Any help is appreciated. Thanks!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.3 OSX Dependency Linking Issue
« Reply #1 on: June 13, 2015, 12:55:05 pm »
Interesting, I didn't know that this path was still present somewhere inside the binaries... `otool -fahlLDtdorSTMRIHGvVcXPC` doesn't reveal anything but grepping directly the FLAC/vorbis binaries indeed reveal it is present.

Now, I'm not sure that's the root of your issues. Nobody had any problem with that until now...

Looking at man ld for `-undefined suppress -flat_namespace` makes me think that this is the cause of the problem. But having never used those, this is only a guess.

Quote
-flat_namespace
                 Alters how symbols are resolved at build time and runtime.
                 With -two_levelnamespace (the default), the linker only
                 searches dylibs on the command line for symbols, and records
                 in which dylib they were found.  With -flat_namespace, the
                 linker searches all dylibs on the command line and all dylibs
                 those original dylibs depend on.

Is there any specific reasons you're not using the default option here?
SFML / OS X developer

jmcmorris

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: SFML 2.3 OSX Dependency Linking Issue
« Reply #2 on: June 13, 2015, 06:08:08 pm »
Hey Hiura, I honestly don't know of the original intent for those options. I removed them and it does compile correctly but upon running the game app it is failing with a image not found mentioning the same thing but with a bit more information at least.

Dyld Error Message:
  Library not loaded: /Users/m/Prog/Projects/SFML/build_deps/libogg-1.3.2/build/1.3.2//i386/root/lib/libogg.0.dylib
  Referenced from: /Users/jmcmorris/crea/Crea.app/Contents/Frameworks/FLAC.framework/Versions/A/FLAC
  Reason: image not found

Here's the crash report that includes everything: http://pastie.org/private/05bodjqt3hcrllx6fbosa

I've looked through them with otool and cant find any mention of this libogg.0.dylib. Let me know if you want me to try anything. Thanks for the help!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.3 OSX Dependency Linking Issue
« Reply #3 on: June 14, 2015, 11:14:12 am »
Could you run

otool -L /Users/jmcmorris/crea/Crea.app/Contents/Frameworks/FLAC.framework/Versions/A/FLAC

and post the output?

It should look like this:
FLAC:
        @rpath/../Frameworks/FLAC.framework/Versions/A/FLAC (compatibility version 12.0.0, current version 12.0.0)
        @rpath/../Frameworks/ogg.framework/Versions/A/ogg (compatibility version 9.0.0, current version 9.2.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
 
SFML / OS X developer

jmcmorris

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: SFML 2.3 OSX Dependency Linking Issue
« Reply #4 on: June 14, 2015, 06:16:42 pm »
I've done an otool -L on all of the extlibs and I find no mention of the dylib otherwise I'd do a install_name_tool -change on it, which I've done on many other things. Here's the output exactly as you said it'd be.

Jassons-MacBook-Pro:frameworks jmcmorris$ otool -L /Users/jmcmorris/crea/Crea.app/Contents/Frameworks/FLAC.framework/Versions/A/FLAC
/Users/jmcmorris/crea/Crea.app/Contents/Frameworks/FLAC.framework/Versions/A/FLAC:
        @rpath/../Frameworks/FLAC.framework/Versions/A/FLAC (compatibility version 12.0.0, current version 12.0.0)
        @rpath/../Frameworks/ogg.framework/Versions/A/ogg (compatibility version 9.0.0, current version 9.2.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

I'd suggest recompiling them myself but I imagine you'd like to get this fixed since it is likely others will eventually run into this once they start upgrading to SFML 2.3.

If you'd like you can add me on skype (baskinein) and we can work on this together.

Cheers!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.3 OSX Dependency Linking Issue
« Reply #5 on: June 14, 2015, 07:41:09 pm »
Well, honestly I don't know... with that output there's no reason it tries to load gcc from Users/m/Prog/Projects/SFML/build_deps/libogg-1.3.2/.... What's really puzzling is that you're the first to have this issue and I know for sure you're not the first one to use those external libs...

You say you modified those framework with install_name_tool? Maybe try to redownload them and see if it changes something.

If you want to rebuild those libs, here the script I used in the first place: https://gist.github.com/mantognini/05460d9b6a8a272ed188 (you'll need a fish shell to run it as is).
SFML / OS X developer