Opened 3 years ago

Closed 19 months ago

#63333 closed defect (fixed)

cargo @0.54.0_1 fails to build some crates on 10.9

Reported by: fhgwright (Fred Wright) Owned by: herbygillot (Herby Gillot)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: Cc: g5pw (Aljaž Srebrnič), cjones051073 (Chris Jones)
Port: cargo, rust-compiler-wrap

Description

This bug is probably actually in rust-compiler-wrap @1.54.0, though it's observed with the cargo command.

When attempting to build library-loader-cli in accordance with the instructions at https://github.com/olback/library-loader, three crates fail to build: bzip2-sys, serde_derive, and failure_derive. The failures are all link failures attempting to reference _linkat, which is a call that the OS doesn't support until 10.10.

The port attempts to use legacy-support to handle such cases, and the fact that the failure occurs at link time rather than compile time indicates that the headers are wrapped properly, but that the proper library specification doesn't happen.

Change History (13)

comment:1 Changed 3 years ago by herbygillot (Herby Gillot)

Owner: changed from herbygillot to cjones051073

@cjones051073 would be the one who could help with compiler-wrap issues.

comment:2 Changed 3 years ago by cjones051073 (Chris Jones)

This is not really an issue with the compiler wrapper. It is known that not all cargo based builds are fixed by the legacy support PG.

comment:3 Changed 3 years ago by cjones051073 (Chris Jones)

Please post a complete build log showing the failure.

comment:4 Changed 3 years ago by cjones051073 (Chris Jones)

Owner: changed from cjones051073 to herbygillot

comment:5 Changed 3 years ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:6 Changed 3 years ago by fhgwright (Fred Wright)

There isn't a "build log" in the MacPorts sense, but here's the output. Note that this is in a git repo derived from the project noted above.

MacPro:~ fw$ cd /Volumes/MacPro-Misc/GitHub/library-loader/ll-cli/
MacPro:ll-cli fw$ cargo build --release --bin library-loader-cli
   Compiling bzip2-sys v0.1.9+1.0.8
   Compiling serde_derive v1.0.114
   Compiling failure_derive v0.1.8
error: linking with `/opt/local/libexec/rust-compiler-wrap/bin/ld-rust` failed: exit status: 1
  |
  = note: "/opt/local/libexec/rust-compiler-wrap/bin/ld-rust" "-m64" "-arch" "x86_64" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.0.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.1.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.10.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.11.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.12.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.13.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.14.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.15.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.2.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.3.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.4.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.5.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.6.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.7.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.8.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.build_script_build.22t64wl1-cgu.9.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380.3nyps5y8nyv2dd92.rcgu.o" "-L" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps" "-L" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libpkg_config-f472b2c14eb36a1a.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libcc-426671f5d7707c4e.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-b4aa51e1b3a806c5.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-b5e0ee5b34899691.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libobject-b389e7e5aaedc266.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-c6c30fe85d21a041.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libgimli-df71b1a0f7222dab.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-8e384ecaefcd351e.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-73ebcb64354151a4.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-877dea5675c34ac2.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-65c1b0a6ae77b061.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libunwind-4b8c2da58aa4bbee.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-8e613fbb2d10ca79.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-1374d24935c09ecf.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc-844578fece21232b.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-8fa8b753ada45943.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcore-58d35d64ccb4eecf.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-a130f34109f01370.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/build/bzip2-sys-4025a183244f9380/build_script_build-4025a183244f9380" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: Undefined symbols for architecture x86_64:
            "_linkat", referenced from:
                std::sys::unix::fs::link::h95dca71bfe26f889 in libstd-b4aa51e1b3a806c5.rlib(std-b4aa51e1b3a806c5.std.e6zzngrm-cgu.9.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: aborting due to previous error

error: could not compile `bzip2-sys`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: linking with `/opt/local/libexec/rust-compiler-wrap/bin/ld-rust` failed: exit status: 1
  |
  = note: "/opt/local/libexec/rust-compiler-wrap/bin/ld-rust" "-m64" "-arch" "x86_64" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.0.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.1.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.10.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.11.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.12.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.13.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.14.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.15.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.2.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.3.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.4.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.5.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.6.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.7.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.8.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.failure_derive.4k1r9wpx-cgu.9.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.1jdvlz2zivmzt2bg.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/failure_derive-2d65b3ddb607f2d7.2u1glcancic3ar2g.rcgu.o" "-L" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps" "-L" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libsynstructure-09cc56e2c8bd9e58.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libsyn-eebee8414f5b9106.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libquote-3c2d5323625e099f.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libproc_macro2-4f4068827287fc39.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libunicode_xid-8ea77799edfa54fd.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libproc_macro-79dc1d8219f18da8.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-b4aa51e1b3a806c5.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-b5e0ee5b34899691.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libobject-b389e7e5aaedc266.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-c6c30fe85d21a041.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libgimli-df71b1a0f7222dab.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-8e384ecaefcd351e.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-73ebcb64354151a4.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-877dea5675c34ac2.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-65c1b0a6ae77b061.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libunwind-4b8c2da58aa4bbee.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-8e613fbb2d10ca79.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-1374d24935c09ecf.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc-844578fece21232b.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-8fa8b753ada45943.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcore-58d35d64ccb4eecf.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-a130f34109f01370.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libfailure_derive-2d65b3ddb607f2d7.dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs"
  = note: Undefined symbols for architecture x86_64:
            "_linkat", referenced from:
                std::sys::unix::fs::link::h95dca71bfe26f889 in libstd-b4aa51e1b3a806c5.rlib(std-b4aa51e1b3a806c5.std.e6zzngrm-cgu.9.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: aborting due to previous error

error: linking with `/opt/local/libexec/rust-compiler-wrap/bin/ld-rust` failed: exit status: 1
  |
  = note: "/opt/local/libexec/rust-compiler-wrap/bin/ld-rust" "-m64" "-arch" "x86_64" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.0.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.1.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.10.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.11.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.12.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.13.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.14.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.15.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.2.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.3.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.4.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.5.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.6.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.7.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.8.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.serde_derive.97u09uqu-cgu.9.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.5gehjm3gfe0gpjm2.rcgu.o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/serde_derive-40265251519554d0.2ovazu7y522672fw.rcgu.o" "-L" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps" "-L" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libsyn-eebee8414f5b9106.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libquote-3c2d5323625e099f.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libproc_macro2-4f4068827287fc39.rlib" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libunicode_xid-8ea77799edfa54fd.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libproc_macro-79dc1d8219f18da8.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-b4aa51e1b3a806c5.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-b5e0ee5b34899691.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libobject-b389e7e5aaedc266.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-c6c30fe85d21a041.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libgimli-df71b1a0f7222dab.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-8e384ecaefcd351e.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-73ebcb64354151a4.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-877dea5675c34ac2.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-65c1b0a6ae77b061.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libunwind-4b8c2da58aa4bbee.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-8e613fbb2d10ca79.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-1374d24935c09ecf.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc-844578fece21232b.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-8fa8b753ada45943.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcore-58d35d64ccb4eecf.rlib" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-a130f34109f01370.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/opt/local/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Volumes/MacPro-Misc/GitHub/library-loader/target/release/deps/libserde_derive-40265251519554d0.dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs"
  = note: Undefined symbols for architecture x86_64:
            "_linkat", referenced from:
                std::sys::unix::fs::link::h95dca71bfe26f889 in libstd-b4aa51e1b3a806c5.rlib(std-b4aa51e1b3a806c5.std.e6zzngrm-cgu.9.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: aborting due to previous error

error: build failed
MacPro:ll-cli fw$ 

It seems to me that the missing piece is having the compiler wrapper provide the legacy-support library for linking. There seem to be three different ways to do that; I'm not sure which is best in this context. One can see the "-lSystem" in the linker command line, which is presumably where it's linking against the standard OS runtime. Merely tweaking this for the legacy-support version doesn't work, since it doesn't have the appropriate directory in its library search paths. One question is whether to add another path here, or to put a symlink in rust's library directory pointing to the legacy-support library.

comment:7 Changed 3 years ago by fhgwright (Fred Wright)

This may not be the right fix, but I tried the following as an experiment and a possible workaround:

sudo ln -s /opt/local/lib/libMacportsLegacySystem.B.dylib /opt/local/lib/rustlib/x86_64-apple-darwin/lib/libSystem.dylib

This is sufficient to make the builds work, and the final program at least passes a basic sanity check.

comment:8 Changed 3 years ago by cjones051073 (Chris Jones)

Oh, this isn't a port build.... The legacy-support is likely not going to work properly as it relies on certain env. vars. etc. set by port builds.

Please try making a port out off the repo you are building, and see how that goes. It probably will also fail but it will be easier for others to help.

comment:9 Changed 3 years ago by cjones051073 (Chris Jones)

b.t.w. your /opt/local/lib/rustlib/x86_64-apple-darwin/lib/libSystem.dylib fix is interesting... This might be a way to resolve some issues like this in general..

Can you please run otool -L on the binaries created and post what you get ?

comment:10 Changed 3 years ago by fhgwright (Fred Wright)

Requiring everything built with rust to be built as a port would be extremely onerous, but fortunately not necessary. The fact that the compiles succeed indicates that the compiler wrapper is successfully causing the legacy-support headers to be injected, and the only problem is that there isn't similar injection of the legacy-support library into the linking.

The otool -L for the final executable from this is:

MacPro:ll-cli fw$ otool -L ../target/release/library-loader-cli
../target/release/library-loader-cli:
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 59.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55471.14.40)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
	/opt/local/lib/libMacportsLegacySystem.B.dylib (compatibility version 1.0.0, current version 1.0.3)
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

However, I don't think the symlink kludge is the right fix. Presumably the raison d'être for libMacportsLegacySystem.B.dylib is to provide a minimal way (and the quickest way for a test) to insert the library support, but the minimal way isn't necessarily the best way. It would be better just to add the appropriate linker arguments for the extra library. Perhaps this would mean a "linker wrapper" in addition to the compiler wrapper.

With an added library, there would be the issue of whether to use the static or dynamic version. I think static makes more sense in this context, particularly since it would mean not adding anything to programs that don't actually use any legacy-support functions.

Although I referenced cargo in the summary, this is probably really an issue with rust itself. One would like builds to work correctly regardless of whether rustc is invoked directly or via cargo. I'm too new to rust to know off the top of my head how to see whether this is already the case for the includes.

comment:11 Changed 3 years ago by kencu (Ken)

we've been down this road before.

You may be interested in the discussions in #62656, and perhaps in particular around here:

https://trac.macports.org/ticket/62656#comment:14

comment:12 Changed 3 years ago by kencu (Ken)

also, miraculously perhaps, upstream has fixed support for <= 10.9!

https://github.com/rust-lang/rust/commit/dc38d87505f4b1e381f143b4f34704df6a24e57e

So once we have a version that includes that commit, all our rust workarounds can go away. It appears 10.6 and less will be forever unsupported, but that is life.

comment:13 in reply to:  12 Changed 19 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: assignedclosed

Replying to kencu:

also, miraculously perhaps, upstream has fixed support for <= 10.9!

https://github.com/rust-lang/rust/commit/dc38d87505f4b1e381f143b4f34704df6a24e57e

So once we have a version that includes that commit, all our rust workarounds can go away. It appears 10.6 and less will be forever unsupported, but that is life.

This has been in play since version 0.55. Closing as fixed.

Note: See TracTickets for help on using tickets.