deathkiller / jazz2-native

🎮 · Jazz² Resurrection: Native C++ reimplementation of Jazz Jackrabbit 2
https://deat.tk/jazz2/
GNU General Public License v3.0
552 stars 37 forks source link

Errors linking GL functions #69

Closed vanfanel closed 4 months ago

vanfanel commented 4 months ago

Jazz² Resurrection version

Latest GIT version

System information

Debian Testing

Issue description

When trying to build latest GIT code, I get a bunch of OpenGL linking errors:

[  1%] Linking CXX executable jazz2
/usr/bin/ld: /tmp/ccGTDl5F.ltrans2.ltrans.o: in function `nCine::IGfxDevice::setupGL()':
<artificial>:(.text+0x13aa): undefined reference to `glDisable'
/usr/bin/ld: <artificial>:(.text+0x13d1): undefined reference to `glBlendFunc'
/usr/bin/ld: <artificial>:(.text+0x13fe): undefined reference to `glEnable'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans2.ltrans.o: in function `nCine::GLTexture::texParameteri(unsigned int, int)':
<artificial>:(.text+0x1ef1): undefined reference to `glBindTexture'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans2.ltrans.o: in function `nCine::GLTexture::bindHandle(unsigned int, unsigned int, unsigned int)':
<artificial>:(.text+0x2014): undefined reference to `glBindTexture'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans2.ltrans.o: in function `nCine::GLViewport::setRect(nCine::Rect<int> const&)':
<artificial>:(.text+0x2f10): undefined reference to `glViewport'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans2.ltrans.o: in function `nCine::RenderCommand::issue()':
<artificial>:(.text+0x34b1): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x3961): undefined reference to `glDrawArrays'
/usr/bin/ld: <artificial>:(.text+0x3bd7): undefined reference to `glDisable'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans2.ltrans.o: in function `nCine::GLTexture::texParameteri(unsigned int, int)':
<artificial>:(.text+0x1f39): undefined reference to `glTexParameteri'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans11.ltrans.o: in function `Jazz2::LevelHandler::OnInitializeViewport(int, int)':
<artificial>:(.text+0xaa5a): undefined reference to `glGenTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans1.ltrans.o: in function `nCine::GLScissorTest::enable(nCine::Rect<int> const&)':
<artificial>:(.text+0x9879): undefined reference to `glScissor'
/usr/bin/ld: <artificial>:(.text+0x98b6): undefined reference to `glEnable'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans30.ltrans.o: in function `Jazz2::UI::Font::Font(Death::Containers::BasicStringView<char const>, unsigned int const*)':
<artificial>:(.text+0x6c31): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0x6cc3): undefined reference to `glGetError'
/usr/bin/ld: <artificial>:(.text+0x6d09): undefined reference to `glTexSubImage2D'
/usr/bin/ld: <artificial>:(.text+0x6d12): undefined reference to `glGetError'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans3.ltrans.o: in function `nCine::Texture::~Texture()':
<artificial>:(.text+0x1c2a): undefined reference to `glDeleteTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans3.ltrans.o: in function `nCine::Texture::~Texture()':
<artificial>:(.text+0x1d07): undefined reference to `glDeleteTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans3.ltrans.o: in function `nCine::Texture::setMinFiltering(nCine::SamplerFilter)':
<artificial>:(.text+0x50a1): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x5158): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x51a2): undefined reference to `glTexParameteri'
/usr/bin/ld: <artificial>:(.text+0x5210): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x5244): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x529f): undefined reference to `glBindTexture'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans3.ltrans.o: in function `nCine::Texture::setMagFiltering(nCine::SamplerFilter)':
<artificial>:(.text+0x5387): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x5448): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x5492): undefined reference to `glTexParameteri'
/usr/bin/ld: <artificial>:(.text+0x5500): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x5534): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x558f): undefined reference to `glBindTexture'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans3.ltrans.o: in function `nCine::Texture::setWrap(nCine::SamplerWrapping)':
<artificial>:(.text+0x5656): undefined reference to `glTexParameteri'
/usr/bin/ld: <artificial>:(.text+0x5687): undefined reference to `glTexParameteri'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans3.ltrans.o: in function `nCine::Viewport::draw(unsigned int)':
<artificial>:(.text+0x7706): undefined reference to `glBlendFunc'
/usr/bin/ld: <artificial>:(.text+0x78d2): undefined reference to `glClearColor'
/usr/bin/ld: <artificial>:(.text+0x78e9): undefined reference to `glClear'
/usr/bin/ld: <artificial>:(.text+0x7937): undefined reference to `glClearColor'
/usr/bin/ld: <artificial>:(.text+0x7a8f): undefined reference to `glDisable'
/usr/bin/ld: <artificial>:(.text+0x7aad): undefined reference to `glDisable'
/usr/bin/ld: <artificial>:(.text+0x7aec): undefined reference to `glDepthMask'
/usr/bin/ld: <artificial>:(.text+0x7b02): undefined reference to `glEnable'
/usr/bin/ld: <artificial>:(.text+0x7b18): undefined reference to `glDepthMask'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans9.ltrans.o: in function `Jazz2::ContentResolver::RequestGraphicsAura(Death::Containers::BasicStringView<char const>, unsigned short)':
<artificial>:(.text+0xef2): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0xf89): undefined reference to `glGetError'
/usr/bin/ld: <artificial>:(.text+0xfd4): undefined reference to `glTexSubImage2D'
/usr/bin/ld: <artificial>:(.text+0xfdd): undefined reference to `glGetError'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans9.ltrans.o: in function `Jazz2::ContentResolver::RequestGraphics(Death::Containers::BasicStringView<char const>, unsigned short)':
<artificial>:(.text+0x255d): undefined reference to `glGenTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans10.ltrans.o: in function `Jazz2::ContentResolver::GetNoiseTexture()':
<artificial>:(.text+0x1be2): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0x1c56): undefined reference to `glGetError'
/usr/bin/ld: <artificial>:(.text+0x1c98): undefined reference to `glTexSubImage2D'
/usr/bin/ld: <artificial>:(.text+0x1ca1): undefined reference to `glGetError'
/usr/bin/ld: <artificial>:(.text+0x1d32): undefined reference to `glTexParameteri'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans10.ltrans.o: in function `Jazz2::ContentResolver::RequestTileSet(Death::Containers::BasicStringView<char const>, unsigned short, bool, unsigned char const*)':
<artificial>:(.text+0x3e93): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0x3f1c): undefined reference to `glGetError'
/usr/bin/ld: <artificial>:(.text+0x3f73): undefined reference to `glTexSubImage2D'
/usr/bin/ld: <artificial>:(.text+0x3f7c): undefined reference to `glGetError'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans10.ltrans.o: in function `Jazz2::ContentResolver::GetEpisodeByPath(Death::Containers::BasicStringView<char const>, bool)':
<artificial>:(.text+0x8146): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0x844a): undefined reference to `glGenTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans13.ltrans.o: in function `Jazz2::PlayerViewport::Initialize(nCine::SceneNode*, nCine::SceneNode*, nCine::Rect<int>, bool)':
<artificial>:(.text+0x5a8c): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0x6413): undefined reference to `glGenTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans29.ltrans.o: in function `Jazz2::UI::Cinematics::OnBeginFrame()':
<artificial>:(.text+0x8be): undefined reference to `glGetError'
/usr/bin/ld: <artificial>:(.text+0x907): undefined reference to `glTexSubImage2D'
/usr/bin/ld: <artificial>:(.text+0x910): undefined reference to `glGetError'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans29.ltrans.o: in function `Jazz2::UI::Cinematics::Cinematics(Jazz2::IRootController*, Death::Containers::BasicStringView<char const>, std::function<bool (Jazz2::IRootController*, bool)>&&)':
<artificial>:(.text+0x87b8): undefined reference to `glGenTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans31.ltrans.o: in function `Jazz2::UI::UpscaleRenderPass::Initialize(int, int, int, int)':
<artificial>:(.text+0x749e): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0x79f4): undefined reference to `glGenTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans34.ltrans.o: in function `Jazz2::UI::Menu::MainMenu::OnInitializeViewport(int, int)':
<artificial>:(.text+0xa282): undefined reference to `glGenTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans37.ltrans.o: in function `nCine::MainApplication::Init(std::unique_ptr<nCine::IAppEventHandler, std::default_delete<nCine::IAppEventHandler> > (*)(), int, char**) [clone .constprop.0]':
<artificial>:(.text+0x9d27): undefined reference to `glGetString'
/usr/bin/ld: <artificial>:(.text+0x9d53): undefined reference to `glGetString'
/usr/bin/ld: <artificial>:(.text+0x9d61): undefined reference to `glGetString'
/usr/bin/ld: <artificial>:(.text+0x9d6f): undefined reference to `glGetString'
/usr/bin/ld: <artificial>:(.text+0x9d7d): undefined reference to `glGetString'
/usr/bin/ld: <artificial>:(.text+0x9d8e): undefined reference to `glGetIntegerv'
/usr/bin/ld: <artificial>:(.text+0x9d9c): undefined reference to `glGetIntegerv'
/usr/bin/ld: <artificial>:(.text+0x9daa): undefined reference to `glGetIntegerv'
/usr/bin/ld: <artificial>:(.text+0x9db8): undefined reference to `glGetIntegerv'
/usr/bin/ld: <artificial>:(.text+0x9dc6): undefined reference to `glGetIntegerv'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans37.ltrans.o:<artificial>:(.text+0x9dd4): more undefined references to `glGetIntegerv' follow
/usr/bin/ld: /tmp/ccGTDl5F.ltrans38.ltrans.o: in function `nCine::GLTexture::bindHandle(unsigned int, unsigned int, unsigned int) [clone .constprop.0]':
<artificial>:(.text+0x46f9): undefined reference to `glBindTexture'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans38.ltrans.o: in function `nCine::Texture::setMagFiltering(nCine::SamplerFilter) [clone .constprop.0]':
<artificial>:(.text+0x4808): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x48be): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x4903): undefined reference to `glTexParameteri'
/usr/bin/ld: <artificial>:(.text+0x496f): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x49a4): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x49ff): undefined reference to `glBindTexture'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans38.ltrans.o: in function `nCine::Texture::setMinFiltering(nCine::SamplerFilter) [clone .constprop.0]':
<artificial>:(.text+0x4ad8): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x4b8e): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x4bd3): undefined reference to `glTexParameteri'
/usr/bin/ld: <artificial>:(.text+0x4c3f): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x4c74): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x4ccf): undefined reference to `glBindTexture'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans38.ltrans.o: in function `nCine::Texture::loadFromTexels(unsigned char const*, unsigned int, unsigned int, unsigned int, unsigned int) [clone .constprop.0] [clone .isra.0]':
<artificial>:(.text+0x72e6): undefined reference to `glGetError'
/usr/bin/ld: <artificial>:(.text+0x7363): undefined reference to `glBindTexture'
/usr/bin/ld: <artificial>:(.text+0x73bc): undefined reference to `glTexSubImage2D'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans38.ltrans.o: in function `nCine::Texture::init(char const*, nCine::Texture::Format, int, int, int) [clone .constprop.0] [clone .isra.0]':
<artificial>:(.text+0x770f): undefined reference to `glTexImage2D'
/usr/bin/ld: <artificial>:(.text+0x77c8): undefined reference to `glGenTextures'
/usr/bin/ld: <artificial>:(.text+0x7838): undefined reference to `glDeleteTextures'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans38.ltrans.o: in function `nCine::Texture::loadFromTexels(unsigned char const*, unsigned int, unsigned int, unsigned int, unsigned int) [clone .constprop.0] [clone .isra.0]':
<artificial>:(.text+0x73cf): undefined reference to `glGetError'
/usr/bin/ld: /tmp/ccGTDl5F.ltrans39.ltrans.o: in function `Jazz2::BlurRenderPass::Initialize(nCine::Texture*, int, int, nCine::Vector2<float> const&) [clone .isra.0]':
<artificial>:(.text+0xac70): undefined reference to `glGenTextures'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/jazz2.dir/build.make:4730: jazz2] Error 1
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/jazz2.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Doing make VERBOSE=1, I can see it's missing -lOpenGL, so adding it to the linking line, it links succesfully. So.. the problem is that -lOpenGL has gone missing on the GIT code for some reason.

Steps to reproduce

Try to build latest GIT code on GNU/Linux.

deathkiller commented 4 months ago

I don't think I did any changes to build system. All GitHub builds are fine. The only way to fix it on your side is probably to find the bad commit. Can you try different commits? You can probably stop on commit from 27th May - it should contain the changes I made for you the last time.

vanfanel commented 4 months ago

@deathkiller I found the problem. Made a PR here to fix this issue: https://github.com/deathkiller/jazz2-native/pull/70

CMake's modern day OpenGL detection is sooo flaky... Internal efforts to make CMake detect modern GLVN OpenGL implementation seems to be confusing and not quite working as supposed to work. Well, my commit works around that. So it should be solved now.

vanfanel commented 4 months ago

Ah wait. I have yet to fix something with regards to GLX-only systems.. Don't merge that yet.

vanfanel commented 4 months ago

@deathkiller Please merge https://github.com/deathkiller/jazz2-native/pull/71 This one is the right fix.