From owner-freebsd-current@freebsd.org Sun Jan 22 21:11:42 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85D1FCBC962 for ; Sun, 22 Jan 2017 21:11:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DDD61C78 for ; Sun, 22 Jan 2017 21:11:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::68c3:9552:7f7e:ae08] (unknown [IPv6:2001:7b8:3a7:0:68c3:9552:7f7e:ae08]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id F1AE348835; Sun, 22 Jan 2017 22:11:38 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_B087FDCF-A995-4901-8DEC-17F3BBB1C5D0"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Linker problems with clang /usr/local/lib From: Dimitry Andric In-Reply-To: Date: Sun, 22 Jan 2017 22:11:32 +0100 Cc: freebsd-current@freebsd.org Message-Id: References: To: Johannes Lundberg X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 21:11:42 -0000 --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 = 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 = wrote: > On 22 Jan 2017, at 21:29, Johannes Lundberg = 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--