Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust example fails to compile on macOS because of libiconv #187

Closed
YorikSar opened this issue Feb 17, 2022 · 2 comments · Fixed by #215
Closed

Rust example fails to compile on macOS because of libiconv #187

YorikSar opened this issue Feb 17, 2022 · 2 comments · Fixed by #215
Assignees
Labels
P2 major: an upcoming release type: bug

Comments

@YorikSar
Copy link
Member

Describe the bug
When I try to build Rust example, I get a link error:

...
ERROR: /Users/tweag/workspaces/bazel_on_macos/rules_nixpkgs/examples/toolchains/rust/BUILD:3:12: Compiling Rust bin hello (1 files) failed: (Exit 1): process_wrapper failed: error executing command bazel-out/darwin-opt-exec-FFB32019/bin/external/rules_rust/util/process_wrapper/process_wrapper --subst 'pwd=${pwd}' -- external/nix_rust/bin/rustc hello.rs '--crate-name=hello' '--crate-type=bin' ... (remaining 16 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
error: linking with `external/local_config_cc/cc_wrapper.sh` failed: exit status: 1
  |
  = note: "external/local_config_cc/cc_wrapper.sh" "-m64" "-arch" "x86_64" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.0.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.1.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.2.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.3.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.4.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.5.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.6.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.7.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.8.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.hello.996e1e6f-cgu.9.rcgu.o" "bazel-out/darwin-fastbuild/bin/hello.2qbjdfrzgcayd1in.rcgu.o" "-L" "external/nix_rust/lib/rustlib/x86_64-apple-darwin/lib" "-L" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libstd-d43b1180a7c500d2.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-ae539223d447dfc6.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libobject-11a458d9b32a239c.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-34cc6ee434399709.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-e4ce48db41321be4.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libgimli-925f8e621e87c5d1.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-f98ef5df1f347ad0.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-8ede71df0f2d7c4f.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-0a273c8fcff748a9.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-12eb4f87886f4dd7.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libunwind-93f5cbe2b90daf72.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-8032011eb1f3eb82.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/liblibc-22466d52281abdf1.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/liballoc-69c5dbacefc7f8b1.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-de984f3632fc3c42.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libcore-ec0cd9f6516ee01f.rlib" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-eefc3cdb499abe56.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/nix/store/2dhyhzx18w0kqb1qq3h4wp1a0ng9dr3q-rustc-1.56.1/lib/rustlib/x86_64-apple-darwin/lib" "-o" "bazel-out/darwin-fastbuild/bin/hello" "-Wl,-dead_strip" "-nodefaultlibs" "-undefined" "dynamic_lookup" "-headerpad_max_install_names" "-lstdc++" "-lm"
  = note: ld: library not found for -liconv
          clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: aborting due to previous error
...

To Reproduce

cd examples/toolchains/rust
nix-shell --command "bazel run --config=nix :hello"

Expected behavior
"Hello, world!" line should be written to the output.

Environment

  • OS name + version: macOS Monterey 12.2.1 (also reproducible on CI with macos-11 builder
  • Version of the code: Got this issue while trying to make examples work on macOS on this commit
@YorikSar YorikSar self-assigned this Feb 17, 2022
YorikSar added a commit that referenced this issue Feb 17, 2022
All examples are already using 21.11 nixpkgs, so that shouldn't prevent
them from working on Big Sur.

Python example is broken because of #186 and Rust one because of #187,
so skip them for now.

Fixes #176
YorikSar added a commit that referenced this issue Feb 17, 2022
All examples are already using 21.11 nixpkgs, so that shouldn't prevent
them from working on Big Sur.

Python example is broken because of #186 and Rust one because of #187,
so skip them for now.

Fixes #176
YorikSar added a commit that referenced this issue Feb 21, 2022
All examples are already using 21.11 nixpkgs, so that shouldn't prevent
them from working on Big Sur.

Python example is broken because of #186 and Rust one because of #187,
so skip them for now.

Fixes #176
@YorikSar
Copy link
Member Author

It seems I can reproduce this without rules_nixpkgs: https://gist.github.com/YorikSar/d1cfc806b611c4506d2a1957c05653b7 - if I provide libiconv in the shell environment, rules_rust can't see it while plain rustc does.

ryanbujnowicz pushed a commit to ryanbujnowicz/rules_nixpkgs that referenced this issue Mar 5, 2022
All examples are already using 21.11 nixpkgs, so that shouldn't prevent
them from working on Big Sur.

Python example is broken because of tweag#186 and Rust one because of tweag#187,
so skip them for now.

Fixes tweag#176
@aherrmann aherrmann added the P2 major: an upcoming release label Mar 9, 2022
@fricklerhandwerk
Copy link
Member

Can reproduce.

YorikSar added a commit that referenced this issue Apr 8, 2022
@mergify mergify bot closed this as completed in #215 Apr 13, 2022
avdv pushed a commit that referenced this issue May 17, 2022
avdv pushed a commit that referenced this issue May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 major: an upcoming release type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants