From owner-freebsd-current@freebsd.org Sun Jan 22 20:57:20 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 5BD5BCBDD8F for ; Sun, 22 Jan 2017 20:57:20 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: from mail-yb0-x232.google.com (mail-yb0-x232.google.com [IPv6:2607:f8b0:4002:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B861B7F; Sun, 22 Jan 2017 20:57:20 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: by mail-yb0-x232.google.com with SMTP id w194so82122963ybe.0; Sun, 22 Jan 2017 12:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ABCJDY65cc3a5Uju6EkQigem9Ul5+/+UvJhFDfNxDWc=; b=cATJN9n8nQKvQmkeDVpc2bXwWppkhVwaw+gHI17QGsl4rdgnOoQMQI7RZSr9LLTJkm OuR8+USZbMzLFtoS6ynzWWifF0JeEYaAHHS0jI0xifnyrugKQAHBuc1yWB3HRklJzNhn gmNpDnA3hyzI78NOlWbBJQ5DN3jksw5WDP8qGzK55FLbiZgmVK2+exFM9Tk1X8Av+vHQ eYDIrxGhsU8b8BaRWFwcl5cvkYrhGU7ddBEIdfIrhfTksNQQW3QegI45sTpXR+uNgVBr b/KOISeToSGyiiYca4KFmxi6w/bp1eNAnVw4rwzkN46KJc1OesRvEde8mKRZX62XSiu9 MSmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ABCJDY65cc3a5Uju6EkQigem9Ul5+/+UvJhFDfNxDWc=; b=fBQY7/C10UP/yrzT6gxsca67dfmFcRPrXjLNVOa0+dJCqUu9p7A9t9Agk90jFpdshb 6VSfHcB82sJK2badpm2KvhAhAoFg3NgZ+T6/P0me9h7AwKYrjZraBl6iYB7eRrTufGX/ W5dKAyZce/C/cZ5Xn7FZAyXs2ypPu/mBxe+YwO0vyVDtKHqTbQOaXAX5ZAY5IXPR2LCQ V2yol1wvwSlc9K5Rr4d1pgMKNwBNtIMkB3rNPUBcvCoVG5hXdaqG9a6CZGz/0pYLv4Ds K1dsKEcpC69v6CbMP9racWEhIIq6HVCUki82INYNK3FOcboFkP46jOuQ9IOHA1UcwORJ OyyQ== X-Gm-Message-State: AIkVDXIfRBO913N3rp2W1gtnVIFeV6C+KNobSJ4FWWBhvpMqeMuLvBXI/chO2kbSmsprth7xt1N4UgMz7BDdBw== X-Received: by 10.37.174.12 with SMTP id a12mr19621349ybj.44.1485118639333; Sun, 22 Jan 2017 12:57:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.168.9 with HTTP; Sun, 22 Jan 2017 12:57:18 -0800 (PST) In-Reply-To: References: From: Johannes Lundberg Date: Sun, 22 Jan 2017 12:57:18 -0800 Message-ID: Subject: Re: Linker problems with clang /usr/local/lib To: Dimitry Andric Cc: freebsd-current@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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 20:57:20 -0000 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 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? > > 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 > >