Missing dependencies cross-building



  • Hello,

    I'm trying to figure our why the dependency of freetype on bzip2 seems to be missed in my build process.

    I'm cross-building a Qt statically under Linux with target macx-clang. qtbase builds without a problem, but building a simple test program fails due to a number of missing libraries on the link command. I'm guessing that if I can solve one of them then I will be able to solve the others. So I get the following linker error:

    Undefined symbols for architecture x86_64:
      "_BZ2_bzDecompressInit", referenced from:
          _FT_Stream_OpenBzip2 in libfreetype.a(ftbzip2.o)
          _ft_bzip2_stream_io in libfreetype.a(ftbzip2.o)
    

    The command line in question (from the log file) looks like this:

    x86_64-apple-darwin18-clang++ -stdlib=libc++ -headerpad_max_install_names  -arch x86_64 -Wl,-syslibroot,/home/kdedev/osxcross/target/bin/../SDK/MacOSX10.14.sdk -mmacosx-version-min=10.12 -Wl,-dead_strip -Wl,-rpath,@executable_path/../Frameworks -o test-qt5.app/Contents/MacOS/test-qt5 qt-test.o test-qt5_plugin_import.o qrc_qt-test.o moc_qt-test.o   /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/styles/libqmacstyle.a -L/home/kdedev/mxe/usr/x86_64-apple-darwin18/lib /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/platforms/libqcocoa.a -framework Carbon -framework QuartzCore -framework CoreVideo -framework Metal -framework IOSurface -lcups /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5AccessibilitySupport.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5ThemeSupport.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5DBus.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libdbus-1.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5FontDatabaseSupport.a -framework CoreText -lfontconfig -lfreetype /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5GraphicsSupport.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5ClipboardSupport.a -framework ImageIO /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/imageformats/libqgif.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/imageformats/libqico.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/imageformats/libqjpeg.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libjpeg.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/bearer/libqgenericbearer.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/sqldrivers/libqsqlite.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libsqlite3.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/sqldrivers/libqsqlmysql.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libmysqlclient.a /home/kdedev/osxcross/target/SDK/MacOSX10.14.sdk/usr/lib/libpthread.tbd /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/sqldrivers/libqsqlpsql.a /home/kdedev/osxcross/target/SDK/MacOSX10.14.sdk/usr/lib/libpq.tbd /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/sqldrivers/libqsqltds.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libiconv.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/plugins/printsupport/libcocoaprintersupport.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5PrintSupport.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5Widgets.a -lz /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5Gui.a -framework CoreGraphics /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libpng16.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libharfbuzz.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5Network.a -framework SystemConfiguration /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libssl.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libcrypto.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5Sql.a /home/kdedev/mxe/tmp-qtbase-x86_64-apple-darwin18/qtbase-everywhere-src-5.12.4/lib/libQt5Core.a -framework DiskArbitration -framework IOKit -lm -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libz.a /home/kdedev/mxe/usr/x86_64-apple-darwin18/lib/libpcre2-16.a
    

    If I add -lbz2 at the end of the command then that link error goes away. But why isn't the build process including it? It's certainly picking up most of the libraries that are needed.

    I've tried looking at the .pc files. I've tried moving the native pkg-config out of the way in case it was being called incorrectly instead of the toolchain version. But no luck.

    Can anyone suggest a solution or where I might look next to find the source of the problem?

    Many thanks!


Log in to reply