Re: Locating libraries installed with MacPorts

2016-10-05 Thread Mick Jordan

On 10/5/16 3:28 PM, Brandon Allbery wrote:
On Wed, Oct 5, 2016 at 6:21 PM, Mick Jordan > wrote:


I have several libraries installed via MacPorts (that also exists
in /usr/lib FWIW), e.g, libpcre and libz. I was rather surprised
to see that these resolve to the MacPorts location,i.e.,
/opt/local/lib even though I am not passing -L/opt/local/lib to
the link step. I thought this might be because I was using gcc to
do the compilation/linking and that is also installed via
MacPorts, but I get the same behavior when using clang. I added
-Wl,-v to the link step and it lists the directories it is
searching and /opt/local/lib is not included in the list. So my
question is how is ld resolving to /opt/local/include. I have no
environment variables such as LDFLAGS set, although /opt/local/bin
is on my PATH.

I'm running MacPorts 2.3.4 in El Capitan.


How is the program being built? If it uses a build framework such as 
autoconf or cmake, or even just pkgconfig, it will often find things 
itself (and sometimes there's no way to stop it from doing so).


Yes, the act of writing the email turned out to improve my understanding 
of what is happening but, unfortunately, not before I hot the send 
button. The libraries in question were actually compiled by another 
framework where /opt/local/lib was being passed.


Thanks
Mick

___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: Locating libraries installed with MacPorts

2016-10-05 Thread Brandon Allbery
On Wed, Oct 5, 2016 at 6:21 PM, Mick Jordan  wrote:

> I have several libraries installed via MacPorts (that also exists in
> /usr/lib FWIW), e.g, libpcre and libz. I was rather surprised to see that
> these resolve to the MacPorts location,i.e., /opt/local/lib even though I
> am not passing -L/opt/local/lib to the link step. I thought this might be
> because I was using gcc to do the compilation/linking and that is also
> installed via MacPorts, but I get the same behavior when using clang. I
> added -Wl,-v to the link step and it lists the directories it is searching
> and /opt/local/lib is not included in the list. So my question is how is ld
> resolving to /opt/local/include. I have no environment variables such as
> LDFLAGS set, although /opt/local/bin is on my PATH.
>
> I'm running MacPorts 2.3.4 in El Capitan.
>

How is the program being built? If it uses a build framework such as
autoconf or cmake, or even just pkgconfig, it will often find things itself
(and sometimes there's no way to stop it from doing so).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: Locating libraries installed with MacPorts

2016-10-05 Thread Ryan Schmidt

> On Oct 5, 2016, at 5:21 PM, Mick Jordan  wrote:
> 
> I have several libraries installed via MacPorts (that also exists in /usr/lib 
> FWIW), e.g, libpcre and libz. I was rather surprised to see that these 
> resolve to the MacPorts location,i.e., /opt/local/lib even though I am not 
> passing -L/opt/local/lib to the link step. I thought this might be because I 
> was using gcc to do the compilation/linking and that is also installed via 
> MacPorts, but I get the same behavior when using clang. I added -Wl,-v to the 
> link step and it lists the directories it is searching and /opt/local/lib is 
> not included in the list. So my question is how is ld resolving to 
> /opt/local/include. I have no environment variables such as LDFLAGS set, 
> although /opt/local/bin is on my PATH.
> 
> I'm running MacPorts 2.3.4 in El Capitan.

I'm not able to reproduce this problem.


$ echo 'int main(void) { return 0; }' > main.c
$ clang main.c -lz
$ otool -L a.out 
a.out:
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 
1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1226.10.1)


___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Locating libraries installed with MacPorts

2016-10-05 Thread Mick Jordan
I have several libraries installed via MacPorts (that also exists in 
/usr/lib FWIW), e.g, libpcre and libz. I was rather surprised to see 
that these resolve to the MacPorts location,i.e., /opt/local/lib even 
though I am not passing -L/opt/local/lib to the link step. I thought 
this might be because I was using gcc to do the compilation/linking and 
that is also installed via MacPorts, but I get the same behavior when 
using clang. I added -Wl,-v to the link step and it lists the 
directories it is searching and /opt/local/lib is not included in the 
list. So my question is how is ld resolving to /opt/local/include. I 
have no environment variables such as LDFLAGS set, although 
/opt/local/bin is on my PATH.


I'm running MacPorts 2.3.4 in El Capitan.

Thanks
Mick

___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users