tpoechtrager / cctools-port

Apple cctools port for Linux and *BSD
730 stars 168 forks source link

Getting unknown ld command 8 in Mojave #60

Closed matthewbauer closed 5 years ago

matthewbauer commented 6 years ago

With cctools 895, I get this on one of the bundled binaries:

$ nix run nixpkgs.darwin.cctools -c nm /usr/lib/libxcselect.dylib
nm: object: /usr/lib/libxcselect.dylib malformed object (unknown load command 8)

I wonder if Apple changed something in the Mach-O format?

/cc @ericson2314

tpoechtrager commented 6 years ago

I can't do anything at the moment as Apple haven't released new sources in ages.

matthewbauer commented 6 years ago

Definitely! Just noticed it and wanted to report it. It actually looks like it's a fairly small change (some added constant?) but best to wait for apple to release the newest version.

matthewbauer commented 5 years ago

It looks like cctools-921 is available now:

https://opensource.apple.com/source/cctools/

and ld64-409.12:

https://opensource.apple.com/source/ld64/

MCApollo commented 5 years ago

I got the latest version of cctools/ld64 mention by @matthewbauer to compile with some hacky methods: (This is a reposted comment, sorry about that.)

https://github.com/MCApollo/cctools-port

x86_64-pc-linux-gnu - Ubuntu

./aarch64-apple-darwin17-ranlib -V Apple Inc. version cctools-921 error: ./aarch64-apple-darwin17-ranlib: no archives specified Usage: ./aarch64-apple-darwin17-ranlib [-sactfqLT] [-] archive [...]

./aarch64-apple-darwin17-otool --version otool(1): Apple Inc. version cctools-921 disassmbler: LLVM version 6.0.0

./aarch64-apple-darwin17-ld -v @(#)PROGRAM:ld PROJECT:ld64-274.2 BUILD 21:11:57 Jan 7 2019 configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS) LTO support using: LLVM version 6.0.0 (static support for 21, runtime is 21) TAPI support using: Apple TAPI version 1.30.0

(Still need to up the version in ld64/src/3rd/helper.c)

Also this is still a issue with the as wrapper:

clang -cc1as: error: unknown target triple 'unknown-apple-macosx10.4.0', please use -triple or -arch

Edit: CCTOOLS_CLANG_AS_TARGET_TRIPLE is there for the as issue. aarch64-apple-darwin gets set to unknown-apple I'm guessing, because arm64-apple-darwin works just fine.

lilili87222 commented 5 years ago

root@iZm5e85u394jqoxtesreodZ: ./aarch64-apple-darwin17-ld -v @(#)PROGRAM:ld PROJECT:ld64-409.12 BUILD 17:04:33 Jan 14 2019 configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS) LTO support using: LLVM version 6.0.0 (static support for 17, runtime is 21) TAPI support using: Apple TAPI version 2.0.0

aarch64-apple-darwin17-ld -arch arm64 -sdk_version 12.1 -syslibroot /root/files/compiler/ios/SDK -demangle -dead_strip -ios_version_min 9.0.0 -o /root/files/compiler/3284e75a-094b-468f-ad71-67324e5b4722/building/build/arm64/ExecuteFile -filelist /root/files/compiler/3284e75a-094b-468f-ad71-67324e5b4722/building/build/arm64/objlist.txt

Link fail with error: Segmentation fault

@MCApollo

lilili87222 commented 5 years ago

If sdk is low version such as ios sdk 11,it works. but fail with sdk 12.1