From owner-freebsd-questions@freebsd.org Sat Dec 8 02:22:51 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87F18132B02C for ; Sat, 8 Dec 2018 02:22:51 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA8CB85026 for ; Sat, 8 Dec 2018 02:22:50 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([92.193.252.129]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.167]) with ESMTPA (Nemesis) id 0Ljz90-1h21rC3y2s-00cDia; Sat, 08 Dec 2018 03:22:37 +0100 Date: Sat, 8 Dec 2018 03:22:34 +0100 From: Polytropon To: freebsd@dreamchaser.org Cc: FreeBSD Mailing List Subject: Re: -lfoo vs /usr/local/lib/libfoo.so Message-Id: <20181208032234.47a2773d.freebsd@edvax.de> In-Reply-To: <4e4f02e8-18b5-4e3e-2887-922946498bf1@dreamchaser.org> References: <4e4f02e8-18b5-4e3e-2887-922946498bf1@dreamchaser.org> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:KM+o3112Yy4L1Hr0ZblSAcErgIMN4FKUSoT6dghUM9c9Ndmw6gS wgZBF9UBYVsDQRgChnlfEmXSdUyD+C94k1XXu01JTvwiz5J9wodm5YkJyw+2pl1uCVHfSSt EyJ7I9nb23ZZSpHQU+xug89vsdG/4lbh1PPvetTuTyi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[]; HAS_ORG_HEADER(0.00)[]; MX_GOOD(-0.01)[cached: mx01.schlund.de]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[129.252.193.92.zen.spamhaus.org : 127.0.0.10]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; IP_SCORE(-0.14)[ipnet: 212.227.0.0/16(-0.61), asn: 8560(-0.07), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.61)[-0.606,0]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.17)[0.169,0]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[133.126.227.212.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 02:22:51 -0000 On Fri, 7 Dec 2018 11:43:29 -0700, Gary Aitken wrote: > In trying to build a dev version of a port, the cmake script includes > many libraries explicitly, and one (-lhdf5-18) using -l: > > /usr/bin/c++ -fPIC -Wall -Wextra -Wno-write-strings -O2 -pipe > -I/usr/local/include/hdf5-18 -fstack-protector -isystem /usr/local/include > -fno-strict-aliasing -isystem /usr/local/include -std=c++11 > -Wno-undefined-var-template -D_OCC64 -O2 -pipe -I/usr/local/include/hdf5-18 > -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -isystem > /usr/local/include -Wl,--no-undefined -shared > -Wl,-soname,libFreeCADBase.so -o ../../lib/libFreeCADBase.so > ... a bunch of .o files ... > -Wl,-rpath,/usr/local/lib:/usr/local/lib/qt4: -lhdf5-18 > /usr/local/lib/libpython2.7.so > ... ... > -lpthread -lz /usr/local/lib/qt4/libQtCore.so > > The above command fails with > "/usr/bin/ld: cannot find -lhdf5-18" > although > /usr/local/lib/libhdf5-18.so > exists and the rpath flag indicates /usr/local/lib > > If I replace -lhdf5-18 with /usr/local/lib/libhdf5-18.so it works. > Curiously (to me) -lpthread and -lz are apparently working correctly, > or at least aren't being mis-interpreted. > > I've tried tweaking the command to use -Wl,-lhdf5-18 but that fails also. > Can anyone explain to me what's going on? Judging from the command presented, there is no (re)definition of the library path, i. e., no -L parameter. This imples the defaults are used. If I remember correctly, the system's library path is always selected, so -lz -> /usr/lib/libz.so, as well as -lpthread -> /usr/lib/libpthread.so will work for that reason. As /usr/local/lib/libhdf5-18.so is in /usr/local/lib, this path should either be part of the configuration (LDFLAGS) or named explicitely as -L/usr/local/lib/libhdf5-18.so, similarly to the -I/usr/local/include/hdf5-18 which is the directory expected to contain the header files for the library in question. So check the Makefile, maybe defaults it incorporates (or fails to override or to extend), as well as - at least for testing - using -L. Reason simplified: The library referenced as "hdf5-18" (which refers to libhdf5-18.so) cannot be found in any of the defined library paths. This at least explains what you're seeing. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...