Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jan 2017 22:11:32 +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:  <C280F115-A85F-4CB8-AC69-8B6ED10225F3@FreeBSD.org>
In-Reply-To: <CAECmPwvGa-Z0cUYgKvSz%2BV_5LoTccWDirAGMLD=_2jXhJKJkFw@mail.gmail.com>
References:  <CAECmPwvq07zQ2H6wUk85=QhcbVE2Hu-vSQF3anhuStomkx7yGA@mail.gmail.com> <D6AD09B8-A7B6-4498-84F8-9A31B4AAB8A0@FreeBSD.org> <CAECmPwvGa-Z0cUYgKvSz%2BV_5LoTccWDirAGMLD=_2jXhJKJkFw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_B087FDCF-A995-4901-8DEC-17F3BBB1C5D0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

It only does so on Linux.  This has always been the case, but apparently
it was never noted clearly in the man page.

-Dimitry

> On 22 Jan 2017, at 21:57, Johannes Lundberg <johalun0@gmail.com> =
wrote:
>=20
> I found a way to pass various linker flags to Rust through the =
.cargo/config file which is doable for now.
>=20
> 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...
>=20
>=20
> 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?
>=20
> 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.
>=20
> -Dimitry
>=20
>=20


--Apple-Mail=_B087FDCF-A995-4901-8DEC-17F3BBB1C5D0
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

iEYEARECAAYFAliFIAoACgkQsF6jCi4glqO0jgCfbHq6B1DwhNhfuFcKzjNkfmaa
Fz4AoI3P+PzOVQl6mHgJAEkP41nHDP9Z
=n/Zs
-----END PGP SIGNATURE-----

--Apple-Mail=_B087FDCF-A995-4901-8DEC-17F3BBB1C5D0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C280F115-A85F-4CB8-AC69-8B6ED10225F3>