#367·shuttle

cargo-shuttle build error due to missing iconv symbols (MacOS, arm64, MacPorts)

Author: hmeineCreated Sep 30, 2022Updated Mar 12, 2025
LabelsS-Not Planned

I am not a rust or cargo expert yet, but I would assume that cargo install cargo-shuttle is supposed to work in most cases. However, I am getting build problems due to undefined symbols:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" "/var/folders/vd/z8g1y2yn2j78c3fx0_mqs... [3kb snipped] "-liconv" "-framework" "Security" "-framework" "CoreFoundation" "-lssl" "-lcrypto" "-lz" "-lcurl" "-framework" "CoreFoundation" "-framework" "SystemConfiguration" "-framework" "Security" "-framework" "CoreFoundation" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/hmeine/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/var/folders/vd/z8g1y2yn2j78c3fx0_mqsbdc0000gn/T/cargo-install1nPtmP/release/deps/cargo_shuttle-7b219432e8627bc2" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: Undefined symbols for architecture arm64:
            "_iconv", referenced from:
                _git_fs_path_iconv in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
               (maybe you meant: _git_fs_path_iconv_clear, _git_fs_path_iconv , _git_fs_path_iconv_init_precompose )
            "_iconv_close", referenced from:
                _git_fs_path_direach in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
                _git_fs_path_iconv_clear in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
                _git_fs_path_diriter_free in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
                _git_fs_path_dirload in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
            "_iconv_open", referenced from:
                _git_fs_path_direach in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
                _git_fs_path_iconv_init_precompose in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
                _git_fs_path_diriter_init in liblibgit2_sys-f1801d163fee174d.rlib(fs_path.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: failed to compile `cargo-shuttle v0.5.2`, intermediate artifacts can be found at `/var/folders/vd/z8g1y2yn2j78c3fx0_mqsbdc0000gn/T/cargo-install1nPtmP`

Some information on my system:

rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.60.0 (7737e0b5c 2022-04-04)`

The following ports are currently installed:
  libgit2 @1.5.0_0+threadsafe (active)
  libiconv @1.17_0+universal (active)

Port libiconv contains:
  /opt/local/bin/iconv
  /opt/local/include/iconv.h
  /opt/local/include/libcharset.h
  /opt/local/include/localcharset.h
  /opt/local/lib/libcharset.1.dylib
  /opt/local/lib/libcharset.a
  /opt/local/lib/libcharset.dylib
  /opt/local/lib/libiconv.2.dylib
  /opt/local/lib/libiconv.a
  /opt/local/lib/libiconv.dylib
...

I can see that -liconv appears thrice on the cmdline, and one of the first linker paths specified is "-L" "/opt/local/lib", which is also the location of libiconv. Any hints on how to debug this further or even better, how to get cargo-shuttle to build?