ССЫЛКА СВЯЗИ - SDL (ld: framework не найден SDL) - PullRequest
0 голосов
/ 31 августа 2018

Попытка построить базовый код SDL на MAC-sierra (версия 10.13.3)

Получение (ld: framework не найден SDL) ОШИБКА.

Вот последняя команда с make VERBOSE = 1

/usr/bin/g++ -Wall -Wpedantic -Wextra -Wl,-search_paths_first -Wl,- 
headerpad_max_install_names  CMakeFiles/sdl2web.dir/main.cpp.o  -o 
sdl2web  -L/usr/local/lib/ -lGLEW -F/usr/local - 
I/usr/local/include/SDL2/ -framework SDL2 -framework OpenGL

добавив больше деталей:

cd /usr/local/include/SDL2/ ; ls
SDL.h .. and other header files

pwd
/usr/local/lib
libGLEW.a
libSDL2.a
libSDL2main.a

pwd
/usr/local
SDL2.framework

1 Ответ

0 голосов
/ 02 сентября 2018

У вас есть некоторые проблемы с установкой sdl2 на ваш компьютер. На моей машине под управлением MacOS High Sierra (10.13.6) с XCode 9.4.1 я выполнил следующие команды, чтобы заставить его работать:

$ git clone https://github.com/nickdesaulniers/sdl2web 
Cloned into sdl2web
$ cd sdl2web
$ brew install cmake sdl2
$ cmake .
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for SDL2 - found
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework   
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/suraj/Documents/GitHub/sdl2web
$ make VERBOSE=1
/usr/local/Cellar/cmake/3.12.1/bin/cmake -H/Users/suraj/Documents/GitHub/sdl2web -B/Users/suraj/Documents/GitHub/sdl2web --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.12.1/bin/cmake -E cmake_progress_start /Users/suraj/Documents/GitHub/sdl2web/CMakeFiles /Users/suraj/Documents/GitHub/sdl2web/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/sdl2web.dir/build.make CMakeFiles/sdl2web.dir/depend
cd /Users/suraj/Documents/GitHub/sdl2web && /usr/local/Cellar/cmake/3.12.1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/suraj/Documents/GitHub/sdl2web /Users/suraj/Documents/GitHub/sdl2web /Users/suraj/Documents/GitHub/sdl2web /Users/suraj/Documents/GitHub/sdl2web /Users/suraj/Documents/GitHub/sdl2web/CMakeFiles/sdl2web.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/sdl2web.dir/build.make CMakeFiles/sdl2web.dir/build
[ 50%] Building CXX object CMakeFiles/sdl2web.dir/main.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -I/usr/local/include/SDL2  -Wall -Wpedantic -Wextra   -std=gnu++11 -o CMakeFiles/sdl2web.dir/main.cpp.o -c /Users/suraj/Documents/GitHub/sdl2web/main.cpp
[100%] Linking CXX executable sdl2web
/usr/local/Cellar/cmake/3.12.1/bin/cmake -E cmake_link_script CMakeFiles/sdl2web.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -Wall -Wpedantic -Wextra -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/sdl2web.dir/main.cpp.o  -o sdl2web /usr/local/lib/libSDL2.dylib -framework OpenGL -framework OpenGL 
[100%] Built target sdl2web
/usr/local/Cellar/cmake/3.12.1/bin/cmake -E cmake_progress_start /Users/suraj/Documents/GitHub/sdl2web/CMakeFiles 0

Чтобы устранить эту проблему на вашем компьютере, попробуйте переустановить cmake и sdl2 с помощью brew. Проверьте вывод pkg-config на правильность флагов:

$ pkg-config --libs --cflags sdl2
-D_THREAD_SAFE -I/usr/local/include/SDL2 -L/usr/local/lib -lSDL2
...