Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ubuntu 20.04][Cmake] SDL2::SDL2 target was not found #1595

Closed
pavel-rodionov opened this issue Jan 28, 2024 · 4 comments · Fixed by #1596
Closed

[Ubuntu 20.04][Cmake] SDL2::SDL2 target was not found #1595

pavel-rodionov opened this issue Jan 28, 2024 · 4 comments · Fixed by #1596
Labels
Build issue The issue in the build-time. Linux

Comments

@pavel-rodionov
Copy link
Contributor

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

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.
@pavel-rodionov pavel-rodionov added the Bug The issue in the run-time. label Jan 28, 2024
@Xottab-DUTY Xottab-DUTY added Build issue The issue in the build-time. Linux and removed Bug The issue in the run-time. labels Jan 28, 2024
pavel-rodionov added a commit to pavel-rodionov/xray-16 that referenced this issue Jan 28, 2024
* Update CMake files to supported older SDL2
* Tested on Ubuntu 20.04
* Now project and be build and runs as expected
@Xottab-DUTY Xottab-DUTY linked a pull request Jan 28, 2024 that will close this issue
pavel-rodionov added a commit to pavel-rodionov/xray-16 that referenced this issue Jan 29, 2024
* Update CMake files to supported older SDL2
* Tested on Ubuntu 20.04 & 23.10
* Now project can be build and runs as expected
@Zenitur
Copy link

Zenitur commented Feb 10, 2024

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

@pavel-rodionov
Copy link
Contributor Author

@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

@Zenitur
Copy link

Zenitur commented Feb 11, 2024

Здравствуйте. Если вас не смутит, я отвечу на русском языке. Потому что, пока я делал сборку игры, я так, извините, затрахался, что голова уже не соображает писать по английски. Надеюсь на понимание.
У меня не deb-based дистрибутив, соответственно apt-get там нет. Я выполняю сборку игры с SDL 2.0.6, потому что это минимально поддерживаемая версия. Уверен, что и сейчас можно собрать с этой версией, потому что проблема не в версии библиотеки. Сборка "свалилась" после коммита "рефакторинг cmake" от 2 декабря 2023.

@Xottab-DUTY
Copy link
Member

@Zenitur, я принял пул-реквест. Можешь проверить ещё раз, работает или нет?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build issue The issue in the build-time. Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants