Skip to content

Commit 0c10495

Browse files
committed
extract object files then link and create static lib on windows to avoid undefined reference at link time
1 parent 93e8799 commit 0c10495

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,16 @@ if [ "$RUNNER_OS" != "Linux" ]; then
611611
libtool -static -o ${INSTALL_PREFIX}/lib/libCombinedFreetype.a ${INSTALL_PREFIX}/lib/libQt6BundledFreetype.a ${INSTALL_PREFIX}/lib/libQt6BundledLibpng.a ${INSTALL_PREFIX}/lib/libz.a
612612
elif [ "$RUNNER_OS" == "Windows" ]; then
613613
# combine using ld and ar on msys
614-
ld -r -o libCombinedFreetype.o ${INSTALL_PREFIX}/lib/libQt6BundledFreetype.a ${INSTALL_PREFIX}/lib/libQt6BundledLibpng.a ${INSTALL_PREFIX}/lib/libz.a
614+
# we first extract the objects, then link them all together, then create a static archive of this object
615+
# if we just do `ld -r -o libCombinedFreetype.o libQt6BundledFreetype.a libQt6BundledLibpng.a libz.a` we still get undefined reference to `FTC_Manager_New' etc
616+
mkdir combined_objects
617+
cd combined_objects
618+
ar x ${INSTALL_PREFIX}/lib/libQt6BundledFreetype.a
619+
ar x ${INSTALL_PREFIX}/lib/libQt6BundledLibpng.a
620+
ar x ${INSTALL_PREFIX}/lib/libz.a
621+
ld -r -o libCombinedFreetype.o *.o
615622
ar rcs ${INSTALL_PREFIX}/lib/libCombinedFreetype.a libCombinedFreetype.o
623+
cd ..
616624
fi
617625
VTK_OPTIONS="-DFREETYPE_LIBRARY_RELEASE=${INSTALL_PREFIX}/lib/libCombinedFreetype.a -DFREETYPE_INCLUDE_DIR_freetype2=${INSTALL_PREFIX}/include/QtFreetype -DFREETYPE_INCLUDE_DIR_ft2build=${INSTALL_PREFIX}/include/QtFreetype"
618626
fi

0 commit comments

Comments
 (0)