Skip to content

Draft: Fix libosgQtrd linker error

cykoder requested to merge cykoder/openmw:fix/libosgQtrd-build-error into master

Fixes the following error when building without system OSG:

/usr/bin/ld: ../../extern/osgQt/libosgQtrd.a(moc_osgQOpenGLWidget.cpp.o): warning: relocation against `_ZN16osgQOpenGLWidget11initializedEv' in read-only section `.text' /usr/bin/ld: ../../extern/osgQt/libosgQtrd.a(osgQOpenGLWidget.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN16osgQOpenGLWidget25setDefaultDisplaySettingsEv' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make[2]: *** [apps/opencs/CMakeFiles/openmw-cs-lib.dir/build.make:4075: libopenmw-csrd.so] Error 1

Edit: The context is attempting to create my own entrypoint with minimal config, using openmw as a submodule. With this and !3874 I have achieved that. Separated the PRs as I wasn't sure if this was just an unexpected error and thought may be simpler to consider than the other combined. See comments below for example cmake file (but it also happens without cmake with those CLI flags set!)

cmake .. -DOPENMW_USE_SYSTEM_OSG=0 -DOSG_STATIC=1 -DOSG_PLUGINS=ON

x86_64-pc-linux-gnu / gcc version 13.2.1 20230801

Edited by cykoder

Merge request reports