Opened 10 years ago

Last modified 2 years ago

#41103 new defect

libtool @2.4.2_4 put $prefix in dl search path

Reported by: anddam (Andrea D'Amore) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc: michaelld (Michael Dickens), larryv (Lawrence Velázquez)
Port: libtool

Description

Running gschem from geda-gaf port results in

open_nocancel("/usr/local/lib/libguile-srfi-srfi-1-v-3.la\0", 0x0, 0x1B6)                = -1 Err#2
open_nocancel("/lib/libguile-srfi-srfi-1-v-3.la\0", 0x0, 0x1B6)          = -1 Err#2
open_nocancel("/usr/lib/libguile-srfi-srfi-1-v-3.la\0", 0x0, 0x1B6)              = -1 Err#2
access("/usr/local/lib/libguile-srfi-srfi-1-v-3.so\0", 0x4, 0x10A537A50)                 = -1 Err#2
access("/lib/libguile-srfi-srfi-1-v-3.so\0", 0x4, 0x10A537A50)           = -1 Err#2
access("/usr/lib/libguile-srfi-srfi-1-v-3.so\0", 0x4, 0x10A537A50)               = -1 Err#2
stat64("libguile-srfi-srfi-1-v-3.so\0", 0x7FFF68EBF660, 0x7FFF68EC04F0)          = -1 Err#2
stat64("/Users/me/lib/libguile-srfi-srfi-1-v-3.so\0", 0x7FFF68EBFE10, 0x7FFF68EC04F0)                = -1 Err#2
stat64("/usr/local/lib/libguile-srfi-srfi-1-v-3.so\0", 0x7FFF68EBFE10, 0x7FFF68EC04F0)           = -1 Err#2
stat64("/usr/lib/libguile-srfi-srfi-1-v-3.so\0", 0x7FFF68EBFE20, 0x7FFF68EC04F0)                 = -1 Err#2
access("/usr/local/lib/libguile-srfi-srfi-1-v-3.dylib\0", 0x4, 0x10A537A50)              = -1 Err#2
access("/lib/libguile-srfi-srfi-1-v-3.dylib\0", 0x4, 0x10A537A50)                = -1 Err#2
access("/usr/lib/libguile-srfi-srfi-1-v-3.dylib\0", 0x4, 0x10A537A50)            = -1 Err#2
stat64("libguile-srfi-srfi-1-v-3.dylib\0", 0x7FFF68EBF660, 0x7FFF68EC04F0)               = -1 Err#2
stat64("/Users/me/lib/libguile-srfi-srfi-1-v-3.dylib\0", 0x7FFF68EBFE10, 0x7FFF68EC04F0)             = -1 Err#2
stat64("/usr/local/lib/libguile-srfi-srfi-1-v-3.dylib\0", 0x7FFF68EBFE10, 0x7FFF68EC04F0)                = -1 Err#2
stat64("/usr/lib/libguile-srfi-srfi-1-v-3.dylib\0", 0x7FFF68EBFE20, 0x7FFF68EC04F0)              = -1 Err#2
[…]
write(0x9, "ERROR: In procedure dynamic-link:\nERROR: file: \"libguile-srfi-srfi-1-v-3\", message: \"file not found\"\n\0", 0x65)                = 101 0
write(0x9, "Failed to read init scm file [/opt/local/share/gEDA/scheme/gschem.scm]\n\0", 0x47)  

This is due to libguile failing to load at runtime one of the libraries it actually provides. The issue is due to libtool that is searching for libraries in hardcoded paths that don't include $prefix and therefore the port provided library.

The solution is to put $prefix/lib in the search path.

I'm attaching a patch setting this in configure script, I'm putting the path containing $prefix on top to give precedence to mp-provided libs.

I wasn't able to find a configure flag to set this, nor the DYLD_LIBRARY_PATH set in configure phase seems to affect the paths.

Attachments (1)

port-libtool.diff (2.3 KB) - added by anddam (Andrea D'Amore) 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by anddam (Andrea D'Amore)

Attachment: port-libtool.diff added

comment:1 Changed 10 years ago by skymoo (Adam Mercer)

What do the upstream developers say about this?

comment:2 Changed 10 years ago by Xsenon973@…

I have the same problem with libguile-srfi-srfi-1-v-3 I installed some packages which are required libguile-srfi-srfi-1-v-3 and when i try to run program iget the error message

ERROR: In procedure dynamic-link:
ERROR: file: "libguile-srfi-srfi-1-v-3", message: "file not found"

Can you help me please? All this libraries are installed at opt/local by macports why 'file not found'?

comment:3 Changed 10 years ago by skymoo (Adam Mercer)

Owner: changed from ram@… to macports-tickets@…

comment:4 Changed 2 years ago by michaelld (Michael Dickens)

Cc: michaelld added

comment:5 Changed 2 years ago by michaelld (Michael Dickens)

Cc: larryv added

Thanks for the report & patch. Looking at the forthcoming libtool 2.4.7, I see that this ticket's issue is still valid.

I'm wondering what folks think about adding this patch & even modifying it to remove /usr/local and any other non-standard search paths.

I'm all for this, since the defaults then reduce the chances of inadvertently using non-system and non-MP installs. One can always tell libtool to search those directories. I think we do this for CMake and QMake, and it makes sense for the _defaults_ to just be normal system and MP directories, and not include any others.

Last edited 2 years ago by michaelld (Michael Dickens) (previous) (diff)

comment:6 Changed 2 years ago by michaelld (Michael Dickens)

Once 2.4.7 is merged, I propose adding this to the Portfile:

# replace all instances of `/usr/local` with MacPorts PREFIX
post-extract {
    fs-traverse ff ${worksrcpath} {
        reinplace -q -locale C "s@/usr/local@${prefix}@g" ${ff}
    }
}

/usr/local is in quite a few files, and while most are not critical, there are many that are. Thoughts?

Last edited 2 years ago by michaelld (Michael Dickens) (previous) (diff)
Note: See TracTickets for help on using tickets.