libSDL,CMake和Mac OS X Lion 2 [英] libSDL, CMake and Mac OS X lion 2

查看:133
本文介绍了libSDL,CMake和Mac OS X Lion 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Mac上编译cmake项目,但这取决于SDL. 我已经读过"LibSDL,CMake和MacOSX Lion",但是我无法解决此问题.

I'm trying to compile a cmake project on my mac, but it depends on the SDL. I have alreaday read "LibSDL, CMake and MacOSX Lion", however I couldn't solve this problem.

CMakeList.txt

CMakeList.txt

cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
# Give a name to the project.
project(movehead)
# This include enable you to use our CMake framework
find_package(qibuild)
find_package(SDL REQUIRED)
link_directories( /usr/local/lib )
link_libraries (
     ${SDL_LIBRARY}
     SDLmain
)
# Create an executable named movehead,
# with the source file : movehead.cpp
qi_create_bin(movehead movehead.cpp)

# Tell CMake that movehead depends on ALCOMMON.
# This will set the libraries to link movehead with,
# the include paths, and so on
qi_use_lib(movehead ALCOMMON)

命令行

 sudo qibuild make -c naoqi-sdk movehead Active configuration: naoqi-sdk (Debug)
    Building movehead in naoqi-sdk (Debug)
    Scanning dependencies of target movehead
    Linking CXX executable sdk/bin/movehead
    ld: warning: ignoring file /usr/local/lib/libSDLmain.a, file was built for archive which is not the architecture being linked (i386)
    ld: warning: ignoring file /usr/local/lib/libSDL.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    Undefined symbols for architecture i386:
      "_main", referenced from:
          start in crt1.10.6.o
         (maybe you meant: _SDL_main)
      "_SDL_Init", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_NumJoysticks", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_JoystickEventState", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_JoystickOpen", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_JoystickName", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_JoystickNumAxes", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_PollEvent", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_JoystickGetButton", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_JoystickGetAxis", referenced from:
          _SDL_main in movehead.cpp.o
      "_SDL_QuitSubSystem", referenced from:
          _SDL_main in movehead.cpp.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [sdk/bin/movehead] Error 1
    make[1]: *** [CMakeFiles/movehead.dir/all] Error 2
    make: *** [all] Error 2
    [ERROR]     
                Error occured when building project movehead
    dhcp47-122:movehead yukke150$ sudo qibuild configure -c naoqi-sdk movehead --disable-assembly
    usage: qibuild [-h]


lipo -info /usr/local/lib/libSDL.dylib
Non-fat file: /usr/local/lib/libSDL.dylib is architecture: x86_64
lipo -info /usr/local/lib/libSDLmain.a
input file /usr/local/lib/libSDLmain.a is not a fat file
Non-fat file: /usr/local/lib/libSDLmain.a is architecture: x86_64

我认为这些文件是x86_64. 如何解决?

I think these file are x86_64. How to fix?

推荐答案

使用SDL的框架分发版(在SDL网站上提供)对我有用,可以在x86或x86_64中进行编译. 以前,我是从brew安装的,因此,如果相同(或Mac Port等),请不要忘记先卸载它们.

Use the framework distribution of SDL (provided on SDL website) work for me to compile in either x86 or x86_64. Previously I installed it from brew, so if same (or Mac Port, etc) don't forget to uninstall those first.

这篇关于libSDL,CMake和Mac OS X Lion 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆