Build/Make Error – ld: malformed file, unknown enumerated scalar, platform: zippered

  • My project fails to build.

    Error Message:

    ld: malformed file
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libz.tbd:4:18: error: unknown enumerated scalar
    platform:        zippered
     file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libz.tbd'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    In the Issues tab, I get two errors:

    • malformed file
    • unknown enumerated scalar

    0_1554020057452_Screenshot 2019-03-31 at 15.13.27.png

    For context, here's what libz.tbd (aliased to libz.1.tbd) looks like:

    --- !tapi-tbd-v3
    archs:           [ x86_64 ]
    uuids:           [ 'x86_64: FDF169F3-F992-3E8E-B3F7-D4134FEBAE41' ]
    platform:        zippered
    install-name:    /usr/lib/libz.1.dylib
    current-version: 1.2.11
    objc-constraint: none
      - archs:           [ x86_64 ]
        symbols:         [ _adler32, _adler32_combine, _adler32_z, _compress, _compress2, 
                           _compressBound, _crc32, _crc32_combine, _crc32_z, _deflate, 
                           _deflateBound, _deflateCopy, _deflateEnd, _deflateGetDictionary, 
                           _deflateInit2_, _deflateInit_, _deflateParams, _deflatePending, 
                           _deflatePrime, _deflateReset, _deflateResetKeep, _deflateSetDictionary, 
                           _deflateSetHeader, _deflateTune, _get_crc_table, _gzbuffer, 
                           _gzclearerr, _gzclose, _gzclose_r, _gzclose_w, _gzdirect, 
                           _gzdopen, _gzeof, _gzerror, _gzflush, _gzfread, _gzfwrite, 
                           _gzgetc, _gzgetc_, _gzgets, _gzoffset, _gzopen, _gzprintf, 
                           _gzputc, _gzputs, _gzread, _gzrewind, _gzseek, _gzsetparams, 
                           _gztell, _gzungetc, _gzvprintf, _gzwrite, _inflate, _inflateBack, 
                           _inflateBackEnd, _inflateBackInit_, _inflateCodesUsed, _inflateCopy, 
                           _inflateEnd, _inflateGetDictionary, _inflateGetHeader, _inflateInit2_, 
                           _inflateInit_, _inflateMark, _inflatePrime, _inflateReset, 
                           _inflateReset2, _inflateResetKeep, _inflateSetDictionary, 
                           _inflateSync, _inflateSyncPoint, _inflateUndermine, _inflateValidate, 
                           _uncompress, _uncompress2, _zError, _zlibCompileFlags, _zlibVersion ]

    Further Attempts:

    1. I tried editing the libz.tbd file and changed platform: zippered to platform: macosx. This generates a similar, but different error when I do a rebuild. Instead of libz.tbd, there is now an error with IOKit.tbd.
    ld: malformed file
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//IOKit.framework/IOKit.tbd:4:18: error: unknown enumerated scalar
    platform:        zippered
     file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//IOKit.framework/IOKit.tbd'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    This is what the IOKit.tbd file looks like (it's over 700 lines long, so I chose to only show the first 8):

    --- !tapi-tbd-v3
    archs:           [ x86_64 ]
    uuids:           [ 'x86_64: 1170EC49-1912-3657-9C71-991653959191' ]
    platform:        zippered
    install-name:    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
    current-version: 275
    objc-constraint: none

    Modifying IOKit.tbd and rebuilding led to the same error with OpenGL.tbd, then with libSystem.B.tbd, then with libc++.tbd. I reverted my edits and decided to go no further in case I damage my system or something.

    1. I tried creating new, raw projects from project templates wizard (Cmd+N), but building them also failed with the malformed file, unknown enumerated scalar errors pointing to a platform: zippered line on either the IOKit.tbd or OpenGL.tbd file (randomly):
    • Projects -> Applications -> Qt Widgets Application
    • Projects -> Applications -> Qt Quick Application
    • Projects -> Felgo Games -> New – Empty Felgo 3 Project

    Although I'm use Felgo API, I decided to post here since I was able to produce the issue with Qt Widgets and Qt Quick Applications.

    1. Cleaning, running QMake, and rebuilding didn't work.

    2. I tried upgrading my macOS version (from 10.14.3 to 10.14.4) and tried building the same applications to no avail. I'm getting the same errors.

    Research was tough. All I found particularly useful and relevant was this Lazarus IDE forum thread (fairly recent, started 3-5 days ago). Not sure what to do with it. It does say something about updating CommandLineTools though...

    Software Details:
    OS: MacOS Mojave 10.14.3 and 10.14.4
    IDE: QtCreator 4.7.0 – Based on Qt 5.11.1 (Clang 8.0 (Apple), 64 bit)
    C Compiler: GCC (C, x86 64bit in /usr/bin)
    C++ Compiler: GCC (C++, x86 64bit in /usr/bin)

    I'm not sure where or how to proceed. Any thoughts?

  • Lifetime Qt Champion


    Did you also update Xcode ?
    What version of Qt are you using ?

  • Hi @SGaist

    I left Xcode alone. (My xcode-select version is 2354. There's an update in the App Store.) Should I upgrade it?

    I'm using Qt 5.11.1.


  • I think I got it!

    The projects build if I change the compilers in the kit to Clang + doing a clean and rebuild. (That'd be the Clang (C/C++, x86 64bit in /usr/bin) options.)

    The compilers were originally set to GCC. (Both GCC (C/C++, x86 64bit in /usr/bin) and GCC (C/C++, x86 64bit in /usr/local/bin) failed to build with the malformed file errors.)

    Well, at least building works for now and development can continue. :-)

    I'm still curious though, why GCC would do this. (Let me know if dumps from gcc -v would help.)

  • Lifetime Qt Champion

    Yes the dump would be nice.

    Do you have any custom version of GCC installed on your system ?

  • @SGaist Here you go:

    gcc -v (aka /usr/local/bin/gcc -v, from which gcc):

    Using built-in specs.
    Target: x86_64-apple-darwin17.7.0
    Configured with: ../configure --build=x86_64-apple-darwin17.7.0 --prefix=/usr/local/Cellar/gcc/8.2.0 --libdir=/usr/local/Cellar/gcc/8.2.0/lib/gcc/8 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 8.2.0' --with-bugurl=
    Thread model: posix
    gcc version 8.2.0 (Homebrew GCC 8.2.0)

    I remember trying to upgrade my GCC version to ≥ 8 so that I could get my hands on std::optional and other cool C++17 features. Ended up using homebrew. Does this count as a custom version?

    For context, I'll include the dump from /usr/bin/gcc as well, since I tried both /usr/local/bin/gcc and /usr/bin/gcc compiler options and both failed with malformed file etc.

    /usr/bin/gcc -v:

    Configured with: --prefix=/Applications/ --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
    Apple LLVM version 9.1.0 (clang-902.0.39.2)
    Target: x86_64-apple-darwin18.5.0
    Thread model: posix
    InstalledDir: /Applications/

    Not sure if this is GCC at all. Looks like clang...

    Hopefully this might help.

  • Lifetime Qt Champion

    Apple has stopped using GCC a long time ago.

    You should configure your Kit to use Apple's official Clang compiler that comes with Xcode.

    I don't know how well GCC 8.2.0 has been tested against the 10.14 macOS SDK.

  • Ah ok, good to know. Somehow GCC always seemed to work. Thanks for the help.

  • @ResistorInTheDark if your issue is solved, please don't forget to mark your post as such. Thanks.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.