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

Crates dependent on libgit2-sys fail to link when libiconv is installed via MacPorts #672

Open
vtenfys opened this issue Feb 23, 2021 · 8 comments

Comments

@vtenfys
Copy link

vtenfys commented Feb 23, 2021

How to reproduce:

  1. Use a machine running macOS 11 with MacPorts installed
  2. Install libiconv using MacPorts: sudo port install libiconv
    Note: many common ports depend on libiconv so it is usually installed indirectly
  3. Build a crate which depends (directly or indirectly) on libgit2-sys e.g. cargo:
    git clone https://github.com/rust-lang/cargo.git
    cd cargo
    cargo build

Expected result:

The crate builds successfully

Actual result:

  • In my case cargo is cloned to /Users/david/Code/cargo
  • I believe this issue is not specific to the arm64 architecture
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-arch" "arm64" "-L" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/david/Code/cargo/target/debug/deps/cargo.13dqm6cx88ih8d7v.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.13fag48fin0k9e60.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.13k5sy4x5ct7uc76.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.13mvacfztkpqoulz.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.17o1oyr8zzw4fskw.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.17velqna0uus6jym.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1bqtvubbafsow4tm.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1bzcfj2o6vziubl8.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1cdjzrhuo6413him.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1d13nnm6m5msm11z.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1di4cbgimehpmvur.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1ewnbnxbu5269t71.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1fbsx00hgypemiqb.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1fpjo2ev3up3z6gx.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1gg1zbd89v1t343t.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1hi4rpkj556ckt0k.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1hk74un040a2hsy0.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1ihnus2jzs3rfv1l.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1j5a6o5uvbzlkp1.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1kbxkaaq5ilwuoyx.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1kg9hdnqq21l0urr.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1lpyrztjrjtk3ycn.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1nemwliycchkdlda.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1nz9dpxims4nycy1.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1o7da8olj20a0so5.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1obnebwavryx9c0x.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1oyvqq6952xmyzm0.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1ragwe75jk8j3pjj.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1sysxi7mk8x3vtf1.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1uu8ki05mmuhlzn9.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1v48v2pzmjcoe8cx.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1whvy6zbssdhcx31.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1xio4r50sbl2xg6g.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1y8i7tddclz230n0.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1ylxb1bv5h1gtqxd.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1zmudcy43srqyx7c.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.1zwvkzzugyuqtpjv.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.20w04wb3ctytwmqr.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.211m9001ij88m11d.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.21pxmmszxsjyk15l.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.22dqc0n30cgrwbj5.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.22loqaw7ofw714ki.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2381efbjop3fqyrz.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.23irw1fwh0nv3y20.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.23m46uvr0sodzm2s.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.24jrbumrns7sa91n.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.253zihf4kirdbdgb.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.26k4nt4071rddrx.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.26x25jd1vjfvjpgh.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.27w8ebjapmrr2d6s.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.295rue6tsjlrpcxs.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.29ns25yaadau3zs.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2ax8tl47s7wiut3b.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2bphaej1r91fga6d.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2c4xwrlu3y7ghtqu.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2di685r6i1vt06x2.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2g3xjtktswwkc0p3.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2jg1pb5mmw5i34u1.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2lq6oo0lz1fs1wzu.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2mtsyynqa8n5y1p5.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2o9fpint62fjruax.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2pmeiaf21k0ktxe5.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2rqdg19mew2myggo.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2rutq3pqp1ot0p14.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2sdln7x49b6s477r.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2ske7zf999vzx8as.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2ubj89dr4ikvgfoz.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2vl8dpolduynodi8.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2yambozehzla2gco.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2ywl5qfgnf235l2j.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.2zw6zuw86iqms8di.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.320nx8mhb6zg9i36.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.32dckb77scrnjbw0.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.330h2mhqj17cowfl.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.331i6cvncra615vq.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.336603t06bhesml3.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.33grf1n0e4hho7wz.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.35wiaubdbijrsf6m.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.35x3pyz4a1p4jdf6.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.36jb8awmgix4zbad.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.36tt0ut5j031wyy2.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.385h0ifdvl94nms1.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.38dnz1isw60tjy9a.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.39c7mpaauwer1wu3.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.39s6k2gtqserz8oy.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.39y2lb3o5tifi9qi.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3b894tf0sgg1qult.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3bjxbc3flhwdrpjo.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3bvrsd782v9luhiu.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3ccyhkvod9mcujf0.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3cjqcqczew2axko1.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3d7j41lvracrrux6.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3ehfnt537mx7v6rl.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3fog5tr939ulh7fp.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3hzfna0d6ahexocd.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3i6crh0a81s7dm5k.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3il040lzsqab1zt.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3iuwhfd3fy9v8w0g.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3khj6ejlqso8fyts.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3mb73z06adx8vyl9.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3mfmzlyaj1k6riha.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3o476lnowziaqnxr.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3o95dwd7defb2h8b.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3oqmfq2ol3ldz0z2.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3oqtjt3k87t1fk74.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3ozd4v0hj99p6zpx.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3pfvy7jvy3q94a8f.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3qpeq241tsask0jc.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3qqzvqi6pgz8xjgs.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3r83k55q6ch3bm2e.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3rnt4l9gsixx44d2.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3s0rs45d23r49266.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3u0uwp4urnpm5xdw.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3x6e328thza8wfcz.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3x6kpx8ajj8xpusq.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3xkleg3bak9eqjg.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3y17x74gv3y4nts6.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.3zlc39tcaya7imyn.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.41uc47v0micmodlk.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.421kpxpfl8qxi4qb.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.42ul3o21xupkw9s8.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.446r117o3d1ca6rp.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.44tfv3p7po3vy8gc.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.461zqqdn9anqhu78.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.462qhi6zg3zqykg5.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.46mtui0b29npi0ty.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.46rvdomu0cw04q6j.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.46x2uoseh1qtog4z.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.47eigf9j7jgmy5vb.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.47mxk42ag1ghnm6t.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.48730dwzridg9ng6.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.49fjbome75lbtwlw.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4a2z3amiys0zy7e3.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4ar4jfgxh09fddej.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4bcuhil4w9wutcdw.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4bg1aipmt8rvfgby.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4cg5t1iznnolmga9.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4d2xjyrz7yqqnpej.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4ddnhc10gt4w40ty.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4fq493q7ggub90ph.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4i5vsh13mx2dyf0d.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4izxsoa1e247sh8u.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4jad9bci3o3i5tpv.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4jkzsmu0qca16c5w.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4koajf9qnh22hcn2.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4mqcig9rm0iwfkkn.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4n8fbei6du63yvlv.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4ndhvlib49sqc1ev.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4o1prqtzdpahgb8f.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4o8mjzyd83lv82jh.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4t3aqqy4pcy9yfpu.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4tcc9426p5mkewin.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4thpi5mh4lo33kef.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4tmwv4vp33e1tc97.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4tr2ym0j4se7ahmk.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4vxk1amwlwjl0qzx.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4xy2i3hrao02zwo.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.4zozruz2a9pwyl1f.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.53jvmoa9ely7klx7.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.541drxc9a2t5ybkq.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.54yq9zz5y73wbq15.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.569x5hb3m6z8kgey.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.56vuaa0uxpiuoysc.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.56yfj6e0h4y25b8k.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.57x963ep5rstao5m.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.593vmnua2z9djt41.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.5a0rr3rmv5awnsac.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.5amryz7bu4bxygql.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.5bmf81929dho4pa7.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.5du92vsiirzgui0o.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.5fyek06cnoe16phe.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.5gmn65sc79x6g087.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.6zgkkciwlukq3bf.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.78qyax5t0500i1z.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.7dfu3dmufvgjavp.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.7fw60ns5t2xbgdj.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.7iwox8zwhlxo2nl.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.7jgryi55ctd5h0l.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.82z3c49rdr8l5c3.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.8nukepqo6n8ia9i.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.9fzthb2eohe07o8.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.9l2fes3rahgtewu.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.aa9rzjzh66i514g.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.dqdsiqe43afps6q.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.evjzvnssntc58d6.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.g7d6m8mdnaaz8s4.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.i4a068yn1iudw7t.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.ih8dm88a404n3jf.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.ikp431wwul8zlay.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.krmj722iqoqsl5g.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.lbj3o37hk0wen8w.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.lh3h9r0qe0tl7dl.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.m12p0snx90u8tv8.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.m17tbwhy5v97024.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.m6z7az2xt5h5dom.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.n7asbcgv0kv6gtf.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.qyuj4ev50uiutj1.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.s3092bd5ss58aou.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.sio6sv9xjo1k5z4.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.sjxxcy2f4q03yg9.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.sqr3xwogumap9ww.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.t2xf7dqk9tfmdmg.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.t72lzva1547enut.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.udebwomqu6legvf.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.wf5yfxfkh4ior53.rcgu.o" "/Users/david/Code/cargo/target/debug/deps/cargo.x1puqijaady3437.rcgu.o" "-o" "/Users/david/Code/cargo/target/debug/deps/cargo" "/Users/david/Code/cargo/target/debug/deps/cargo.4y519891yq70rrac.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/david/Code/cargo/target/debug/deps" "-L" "/Library/Developer/CommandLineTools/usr/lib/clang/12.0.5/lib/darwin" "-L" "/Users/david/Code/cargo/target/debug/build/curl-sys-8ec4e424c1e11430/out/build" "-L" "/Users/david/Code/cargo/target/debug/build/libnghttp2-sys-26968c9ba23419c6/out/i/lib" "-L" "/Users/david/Code/cargo/target/debug/build/libgit2-sys-02bb81486a2685bf/out/build" "-L" "/Users/david/Code/cargo/target/debug/build/libssh2-sys-304cc5b9ab40f963/out/build" "-L" "/opt/local/lib" "-L" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/david/Code/cargo/target/debug/deps/libgit2_curl-48e6f2a3cbcc6c7f.rlib" "/Users/david/Code/cargo/target/debug/deps/libenv_logger-65ecff0d5f036d74.rlib" "/Users/david/Code/cargo/target/debug/deps/libcargo-ff94048c2ca20527.rlib" "/Users/david/Code/cargo/target/debug/deps/libhex-a204801606a897e7.rlib" "/Users/david/Code/cargo/target/debug/deps/libhome-c205c8e97b1e6c7c.rlib" "/Users/david/Code/cargo/target/debug/deps/libopener-2d19f21f46d6c438.rlib" "/Users/david/Code/cargo/target/debug/deps/libunicode_xid-06371275c58dd246.rlib" "/Users/david/Code/cargo/target/debug/deps/libim_rc-d757a71ad275ca3b.rlib" "/Users/david/Code/cargo/target/debug/deps/librand_xoshiro-31206bacb078ec35.rlib" "/Users/david/Code/cargo/target/debug/deps/librand_core-a257850599c782c7.rlib" "/Users/david/Code/cargo/target/debug/deps/libsized_chunks-2de1108384a5ef99.rlib" "/Users/david/Code/cargo/target/debug/deps/libbitmaps-77aabc852acc2637.rlib" "/Users/david/Code/cargo/target/debug/deps/libtypenum-493397f0a5c733e4.rlib" "/Users/david/Code/cargo/target/debug/deps/libtoml-5e390efef07fbc0c.rlib" "/Users/david/Code/cargo/target/debug/deps/libstrip_ansi_escapes-d3606b8f54b79cbb.rlib" "/Users/david/Code/cargo/target/debug/deps/libvte-270b97dc43c0f2a3.rlib" "/Users/david/Code/cargo/target/debug/deps/libutf8parse-fb2a496b73b575e4.rlib" "/Users/david/Code/cargo/target/debug/deps/libhumantime-490506bbd5603560.rlib" "/Users/david/Code/cargo/target/debug/deps/libnum_cpus-bdf0ded394e909fc.rlib" "/Users/david/Code/cargo/target/debug/deps/libserde_ignored-1aeb1b80c18100e2.rlib" "/Users/david/Code/cargo/target/debug/deps/libcrypto_hash-058ce49559109ffd.rlib" "/Users/david/Code/cargo/target/debug/deps/libhex-d4e9a461e5d6c691.rlib" "/Users/david/Code/cargo/target/debug/deps/libcommoncrypto-6e50e0aaf15c1c32.rlib" "/Users/david/Code/cargo/target/debug/deps/libcommoncrypto_sys-d01da9692474b6af.rlib" "/Users/david/Code/cargo/target/debug/deps/libshell_escape-6ced22cda46c2dff.rlib" "/Users/david/Code/cargo/target/debug/deps/libcore_foundation-42a29d5a0ab5aa86.rlib" "/Users/david/Code/cargo/target/debug/deps/libcore_foundation_sys-3d3e7488acc1f2cf.rlib" "/Users/david/Code/cargo/target/debug/deps/libclap-38c300e60319441f.rlib" "/Users/david/Code/cargo/target/debug/deps/libvec_map-26f397d03e5bd92b.rlib" "/Users/david/Code/cargo/target/debug/deps/libtextwrap-e2f8f053d14bee83.rlib" "/Users/david/Code/cargo/target/debug/deps/libunicode_width-f2a4e2d98c3b8467.rlib" "/Users/david/Code/cargo/target/debug/deps/libstrsim-fc88185f7489f6ba.rlib" "/Users/david/Code/cargo/target/debug/deps/libatty-df6817caa83edac8.rlib" "/Users/david/Code/cargo/target/debug/deps/libansi_term-5902dde1c48edbd0.rlib" "/Users/david/Code/cargo/target/debug/deps/libignore-3375918c853617de.rlib" "/Users/david/Code/cargo/target/debug/deps/libwalkdir-a59818ea75329318.rlib" "/Users/david/Code/cargo/target/debug/deps/libsame_file-c930306024bd679c.rlib" "/Users/david/Code/cargo/target/debug/deps/libglobset-a06a5f612f56be6a.rlib" "/Users/david/Code/cargo/target/debug/deps/libregex-8998a9ba9f666e18.rlib" "/Users/david/Code/cargo/target/debug/deps/libthread_local-2dc266936926fd78.rlib" "/Users/david/Code/cargo/target/debug/deps/libonce_cell-b11736acede769ed.rlib" "/Users/david/Code/cargo/target/debug/deps/libregex_syntax-130efbd2c2179e78.rlib" "/Users/david/Code/cargo/target/debug/deps/libfnv-f4608877e2778108.rlib" "/Users/david/Code/cargo/target/debug/deps/libbstr-0188ce7c653b8a9a.rlib" "/Users/david/Code/cargo/target/debug/deps/libaho_corasick-7d8c7615ea72d7b5.rlib" "/Users/david/Code/cargo/target/debug/deps/libmemchr-a4cfd5bf01ee3bf6.rlib" "/Users/david/Code/cargo/target/debug/deps/libcrates_io-0f3c40ea91159368.rlib" "/Users/david/Code/cargo/target/debug/deps/librustfix-6b99cca02c21fe65.rlib" "/Users/david/Code/cargo/target/debug/deps/libserde_json-c8874a6a36aaa867.rlib" "/Users/david/Code/cargo/target/debug/deps/libryu-b45f5b7d32e296e9.rlib" "/Users/david/Code/cargo/target/debug/deps/libitoa-4a2a17ac09666cf6.rlib" "/Users/david/Code/cargo/target/debug/deps/libtar-837ab3f2ae69b8f5.rlib" "/Users/david/Code/cargo/target/debug/deps/libflate2-c2f7256a345ef33b.rlib" "/Users/david/Code/cargo/target/debug/deps/libcrc32fast-dcf1473ca7229ec6.rlib" "/Users/david/Code/cargo/target/debug/deps/libgit2-74a6ffbf798fc1d5.rlib" "/Users/david/Code/cargo/target/debug/deps/liblibgit2_sys-2871391079a10068.rlib" "/Users/david/Code/cargo/target/debug/deps/liblibssh2_sys-56139f46197c53be.rlib" "/Users/david/Code/cargo/target/debug/deps/libopenssl_sys-378a642789bf7123.rlib" "/Users/david/Code/cargo/target/debug/deps/libbitflags-c4d6018c8c3d5b8d.rlib" "/Users/david/Code/cargo/target/debug/deps/libtempfile-ca5aeedb101e2675.rlib" "/Users/david/Code/cargo/target/debug/deps/librand-591f7f18dbd0ce25.rlib" "/Users/david/Code/cargo/target/debug/deps/librand_chacha-dec9ab5bc1981099.rlib" "/Users/david/Code/cargo/target/debug/deps/libppv_lite86-20a4652d4c36bdef.rlib" "/Users/david/Code/cargo/target/debug/deps/librand_core-6bc24f6b19929924.rlib" "/Users/david/Code/cargo/target/debug/deps/libgetrandom-f2ce991d4b4b7d09.rlib" "/Users/david/Code/cargo/target/debug/deps/libremove_dir_all-6d7be254349bbd5c.rlib" "/Users/david/Code/cargo/target/debug/deps/libglob-fc4fb76425fc757b.rlib" "/Users/david/Code/cargo/target/debug/deps/libtermcolor-0e53c09450884cb4.rlib" "/Users/david/Code/cargo/target/debug/deps/libcurl-639c1b969ba7d243.rlib" "/Users/david/Code/cargo/target/debug/deps/libsocket2-5c52e031b44a937f.rlib" "/Users/david/Code/cargo/target/debug/deps/libcurl_sys-e00511d200e6cecd.rlib" "/Users/david/Code/cargo/target/debug/deps/liblibz_sys-5c0e52dca696cafd.rlib" "/Users/david/Code/cargo/target/debug/deps/liblibnghttp2_sys-df0f499351e9bc89.rlib" "/Users/david/Code/cargo/target/debug/deps/libbytesize-e00ecfb0efe605ff.rlib" "/Users/david/Code/cargo/target/debug/deps/liburl-83b3b1cf630da360.rlib" "/Users/david/Code/cargo/target/debug/deps/libidna-ad80eee6e4f4917e.rlib" "/Users/david/Code/cargo/target/debug/deps/libunicode_normalization-d1f4ce876b0511d0.rlib" "/Users/david/Code/cargo/target/debug/deps/libtinyvec-87e6a49f9732d909.rlib" "/Users/david/Code/cargo/target/debug/deps/libtinyvec_macros-774320fa79233291.rlib" "/Users/david/Code/cargo/target/debug/deps/libunicode_bidi-01991b49c56c8451.rlib" "/Users/david/Code/cargo/target/debug/deps/libform_urlencoded-d08b840b91840ea4.rlib" "/Users/david/Code/cargo/target/debug/deps/libpercent_encoding-0c3f5ebb0c482512.rlib" "/Users/david/Code/cargo/target/debug/deps/libmatches-7c856e8a0da3524a.rlib" "/Users/david/Code/cargo/target/debug/deps/libcrossbeam_utils-431847b6a0e8e762.rlib" "/Users/david/Code/cargo/target/debug/deps/liblazy_static-3d78c4120713bc41.rlib" "/Users/david/Code/cargo/target/debug/deps/liblazycell-fee97b21968aebc6.rlib" "/Users/david/Code/cargo/target/debug/deps/libjobserver-aa766c90fbc71d52.rlib" "/Users/david/Code/cargo/target/debug/deps/libfiletime-1b935a2d785fef1c.rlib" "/Users/david/Code/cargo/target/debug/deps/liblibc-42e18dd4698ca1c9.rlib" "/Users/david/Code/cargo/target/debug/deps/libsemver-af5e730106bfcb90.rlib" "/Users/david/Code/cargo/target/debug/deps/libsemver_parser-b8ab0f17cf2af06c.rlib" "/Users/david/Code/cargo/target/debug/deps/libcargo_platform-c572c43e3b64c3cc.rlib" "/Users/david/Code/cargo/target/debug/deps/libserde-0cdfdd6b891a1a40.rlib" "/Users/david/Code/cargo/target/debug/deps/liblog-a07b5a70b9ae3207.rlib" "/Users/david/Code/cargo/target/debug/deps/libcfg_if-c64ee5e9237a32fe.rlib" "/Users/david/Code/cargo/target/debug/deps/libanyhow-2bbac1184b20c58e.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-f6f9eec1635e636a.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-07bfff44bf62cf3f.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-e3809bc8b111425e.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-33d64533e0aadcef.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-31e2a1400703b71d.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-71c15ba138da3496.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-2204c7cc9a01ef25.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-d6e5ece9c771a842.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-565bb23bb41bc8f6.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-8895b042fd9d6a9d.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-cacf286c763defc4.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-348755f31f5f7b8f.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-00b1c5d56c8c46f3.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-59ed52fd3946b1c5.rlib" "/Users/david/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-d11cefe128d6b458.rlib" "-framework" "CoreFoundation" "-liconv" "-framework" "Security" "-framework" "CoreFoundation" "-lssl" "-lcrypto" "-lclang_rt.osx" "-framework" "Security" "-framework" "CoreFoundation" "-lz" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: Undefined symbols for architecture arm64:
            "_iconv", referenced from:
                _git_path_iconv in liblibgit2_sys-2871391079a10068.rlib(path.o)
               (maybe you meant: _git_path_iconv_init_precompose, _git_path_iconv_clear , _git_path_iconv )
            "_iconv_close", referenced from:
                _git_path_iconv_clear in liblibgit2_sys-2871391079a10068.rlib(path.o)
            "_iconv_open", referenced from:
                _git_path_iconv_init_precompose in liblibgit2_sys-2871391079a10068.rlib(path.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Additional notes:

This is a reopening of #180 which has started occurring again on macOS 11, due to the following change:

According to the macOS Big Sur 11 Beta Release Notes, "the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem."

This presumably causes the libiconv from MacPorts to take priority over the built-in one, as the built-in one is no longer provided in /usr/lib (which is prioritised over /opt/local/lib).

@jbg
Copy link

jbg commented Apr 25, 2021

This happens because of the name mangling that iconv does when installed in "third party" mode, such as via MacPorts. Symbols like _iconv_open become _libiconv_open:

$ nm -gU /opt/local/lib/libiconv.dylib 
00000000000fc0a8 D __libiconv_version
0000000000005950 T _iconv_canonicalize
0000000000005168 T _libiconv
000000000000518c T _libiconv_close
0000000000004150 T _libiconv_open
00000000000051a4 T _libiconv_open_into
000000000001a344 T _libiconv_set_relocation_prefix
00000000000055a0 T _libiconvctl
00000000000056d4 T _libiconvlist

Your presumption of why the issue happens seems to be correct — because there's no libiconv.dylib in /usr/lib, the MacPorts one is used, but it doesn't have the right names.

However, the root cause seems to be that the headers from the system iconv are still being used. In /opt/local/include/iconv.h you'll see things like...

#ifndef LIBICONV_PLUG
#define iconv_open libiconv_open
#endif

... which would cause the correct symbols to be used. So if we can get libgit2-sys to use the iconv.h installed by MacPorts as well, all should be fine.

@jbg
Copy link

jbg commented Apr 25, 2021

And, indeed, sudo mkdir /opt/local/include/iconv && sudo cp /opt/local/include/iconv.h /opt/local/include/iconv/ and then building something that depends on libgit2 with CFLAGS=-I/opt/local/include/iconv works fine.

@vtenfys
Copy link
Author

vtenfys commented Apr 25, 2021

So if we can get libgit2-sys to use the iconv.h installed by MacPorts as well, all should be fine.

Or perhaps /opt/local shouldn't be included in the header search paths? That way the compiler would find the dylib, rather than a different one taking priority - I recall from a MacPorts trac issue (possibly this one but I think there was another that I can't find) that MacPorts developers consider it incorrect for other software to use its search paths.

@jbg
Copy link

jbg commented Apr 26, 2021

Or perhaps /opt/local shouldn't be included in the header search paths?

Assume you mean library search paths, since the problem seems to be that the library from /opt/local is being picked up whereas the headers from /opt/local are not.

and indeed, the compiler is being invoked with -L /opt/local/lib. I think it has to be, though, because it finds libgit2 and libssh2 there.

@kpreid
Copy link

kpreid commented May 9, 2021

I'm experiencing the build failure described in this bug, but I'm using macOS Catalina 10.15.7 (not 11) on an x86_64 machine. Would this be the same bug or different?

@jbg
Copy link

jbg commented May 10, 2021

@kpreid the symptoms described here would come about any time there is a mismatch between which iconv library is being used and which headers are being used. It's easier for that to happen on 11 because there's no libiconv.dylib in /usr/lib, but it could happen on any platform if some other factor leads to different libraries being used from headers.

You need to ensure that if system (Apple-provided) iconv headers are used, then system iconv is linked, and if MacPorts iconv headers are used, MacPorts iconv is linked.

@luqasz
Copy link

luqasz commented Oct 24, 2023

Hi. Same here. I have macos ventura.

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/Users/lkostka/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/Users/lkostka/Library/Python/3.11/bin:/opt/local/bin:/Users/lkostka/.cargo/bin:/Users/lkostka/.local/bin:/usr/local/bin:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/MacGPG2/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "arm64" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/rustcwct8IN/symbols.o" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/cargo-install2VA7FA/release/deps/cargo_generate-43ea65447aaa583a.cargo_generate.e0d7671d71a691c6-cgu.1.rcgu.o" "-L" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/cargo-install2VA7FA/release/deps" "-L" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/cargo-install2VA7FA/release/build/libgit2-sys-ff5da361e4a43d27/out/build" "-L" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/cargo-install2VA7FA/release/build/libssh2-sys-837b7a8e53f1c04b/out/build" "-L" "/opt/local/lib" "-L" "/opt/local/lib" "-L" "/Users/lkostka/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/rustcwct8IN/liblibgit2_sys-224ffa3f27bcfc19.rlib" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/rustcwct8IN/liblibssh2_sys-38639995701abcf6.rlib" "/Users/lkostka/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-7bc3106ba9bea571.rlib" "-liconv" "-framework" "Security" "-framework" "CoreFoundation" "-lssl" "-lcrypto" "-lz" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/Users/lkostka/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/cargo-install2VA7FA/release/deps/cargo_generate-43ea65447aaa583a" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: warning: ignoring duplicate libraries: '-liconv'
          ld: warning: no platform load command found in '/private/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/rustcwct8IN/symbols.o', assuming: macOS
          ld: Undefined symbols:
            _iconv, referenced from:
                _git_fs_path_iconv in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_iconv in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_iconv in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_iconv in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_iconv in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
            _iconv_close, referenced from:
                _git_fs_path_direach in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_iconv_clear in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_diriter_free in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_dirload in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
            _iconv_open, referenced from:
                _git_fs_path_direach in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_iconv_init_precompose in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
                _git_fs_path_diriter_init in liblibgit2_sys-224ffa3f27bcfc19.rlib[112](fs_path.o)
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `cargo-generate` (bin "cargo-generate") due to previous error
error: failed to compile `cargo-generate v0.18.4`, intermediate artifacts can be found at `/var/folders/s8/jp4cwfy177d6xwvnrhrhhs800000gn/T/cargo-install2VA7FA`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

@eejd
Copy link

eejd commented Feb 16, 2024

Not sure if this is thought to be a rust/libgit2-sys or macports problem, but I just encountered it compiling a rust project exactly as described above. I have macports, libiconv from there, and the same duplicate library, incorrect header, (not finding the macports lib, undefined symbols). This is on Sonoma 14.2.1 (23C71), with just updated macports and rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants