Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#44346 closed defect (worksforme)

Selfupdate fails with Undefined symbols for architecture x86_64: "_rl_username_completion_function"

Reported by: bugmail-macports@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 2.3.1
Keywords: Cc:
Port:

Description

sudo port selfupdate fails with the following error:

/usr/bin/cc -dynamiclib -g -O2 -std=c99 -Wextra -Wall -pedantic      -Wl,-single_module Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o fs-traverse.o strcasecmp.o vercomp.o filemap.o base32cmd.o sha1cmd.o curl.o rmd160cmd.o sha256cmd.o readline.o uid.o tracelib.o tty.o readdir.o pipe.o flock.o system.o mktemp.o realpath.o -o Pextlib.dylib -L/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/vendor/tcl8.5.15/unix -ltclstub8.5  -install_name /opt/local/libexec/macports/lib/pextlib1.0/Pextlib.dylib  -lcurl  -lreadline ../registry2.0/registry.dylib
Undefined symbols for architecture x86_64:
  "_rl_username_completion_function", referenced from:
      _attempted_completion_function in readline.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [Pextlib.dylib] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1
Command failed: cd /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base && CC=/usr/bin/cc OBJC=/usr/bin/cc ./configure --prefix=/opt/local --with-tclpackage=/Library/Tcl --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make SELFUPDATING=1 && make install SELFUPDATING=1
Exit code: 2
DEBUG: Error installing new MacPorts base: command execution failed
    while executing
"macports::selfupdate [array get global_options] base_updated"
Error: Error installing new MacPorts base: command execution failed

I read Ticket #43856 but I don't have homebrew nor a readline.o in /usr/local

locate readline.o
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/src/pextlib1.0/readline.o
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/omake/files/patch-lib-configure-readline.om.diff

How can I fix this? I'm going to attach the output of sudo port -v selfupdate.

Attachments (2)

selfupdate.log (413.0 KB) - added by bugmail-macports@… 10 years ago.
Output of sudo port -v selfupdate
nm.txt (17.2 KB) - added by bugmail-macports@… 10 years ago.
Output of nm /usr/lib/libreadline.dylib

Download all attachments as: .zip

Change History (10)

Changed 10 years ago by bugmail-macports@…

Attachment: selfupdate.log added

Output of sudo port -v selfupdate

comment:1 Changed 10 years ago by neverpanic (Clemens Lang)

Well, you can use the installer from our website to update to 2.3.1 for now, but you'll likely hit the same problem again with the next update.

Note that readline.o isn't the offending file in /usr/local, readline.h in /usr/local/include and/or libreadline.*.dylib in /usr/local/lib are. Please check for these files.

If that doesn't help, what's the output of openssl dgst -sha1 /usr/include/readline.h and nm /usr/lib/libreadline.dylib?

Changed 10 years ago by bugmail-macports@…

Attachment: nm.txt added

Output of nm /usr/lib/libreadline.dylib

comment:2 Changed 10 years ago by bugmail-macports@…

Thanks for your answer. Indeed I have a couple of readline.h around, but not in /usr/local:

locate readline.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/editline/readline.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/readline/readline.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/editline/readline.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/readline/readline.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/include/editline/readline.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/include/readline/readline.h
/opt/local/include/editline/readline.h
/opt/local/include/readline/readline.h
/opt/local/share/doc/readline/html/readline.html
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/src/pextlib1.0/readline.h
/usr/include/editline/readline.h
/usr/include/readline/readline.h

The ones in /usr/include/editline/ and /opt/local/include/*line/ all have the same signature (that of the Xcode for MacOSX10.9.sdk):

/*	$NetBSD: readline.h,v 1.33 2012/05/15 17:30:04 christos Exp $	*/
SHA1(/opt/local/include/editline/readline.h)= 36d79499fa4b1cb5885596d8b6feae802283a0c3
SHA1(/usr/include/readline/readline.h)= 36d79499fa4b1cb5885596d8b6feae802283a0c3
SHA1(/usr/include/editline/readline.h)= 36d79499fa4b1cb5885596d8b6feae802283a0c3

while that in /opt/local/include/readline comes from the FSF:

#define RL_READLINE_VERSION     0x0603          /* Readline 6.3 */
SHA1(/opt/local/include/readline/readline.h)= eb43dd1ba2d57d996666c22cb13d31d9fedd485c

It's a big mess, not surprising it doesn't work.

I also have multiple libreadline:

locate libreadline
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/libreadline.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libreadline.dylib
/Library/Frameworks/R.framework/Versions/2.15/Resources/lib/libreadline.5.2.dylib
/Library/Frameworks/R.framework/Versions/2.15/Resources/lib/libreadline.dylib
/Library/Frameworks/R.framework/Versions/3.0/Resources/lib/libreadline.5.2.dylib
/Library/Frameworks/R.framework/Versions/3.0/Resources/lib/libreadline.dylib
/Library/Frameworks/R.framework/Versions/3.1/Resources/lib/libreadline.5.2.dylib
/Library/Frameworks/R.framework/Versions/3.1/Resources/lib/libreadline.dylib
/opt/local/lib/libreadline.6.2.dylib
/opt/local/lib/libreadline.6.3.dylib
/opt/local/lib/libreadline.6.dylib
/opt/local/lib/libreadline.a
/opt/local/lib/libreadline.dylib
/usr/lib/libreadline.dylib

The one in /usr/lib doesn't contain _rl_username_completion_function. I attach it in nm.txt.

Ok, then I tried to move /opt/local/include/*line and /usr/include/*line away but I get a different error:

-I/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/src -I. -I/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/vendor/vendor-destroot//opt/local/libexec/macports/include -fno-common sha256cmd.c -o sha256cmd.o
/usr/bin/cc -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED -g -O2 -std=c99 -Wextra -Wall -pedantic     -DHAVE_CONFIG_H -I/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/src -I/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/src -I. -I/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base/vendor/vendor-destroot//opt/local/libexec/macports/include -fno-common readline.c -o readline.o
readline.c: In function 'completion_generator':
readline.c:66:6: error: 'completion_interp' undeclared (first use in this function)
  if (completion_interp && generator_word) {
      ^

Apparently it is missing some headers... which one should I have kept?

comment:3 Changed 10 years ago by neverpanic (Clemens Lang)

/opt/local/include and /opt/local/lib are removed from the respective compiler's search paths when using selfupdate. MacPorts itself (or rather, its configure script) takes care of that, so those are probably not the problem.

That leaves the ones in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs which are unused unless an SDK is being used (selfupdate doesn't).

The version in /usr/include/readline/readline.h should be the correct header. I think what you're seeing is an incompatibility between the header being used and the library actually being linked. The copies of libreadline in /Library/Frameworks/R.framework might be the problem here -- I think those are, unfortunately, in the compiler's standard search paths. You could try moving R.framework to /var/tmp for the time of the selfupdate and see if that helps.

comment:4 Changed 10 years ago by bugmail-macports@…

Thanks a lot, it worked!

I moved R.framework but it still didn't work. Then I also moved /usr/lib/libreadline.dylib and then selfupdate succeeded. Not sure what would have happened with only the R.framework in the path...

Now I restored both to their original location.

comment:5 Changed 10 years ago by bugmail-macports@…

(I don't know how to close the ticket... Modify Ticket allows me only to leave it as new.)

comment:6 Changed 10 years ago by neverpanic (Clemens Lang)

Resolution: worksforme
Status: newclosed

I guess moving libreadline.dylib made made the configure check decide your system didn't support readline, which in turn caused it to turn readline support off.

Anyway, glad you got were able to fix it.

comment:7 Changed 9 years ago by manuel.nuno.melo@…

Maybe too little too late, but I faced the exact same problem and the reason was that /usr/bin/cc was pointing to /opt/local/bin/gcc (and therefore the MacPorts readline was always being preferred over the /usr/lib one).

I imagine I did that linking myself at some point (duh!). Serves me right for being messy... Making /usr/bin/cc point to /usr/bin/gcc solved the problem.

comment:8 in reply to:  7 Changed 9 years ago by neverpanic (Clemens Lang)

Replying to manuel.nuno.melo@…:

Making /usr/bin/cc point to /usr/bin/gcc solved the problem.

Note that on any recent version of OS X is actually a symlink to clang.

Note: See TracTickets for help on using tickets.