Arx Libertatis Bug Tracker
star_faded.png
Please log in to bookmark issues
bug_report_small.png
CLOSED  Bug report #517  -  problem finding libs to link wicth installed through MacPorts (Building on Mac OS X)
Posted Jul 13, 2013 - updated Jul 14, 2013   Shortlink: http://arx.vg/517
action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
icon_info.png This issue has been closed with status "Fixed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Bug report
  • Status
     
    Fixed
  • Assigned to
    Not assigned to anyone
  • Progress
       
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
     xanm
  • Owned by
    Not owned by anyone
  • Estimated time
    Not estimated
  • Category
    Not determined
  • Resolution
    RESOLVED
  • Priority
    Not determined
  • Reproducability
    Not determined
  • Severity
    Not determined
  • Targetted for
    icon_milestones.png Not determined
  • OS
    icon_customdatatype.png Not determined
  • Architecture
    icon_customdatatype.png Not determined
  • Fixed in
    icon_customdatatype.png Arx Libertatis 1.1
Issue description
  1.  


solved by adding
  1.  


in CMakeList.txt
Steps to reproduce this issue
Nothing entered.

#2
icon_reply.pngReply
Comment posted by
 Daniel Scharrer
Jul 13, 15:46
Just hardcoding these paths in CMakeLists.txt is not the solution.

Is the INCLUDE_DIRECTORIES(/opt/local/include) really needed? The include directory for SDL headers should already have been found by SDL as ${SDL_INCLUDE_DIR}. Do you perhaps have have two SDL intallations and the one CMake finds doesn't have SDL_main.h. What happens if you replace #include <SDL_main.h> with #include <SDL.h> in src/core/Startup.cpp - or does that just bring back Crash report 514 - Crash on Mac OS X at start?

As for LINK_DIRECTORIES(/opt/local/lib), the FindSDL CMake module should also find the full path to the SDLmain library. However it seems we for it to link to SDLmain on OS X, which is most likely wrong, at least without first using find_library. What happends if you remove the list(APPEND SDL_LIBRARIES "SDLmain") line in CMakeLists.txt?

The comments in FindSDL.cmake have this to say:
  1.  


It seems that SDL for OS X is distributed in two variants - the official framework version that requires projects to manually include SDL_main.h and SDL_main.m in their sources (hey, SDL devs, who though this was an acceptable solution) and the macports/whatever version that provides libSDLmain.h.

So our CMakeLists.txt at this point works with the non-framework version, but not with the .framework version -- and it also breaks if both are installed :S

Is there a way we can fix this for the .framwework version without including SDL_main.m in our source tree? Is there an SDL_main.m in the SDL.framework and (how) can we tell CMake to use it? I really don't know much about OS X frameworks.

Thankfully it looks like SDLmain is gone in SDL 2.0 (1), so this will fix itself when we move to that.

(1) http://lists.libsdl.org/pipermail/sdl-libsdl.org/2012-November/086414.html
#3
icon_reply.pngReply
Comment posted by
 xanm
icon_reply.pngJul 13, 19:44, in reply to comment #2
sorry INCLUDE_DIRECTORIES(/opt/local/include) i added by accident, but without LINK_DIRECTORIES(/opt/local/lib) the same error i posted

cake output:

  1.  


looks like cmake found it
  1.  


but compiler still cant find it
#4
icon_reply.pngReply
Comment posted by
 xanm
icon_reply.pngJul 13, 19:58, in reply to comment #3
when i remove list(APPEND SDL_LIBRARIES "SDLmain") all is fine
#6
icon_reply.pngReply
Comment posted by
 Daniel Scharrer
icon_reply.pngJul 14, 00:09, in reply to comment #4
Thanks for checking.

I removed the offending code from CMakeLists.txt - is everything working OK now?

Linking will probably still not work with the .framework version, but it's probably best to just wait for SDL 2 to fix that as I have no way to test it.
#8
icon_reply.pngReply
Comment posted by
 xanm
icon_reply.pngJul 14, 07:28, in reply to comment #6
Yes, everything is ok now i built right from the repo and all work fine

#9
icon_reply.pngReply
Comment posted by
 Daniel Scharrer
Jul 14, 11:38
Ok, thanks for checking.

The issue was updated with the following change(s):
  • This issue has been closed
  • The status has been updated, from New to Fixed.
  • The resolution has been updated, from Not determined to RESOLVED.
  • This issue's progression has been updated to 100 percent completed.