multiple build breakages at the linking stages
i am having build issues when building the commit 9dfba37c of master (2021/05/29) at the linking stage for openmw
. i don't know if it's my cmake invocation but it's not adding all of the required libraries for the openmw
binary.
edit1 for getting the openmw
binary to link i have to apply this patch as a workaround so that it at least gets built, i know it's an awful hack:
diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt
index 06ae079..81db9af 100644
--- a/components/CMakeLists.txt
+++ b/components/CMakeLists.txt
@@ -290,3 +290,5 @@ endif()
set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE)
target_compile_definitions(components PUBLIC BT_USE_DOUBLE_PRECISION)
+
+target_link_libraries(components "z" "X11" "Xrandr" "Xinerama" "fontconfig")
edit2 just tried building the wizard and the launcher with static qt5
and unshield
and ran into linking related issues as well, though that was much more complicated to i just gave up on them.
dependencies:
- static sdl2 2.0.14
- static bullet 3.17
- static openscenegraph 3.6.5 (openMW fork)
- static boost 1.75.0
- static mygui 3.4.0
the rest are shared libs.
tools:
- x86_64 linux host w/ musl libc 1.2.2
- gcc 11.1.0
- ld.bfd 2.36.1
- cmake 3.20.0
build error:
samu: job failed: : && /usr/bin/x86_64-apathy-linux-musl-g++ -g0 -s -w -pipe -O3 -march=native -mtune=native -fPIC -L/mss/work/table/KEK/lib -I/mss/work/table/KEK/include -L/opt/boost-1.75.0/lib -I/opt/boost-1.75.0/include -Wall -Wextra -Wundef -Wno-unused-parameter -pedantic -Wno-long-long -Wno-unused-but-set-parameter -O2 -g -DNDEBUG -g0 -s -w -pipe -O3 -march=native -mtune=native -fPIC -L/mss/work/table/KEK/lib -I/mss/work/table/KEK/include -L/opt/boost-1.75.0/lib -I/opt/boost-1.75.0/include -Wl,--as-needed,--sort-common,-z,relro,-z,now,--gc-sections,-O2 -rdynamic -Wl,--whole-archive /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_bmp.a /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_dds.a /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_freetype.a /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_jpeg.a /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_osg.a /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_png.a /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_serializers_osg.a /mss/work/table/KEK/lib/osgPlugins-3.6.5/libosgdb_tga.a -Wl,--no-whole-archive apps/openmw/CMakeFiles/openmw.dir/ub_mwrender.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwinput.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwgui.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwdialogue.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwscript.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwsound.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwworld.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwphysics.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwclass.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwmechanics.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwstate.cpp.o apps/openmw/CMakeFiles/openmw.dir/ub_mwbase.cpp.o apps/openmw/CMakeFiles/openmw.dir/main.cpp.o apps/openmw/CMakeFiles/openmw.dir/engine.cpp.o -o openmw -Wl,-Bstatic -losgParticle -losgViewer -losgGA -losgShadow -losgDB -losgUtil -losg -lboost_system -lboost_filesystem -lboost_program_options -lopenal -Wl,-Bdynamic -lavcodec -lavformat -lavutil -lswscale -lswresample -Wl,-Bstatic -lMyGUIEngineStatic -lSDL2 extern/osg-ffmpeg-videoplayer/libosg-ffmpeg-videoplayer.a extern/oics/liboics.a components/libcomponents.a -Wl,-Bdynamic -lfreetype -ljpeg -lpng -lavcodec -lavformat -lavutil -lswscale -lswresample extern/oics/liblocal_tinyxml.a -Wl,-Bstatic -losgParticle -losgViewer -losgShadow -losgAnimation -losgGA -losgText -losgDB -losgUtil -losg -lOpenThreads -lboost_system -lboost_filesystem -lboost_program_options -lboost_iostreams -Wl,-Bdynamic -L/mss/work/table/KEK/lib -lSDL2 -Wl,--no-undefined -lm -lpthread -lrt -lGL -Wl,-Bstatic -lMyGUIEngineStatic -Wl,-Bdynamic /usr/lib/liblz4.so _deps/recastnavigation-build/DebugUtils/libDebugUtils.a _deps/recastnavigation-build/DetourTileCache/libDetourTileCache.a _deps/recastnavigation-build/Detour/libDetour.a _deps/recastnavigation-build/Recast/libRecast.a -Wl,-Bstatic -lBulletCollision -lLinearMath -Wl,-Bdynamic && :
/usr/bin/ld: /usr/lib/gcc/x86_64-apathy-linux-musl/11.1.0/../../../../lib/libavcodec.so: undefined reference to symbol 'deflateInit2_'
/usr/bin/ld: /usr/lib/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
samu: subcommand failed
cmake invocation
i had to try really hard for cmake to acknowledge the static libraries located in $thing
path instead of the rootfs, hence the awkward hoops.
gamedir="/mnt/mss/stuff/media/games/openmw"
thing="/mss/work/table/KEK"
CFLAGS="-g0 -s -w -pipe -O3 -march=native -mtune=native -fPIC"
CFLAGS="${CFLAGS} -L${thing}/lib -I${thing}/include"
export CFLAGS="${CFLAGS} -L/opt/boost-1.75.0/lib -I/opt/boost-1.75.0/include"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="${CFLAGS} -Wl,--as-needed,--sort-common,-z,relro,-z,now,--gc-sections,-O2"
cmake -Wno-dev -GNinja \
-DCMAKE_INSTALL_PREFIX="${gamedir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS" \
-DCMAKE_AR="$AR" \
-DCMAKE_NM="$NM" \
-DCMAKE_STRIP="$STRIP" \
-DCMAKE_RANLIB="$RANLIB" \
-DCMAKE_LINKER="$LD" \
-DCMAKE_OBJCOPY="$OBJCOPY" \
-DCMAKE_OBJDUMP="$OBJDUMP" \
-DCMAKE_READELF="$READELF" \
-DCMAKE_ADDR2LINE="$ADDR2LINE" \
-DCMAKE_C_COMPILER="$CC" \
-DCMAKE_CXX_COMPILER="$CXX" \
\
-DGLOBAL_DATA_PATH="${gamedir}/share" \
-DICONDIR="${gamedir}/share/icons/hicolor/256x256/apps" \
-DMORROWIND_DATA_FILES="${gamedir}/share/morrowind-data" \
\
-DBUILD_BENCHMARKS=OFF \
-DBUILD_BSATOOL=OFF \
-DBUILD_DOCS=OFF \
-DBUILD_ESMTOOL=OFF \
-DBUILD_ESSIMPORTER=OFF \
-DBUILD_LAUNCHER=OFF \
-DBUILD_MWINIIMPORTER=OFF \
-DBUILD_NIFTEST=OFF \
-DBUILD_OPENCS=OFF \
-DBUILD_OPENMW=ON \
-DBUILD_UNITTESTS=OFF \
-DBUILD_WITH_CODE_COVERAGE=OFF \
-DBUILD_WIZARD=OFF \
-DOPENMW_UNITY_BUILD=ON \
\
-DOPENMW_USE_SYSTEM_BULLET=ON \
-DOPENMW_USE_SYSTEM_MYGUI=ON \
-DOPENMW_USE_SYSTEM_OSG=ON \
-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=OFF \
-DOPENMW_USE_SYSTEM_TINYXML=OFF \
\
-DBOOST_STATIC=ON \
-DMYGUI_STATIC=ON \
-DOSG_STATIC=ON \
-DSDL2_STATIC=ON \
\
-DOPENTHREADS_LIBRARY_RELEASE="${thing}"/lib/libOpenThreads.a \
-DOSGANIMATION_LIBRARY_RELEASE="${thing}"/lib/libosgAnimation.a \
-DOSGDB_LIBRARY_RELEASE="${thing}"/lib/libosgDB.a \
-DOSGFX_LIBRARY_RELEASE="${thing}"/lib/libosgFX.a \
-DOSGGA_LIBRARY_RELEASE="${thing}"/lib/libosgGA.a \
-DOSGPARTICLE_LIBRARY_RELEASE="${thing}"/lib/libosgParticle.a \
-DOSGSHADOW_LIBRARY_RELEASE="${thing}"/lib/libosgShadow.a \
-DOSGTEXT_LIBRARY_RELEASE="${thing}"/lib/libosgText.a \
-DOSGUTIL_LIBRARY_RELEASE="${thing}"/lib/libosgUtil.a \
-DOSGVIEWER_LIBRARY_RELEASE="${thing}"/lib/libosgViewer.a \
-DOSG_LIBRARY_RELEASE="${thing}"/lib/libosg.a \
-DOPENTHREADS_INCLUDE_DIR="${thing}"/include \
-DOSGANIMATION_INCLUDE_DIR="${thing}"/include \
-DOSGDB_INCLUDE_DIR="${thing}"/include \
-DOSGFX_INCLUDE_DIR="${thing}"/include \
-DOSGGA_INCLUDE_DIR="${thing}"/include \
-DOSGPARTICLE_INCLUDE_DIR="${thing}"/include \
-DOSGPlugins_LIB_DIR="${thing}"/lib/osgPlugins-3.6.5 \
-DOSGSHADOW_INCLUDE_DIR="${thing}"/include \
-DOSGTEXT_INCLUDE_DIR="${thing}"/include \
-DOSGUTIL_INCLUDE_DIR="${thing}"/include \
-DOSGVIEWER_INCLUDE_DIR="${thing}"/include \
-DOSG_INCLUDE_DIR="${thing}"/include \
\
-DBULLET_COLLISION_LIBRARY="${thing}"/lib/libBulletCollision.a \
-DBULLET_DYNAMICS_LIBRARY="${thing}"/lib/libBulletDynamics.a \
-DBULLET_INCLUDE_DIR="${thing}"/include/bullet \
-DBULLET_MATH_LIBRARY="${thing}"/lib/libLinearMath.a \
-DBULLET_SOFTBODY_LIBRARY="${thing}"/lib/libBulletSoftBody.a \
-DBoost_INCLUDE_DIR=/opt/boost-1.75.0/include \
-DBoost_LIBRARY_DIR=/opt/boost-1.75.0/lib \
-DMyGUI_INCLUDE_DIR="${thing}"/include/MYGUI \
-DMyGUI_LIBRARY="${thing}"/lib/libMyGUIEngineStatic.a \
-DOPENAL_INCLUDE_DIR="${thing}"/include/AL \
-DOPENAL_LIBRARY="${thing}"/lib/libopenal.a \
-DSDL2_LIBRARY="${thing}"/lib/libSDL2.a \
..
Edited by gottaeat