Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am attempting to install the expect pecl extension.

OS version = 10.7.3
PHP version 5.3.10 installed via macports
expect version 5.45 installed via macports

The command I am executing:

sudo pecl -d preferred_state=beta install expect

fails with ld: library not found for -lexpect

The libexpect5.45.dylib file is located in /opt/local/lib. Full output of the install command is here.

From what I can tell pecl just can not find the libexpect library, I even tried prepending:

LD_LIBRARY_PATH=/opt/local/lib/expect5.45
LD_LIBRARY_PATH=/System/Library/Tcl/8.5/expect5.45
LD_LIBRARY_PATH=/opt/local/lib

Each location has an expect5.45.dylib file. It did not help. Can anyone help me figure out how to get this extension installed?

share|improve this question

2 Answers 2

LD_LIBRARY_PATH is not used on OS X, and the equivalent environment variable does not affect ld (and can break other things, as unlike on Linux it is the entire library path which means critical libraries like libSystem.dylib would no longer be found; on the other hand, sudo cleans its environment, so it wouldn't work anyway). Additionally, that library name would not match -lexpect.

For what it's worth, port contents expect on my Lion system shows me a /opt/local/lib/libexpect.a static library (and libexpect5.45.a) but no dylib. Are you sure it is installed correctly? Check the output of port contents expect.

share|improve this answer
    
port contents expect show that I have /opt/local/lib/expect5.45/libexpect5.45.a and /opt/local/lib/libexpect.a I also found a bug and repaired the symlink, but pecl install expect still fails. Should I edit the pecl Makefile ? as you said is the library name different ? –  Ketema Apr 5 '12 at 21:27
    
The question then becomes why pecl is looking for a dylib instead of a static lib. A symlink won't fix that, and I don't know enough about pecl to know why it won't use the static library. –  geekosaur Apr 5 '12 at 21:35
    
Here is the output of configure The interesting lines that I see are: "checking for expect support... yes, shared" and "checking specify path to Tcl needed by expect... yes, shared" The Makefile generated is here I am curious about the line: "EXPECT_SHARED_LIBADD = -lexpect -ltcl8.5" as that is where it seems to me to be failing. Any thoughts on what perhaps I could change that -lexpect part to ? I tried -lexpect5.45 and its still failed but with not found for expect5.45 –  Ketema Apr 5 '12 at 21:42
    
The "yes, shared" is incorrect, as it's a static library; although if the script is old enough, it may incorrectly assume that a static library behaves as a shared library (this was normal on PowerPC architectures, including PPC Macs). The configure output in this case is not as helpful as the contents of config.log. –  geekosaur Apr 5 '12 at 21:45
    
Here is the config log. I am out of my domain, but in reading it I see that it found shared libraries as you said, and I also notice that its says libtool supports shares libraries. I also am examining the Makefile and I see that at the end the lib tool command expands out to this and do the -I represent include paths ? If so I do not see /opt/local/lib present –  Ketema Apr 5 '12 at 22:00
up vote 0 down vote accepted

OK so thanks to some trouble shooting and insights from @geekosaur the answer is "pecl is not generating a correct libtool script to install this extension on MacOSX" at least on my setup anyway. I really appreciate the discussion and trouble shooting. Of course my next question is going to be: "How do I fix the pecl install script?" But that's for another board... :)

share|improve this answer
    
To anyone that ever cares I did not fix the pecl script on OS X but I did manage to get the extension installed –  Ketema Apr 9 '12 at 20:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.