Hi,
tl;dr:
Running flutter run -r
I am getting the error:
SEVERE: error: linking with `cc` failed: exit status: 1
SEVERE: = note: ld: building for 'iOS-simulator', but linking in dylib (/nix/store/msf2qxhv4971d669lmmjfp7kynj34jsy-libiconv-107/lib/libiconv.2.dylib) built for 'macOS'
SEVERE: clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I add iconv
for macOS (apple silicon) and the iOS Simulator?
Here is more context:
since two weeks I am struggling to make my devshell with Rust and Flutter work again. It broke after I upgraded my system to Sequoia and Xcode 16.2.
Does anyone has a working setup or can help me debugging mine?
This is my flake.
I could not get to a minimal setup, hope it is ok to post the flake directly with my repo. You can comment out the “flutter-rust-bridge” import and build input, though the needed import if in the repository as well.
My problem is as follows:
Either rust is compilable out flutter - but not both:
I can’t compile rust without adding ‘iconv’. No matter how I integrate rust (from nixpkgs, Fenix or oxalica). This is a known “circumstance” for apple silicon Macs.
To use Flutter I have to use Xcode’s compiler (Clang 16.0.0 - newer versions might work, but I couldn’t get to it). Thus I use mkShellNoCC
.
This is why the env vars are not set up by any rust packages. So in order to get rust compiling, I set
export LIBRARY_PATH=$LIBRARY_PATH:${pkgs.libiconv}/lib;
in shellHook
. Setting LIBRARY_PATH = "${pkgs.libiconv}/lib";
works as well - but I don’t want to overwrite any existing values (which there are none at the moment).
However, this change leads to flutter not compiling with the error
Error (Xcode): linking with `cc` failed: exit status: 1
/Users/patmuk/code/own/sherry/examples/fix-nix/shell_flutter/ios/Pods/SEVERE:0:0
Error (Xcode): linker command failed with exit code 1 (use -v to see invocation)
I am using the Flutter-Rust-Bridge, which includes my rust project (app_core
) as a library.
Running flutter run -v
revealed
SEVERE: = note: ld: building for 'iOS-simulator', but linking in dylib (/nix/store/msf2qxhv4971d669lmmjfp7kynj34jsy-libiconv-107/lib/libiconv.2.dylib) built for 'macOS'
SEVERE: clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix this?