Date: Sun, 22 Jan 2017 21:42:18 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Johannes Lundberg <johalun0@gmail.com> Cc: freebsd-current@freebsd.org Subject: Re: Linker problems with clang /usr/local/lib Message-ID: <D6AD09B8-A7B6-4498-84F8-9A31B4AAB8A0@FreeBSD.org> In-Reply-To: <CAECmPwvq07zQ2H6wUk85=QhcbVE2Hu-vSQF3anhuStomkx7yGA@mail.gmail.com> References: <CAECmPwvq07zQ2H6wUk85=QhcbVE2Hu-vSQF3anhuStomkx7yGA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_76D1305B-7A70-4FFD-B395-02560DBA514C Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 22 Jan 2017, at 21:29, Johannes Lundberg <johalun0@gmail.com> wrote: > > How can I make 'cc' (/usr/bin/ld) look for libraries in /usr/local/lib > without having to specify environment or command line variables? > > I got "/usr/local/lib" in /etc/ld.so.conf and /var/run/ld-elf.so.hints. > > /sbin/ldconfig -l xxx can find library xxx in /usr/local/lib > > /usr/bin/ld can not. > > This is a problem when building Rust crates with Cargo which does not care > about env variables like LDFLAGS. I can however override the linker and use > 'gcc' which solves the problem but I assume it should be possible to get > clang (cc) to look in /usr/local/lib as well. > > Anyone got any ideas? Create a wrapper script that adds -L/usr/local/lib to the link command line, and invokes the 'real' cc or ld. Then either let Rust call the wrappers, or put them in a directory that is in front of your PATH. -Dimitry --Apple-Mail=_76D1305B-7A70-4FFD-B395-02560DBA514C Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAliFGTYACgkQsF6jCi4glqMuggCeN+A2eMtPt8PWtZH3h54V9V5T GrAAn2mi75nW///wPBaqB1m2kHcV51Zc =NoL9 -----END PGP SIGNATURE----- --Apple-Mail=_76D1305B-7A70-4FFD-B395-02560DBA514C--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D6AD09B8-A7B6-4498-84F8-9A31B4AAB8A0>