Export to GitHub

wxlauncher - issue #62

ba871aef2e39 broke cmake on OS X


Posted on Jul 6, 2011 by Massive Rabbit

What steps will reproduce the problem? 1. Checkout code after ba871aef2e39 2. run cmake .. in build folder 3. Profit

What is the expected output? What do you see instead? CMake Error at cmake/wxLauncherInstaller.cmake:160 (install): install DIRECTORY given non-directory "/opt/local/lib/libSDLmain.a" to install. Call Stack (most recent call first): CMakeLists.txt:258 (include)

What version of the wxLauncher are you using: latest hg checkout What version of fs2_open: n/a What mods (and version, if known): n/a

What operating system and version: OS X 10.6

Please provide any additional information below. Looks like line 160 of cmake/wxLauncherInstaller.cmake references expects ${SDL_LIBRARY} to be a directory, but it's a file at that point. Not sure if the fix is to change that to FILES, or to change SDL_LIBRARY to point to a folder containing libSDL instead of the libSDL file itself.

Comment #1

Posted on Jul 8, 2011 by Grumpy Bear

Comment deleted

Comment #2

Posted on Jul 8, 2011 by Grumpy Bear

Comment deleted

Comment #3

Posted on Jul 8, 2011 by Grumpy Bear

Sorry about that. The reason is that I was using a version of SDL.framework (specifically, the one from the trunk in the FSO source tree http://svn.icculus.org/*checkout*/fs2open/trunk/fs2_open/projects/Xcode/Frameworks.tgz ) and needed CMake to copy the framework into the .app bundle. I haven't yet tried static linking, which is what you were doing.

As a short-term workaround, I'd say try using the SDL.framework. Since wxL's Cmake build files expect SDL to be installed on the system, you'll need to install it (that is, copy SDL.framework to /Library/Frameworks/). Once CMake has created the Xcode project, you'll need to build the "package" target to produce a working .app (which I'll note in the Readme). I'll add a fix to the CMake files that will support either static or dynamic linking of SDL on OS X. Since I haven't tried using static linking yet, though, I'm not sure if any additional changes will need to made for it to work.

Comment #4

Posted on Jul 8, 2011 by Grumpy Bear

Alternatively, another short-term workaround might be to comment out the offending line in cmake/wxLauncherInstaller.cmake in your working copy, since copying SDL isn't necessary if static linking is used. However, without having tried statically linking SDL into wxL before, I can't be sure that doing that will work, although I think it will.

Comment #5

Posted on Jul 8, 2011 by Massive Rabbit

Ok, so I tried with copying the SDL.framework to /Library/Frameworks/. It now gets this far, after completing 'cmake ..' and then 'make':

Linking CXX executable wxlauncher.app/Contents/MacOS/wxlauncher ld: framework not found SDL collect2: ld returned 1 exit status make[2]: * [wxlauncher.app/Contents/MacOS/wxlauncher] Error 1 make[1]: * [CMakeFiles/wxlauncher.dir/all] Error 2 make: * [all] Error 2

When I run an Xcode project instead, and run xcodebuild -configuration Release, I get this:

/bin/sh -c /Users/cliffgordon/wxlauncher/build/wxlauncher.build/Release/wxlauncher.build/Script-10203F010203F010203F0000.sh

make: `CMakeFiles/cmake.check_cache' is up to date. CompileC build/wxlauncher.build/Release/wxlauncher.build/Objects-normal/i386/version_strings.o build/generated/version_strings.cpp normal i386 c++ com.apple.compilers.gcc.4_2 cd /Users/cliffgordon/wxlauncher setenv LANG en_US.US-ASCII /Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O3 -mdynamic-no-pic -DCMAKE_INTDIR="Release" -D_BIND_TO_CURRENT_CRT_VERSION=1 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/cliffgordon/wxlauncher/build/Release -F/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks -I/Users/cliffgordon/wxlauncher/build/Release/include -I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenAL.framework/Headers -I/Library/Frameworks/SDL.framework/Headers -I/opt/local/lib/wx/include/mac-unicode-release-2.8 -I/opt/local/include/wx-2.8 -I/Users/cliffgordon/wxlauncher/build -I/Users/cliffgordon/wxlauncher/code -I/Users/cliffgordon/wxlauncher/build/wxlauncher.build/Release/wxlauncher.build/DerivedSources/i386 -I/Users/cliffgordon/wxlauncher/build/wxlauncher.build/Release/wxlauncher.build/DerivedSources -I/opt/local/include/wx-2.8 -DNDEBUG -c /Users/cliffgordon/wxlauncher/build/generated/version_strings.cpp -o /Users/cliffgordon/wxlauncher/build/wxlauncher.build/Release/wxlauncher.build/Objects-normal/i386/version_strings.o

Ld build/Release/wxlauncher.app/Contents/MacOS/wxlauncher normal i386 cd /Users/cliffgordon/wxlauncher setenv MACOSX_DEPLOYMENT_TARGET 10.6 /Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/cliffgordon/wxlauncher/build/Release -L/opt/local/lib/Release -L/opt/local/lib -F/Users/cliffgordon/wxlauncher/build/Release -F/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks -filelist /Users/cliffgordon/wxlauncher/build/wxlauncher.build/Release/wxlauncher.build/Objects-normal/i386/wxlauncher.LinkFileList -mmacosx-version-min=10.6 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -L/opt/local/lib -arch i386 -L/opt/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL -lwx_macu-2.8 -framework SDL -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL -lwx_macu-2.8 -framework SDL -o /Users/cliffgordon/wxlauncher/build/Release/wxlauncher.app/Contents/MacOS/wxlauncher

ld: warning: directory '/opt/local/lib/Release' following -L not found ld: framework not found SDL collect2: ld returned 1 exit status Command /Developer/usr/bin/g++-4.2 failed with exit code 1 Command /Developer/usr/bin/g++-4.2 failed with exit code 1

It still seems to be thinking there's something it wants in my libs directory, even though it did find the SDL framework during configuration. What else should it be trying to link from /opt/local/lib?

Comment #6

Posted on Jul 8, 2011 by Grumpy Bear

If it's using the SDL framework, it shouldn't be trying to link anything from /opt/local/lib . It sounds like CMake/Xcode might be confusing the static build of SDL in /opt/local with the SDL.framework in /Library/Frameworks, since your build of wxWidgets is also in /opt/local. The warning about /opt/local/lib/Release is likely irrelevant: CMake adds additional directories for the linker to look, and some of those might be invalid. I have a similar problem.

Two possible fixes immediately come to mind:

(1) [less likely to work] reconfigure and rerun CMake, ensuring that the CMake variable SDL_INCLUDE_DIR is set to /Library/Frameworks/SDL.framework/Headers and that the CMake variable SDL_LIBRARY is set to /Library/Frameworks/SDL.framework (this is a case where the CMake GUI may be easier to use than the command line)

(2) [somewhat more likely to work] remove the copy of SDL.framework from /Library/Frameworks, comment out the line in wxLauncherInstaller.cmake that's causing the problem (that is, the line that tries to copy ${SDL_LIBRARY} as a directory), and re-run CMake.

Let me know if either of those two fixes work.

Comment #7

Posted on Jul 20, 2011 by Massive Rabbit

Removing that line, then rerunning cmake and rebuilding lead to a successful build process. The build runs, although takes a long time to start, both on first run and subsequent runs, but subsequent runs are only half as slow.

Comment #8

Posted on Aug 6, 2011 by Grumpy Bear

Issue fixed in changeset f7b60c98ee6c.

Status: Fixed

Labels:
Type-Defect OpSys-OSX