Date: Sun, 22 Jan 2017 12:57:18 -0800 From: Johannes Lundberg <johalun0@gmail.com> To: Dimitry Andric <dim@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: Linker problems with clang /usr/local/lib Message-ID: <CAECmPwvGa-Z0cUYgKvSz%2BV_5LoTccWDirAGMLD=_2jXhJKJkFw@mail.gmail.com> In-Reply-To: <D6AD09B8-A7B6-4498-84F8-9A31B4AAB8A0@FreeBSD.org> References: <CAECmPwvq07zQ2H6wUk85=QhcbVE2Hu-vSQF3anhuStomkx7yGA@mail.gmail.com> <D6AD09B8-A7B6-4498-84F8-9A31B4AAB8A0@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
I found a way to pass various linker flags to Rust through the .cargo/config file which is doable for now. However, in man pages it says that ld looks in /etc/ld.so.conf for paths.. This seem broken. While a solution, having to write wrappers sounds like a workaround that shouldn't be needed... On Sun, Jan 22, 2017 at 12:42 PM, Dimitry Andric <dim@freebsd.org> wrote: > 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 > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAECmPwvGa-Z0cUYgKvSz%2BV_5LoTccWDirAGMLD=_2jXhJKJkFw>