xray-16
xray-16 copied to clipboard
[Ubuntu 20.04][Cmake] SDL2::SDL2 target was not found
Describe the bug I'm trying to build OpenXray on Ubuntu 20.04. While SDL2 library is installed on my machine:
$ sudo apt-get install libsdl2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsdl2-dev is already the newest version (2.0.10+dfsg1-3).
0 upgraded, 0 newly installed, 0 to remove and 58 not upgraded.
Cmake fails with:
Target "xrCore" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Desktop (please complete the following information):
- OS: Ubuntu 20.04.6 LTS
- Cmake 3.28.1
- OpenXRay
dev
branch
Additional context
- May be related to #1535
- Build from branch
2188-november-2023-rc1
works fine
Full Cmake logs
$ cmake ..
-- CMAKE_VERSION: 3.28.1
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_VERBOSE_MAKEFILE: FALSE
-- git commit: be53de4e2217b7e52be76d7d371e9d34791a1789
-- git branch: dev
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- CMAKE_BUILD_TYPE: Release
-- MASTER_GOLD: ON
-- STATIC_BUILD: ON
-- CMAKE_UNITY_BUILD: OFF
-- USE_ADDRESS_SANITIZER: OFF
-- USE_LTO: ON
-- Performing Test GOLD_LINKER_AVAILABLE
-- Performing Test GOLD_LINKER_AVAILABLE - Success
-- Performing Test LLD_LINKER_AVAILABLE
-- Performing Test LLD_LINKER_AVAILABLE - Success
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found GLEW: /usr/include (found version "2.1.0")
-- Found OpenAL: /usr/lib/x86_64-linux-gnu/libopenal.so
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Found Ogg: /usr/lib/x86_64-linux-gnu/libogg.so
-- Found Vorbis: /usr/lib/x86_64-linux-gnu/libvorbis.so
-- Found Theora: /usr/lib/x86_64-linux-gnu/libtheora.so
-- Found LZO: /usr/lib/x86_64-linux-gnu/liblzo2.so
-- Could NOT find mimalloc (missing: mimalloc_DIR)
Using standard memory allocator
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
rm -f luajit libluajit.a libluajit.so host/minilua host/buildvm lj_vm.S lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h host/buildvm_arch.h jit/vmdef.lua *.o host/*.o *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
-- Configuring done (1.6s)
CMake Error at src/xrCore/CMakeLists.txt:444 (target_link_libraries):
Target "xrCore" links to:
SDL2::SDL2
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done (0.4s)
CMake Generate step failed. Build files cannot be regenerated correctly.
The fix doesn't working:
[ 8%] Building CXX object src/xrCore/CMakeFiles/xrCore.dir/XML/tinystr.cpp.o
[ 8%] Building CXX object src/xrCore/CMakeFiles/xrCore.dir/XML/tinyxml.cpp.o
[ 9%] Building CXX object src/xrCore/CMakeFiles/xrCore.dir/XML/tinyxmlerror.cpp.o
[ 9%] Building CXX object src/xrCore/CMakeFiles/xrCore.dir/XML/tinyxmlparser.cpp.
make[2]: *** No rule to make target '-L/usr/lib -Wl,-rpath,/usr/lib -Wl,--enable-new-dtags -lSDL2', needed by '../bin/x86/Release/xrCore.so'. Stop.
make[1]: *** [CMakeFiles/Makefile2:1264: src/xrCore/CMakeFiles/xrCore.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
@Zenitur
The issue you have posted looks slightly different than was originally reported here.
Could you please add more details including OS that you are using and full log output from Cmake and build?
Also could you please double check that you actually have SDL installed:
sudo apt-get upgrade
sudo apt-get update
sudo apt-get install libsdl2-dev
Здравствуйте. Если вас не смутит, я отвечу на русском языке. Потому что, пока я делал сборку игры, я так, извините, затрахался, что голова уже не соображает писать по английски. Надеюсь на понимание. У меня не deb-based дистрибутив, соответственно apt-get там нет. Я выполняю сборку игры с SDL 2.0.6, потому что это минимально поддерживаемая версия. Уверен, что и сейчас можно собрать с этой версией, потому что проблема не в версии библиотеки. Сборка "свалилась" после коммита "рефакторинг cmake" от 2 декабря 2023.
@Zenitur, я принял пул-реквест. Можешь проверить ещё раз, работает или нет?