Opened 10 years ago

Closed 10 years ago

#43856 closed defect (invalid)

Bug SelfUpdate

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

Description

Hi, I tried to do a "sudo port selfupdate" and it doesn't work. Here is the message (in verbose mode):

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/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
Error: Error installing new MacPorts base: command execution failed
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed

How can I fix that?

Change History (29)

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

Do you have a copy of readline installed in /usr/local? If so, please move /usr/local aside while selfupdating MacPorts.

comment:2 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Component: portsbase
Keywords: selfupdate removed
Type: updatedefect
Version: 2.2.12.3.0

comment:3 Changed 10 years ago by FiReTiTi

Thank you for the advise, but I stil have the same issue:

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/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
Error: Error installing new MacPorts base: command execution failed
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed

comment:4 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

What remains in /usr/local now?

comment:5 in reply to:  4 Changed 10 years ago by FiReTiTi

Replying to ryandesign@…:

What remains in /usr/local now?

CONTRIBUTING.md, Cellar, Frameworks, Library, README.md, SUPPORTERS.md, bin, cuda, etc, include, lib, man, opt, share, texlive.

So a bunch of thing.

In fact readline was in Cellar.

Last edited 10 years ago by FiReTiTi (previous) (diff)

comment:6 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Please remove all of that, then try again.

It sounds like you have Homebrew installed in /usr/local. It is not supported to use another package manager and MacPorts at the same time, because they conflict with one another in ways such as this.

comment:7 Changed 10 years ago by FiReTiTi

I removed everything, but it is still the same issue:

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/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
Error: Error installing new MacPorts base: command execution failed
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed

I have even uninstalled home-brew...

Last edited 10 years ago by FiReTiTi (previous) (diff)

comment:8 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Could you attach the entire log, please?

comment:9 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Usually the error you've reported, "Undefined symbols '_rl_username_completion_function'", is caused by a wrong version of readline somewhere, where "somewhere" is usually /usr/local (i.e. /usr/local/include and /usr/local/lib). If you've already gotten rid of that, another possibility is that you have PATH or DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH environment variables set, pointing to a different location where a wrong version of readline lives. Do you? You could use the "env" command to see all the environment variables you have set.

It's hard to know how to help you further without additional information from you. I'm hoping that if you provide us the entire output of "sudo port -v selfupdate" it will suggest a solution.

comment:10 Changed 10 years ago by FiReTiTi

Ok, here it is: www.thibault.biz/OHSU/port.txt I didn't want to put so much information.

comment:11 Changed 10 years ago by jmroot (Joshua Root)

We specifically check for readline in /usr/local and don’t use —enable-readline if it is there. This looks more like the readline headers in /usr/include don’t match the library in /usr/lib. Your configure output has:

checking whether rl_username_completion_function is declared… yes

whereas it says no on my system (Mavericks).

comment:12 Changed 10 years ago by FiReTiTi

Euh... ok, but what do I have to do to fix it?

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

You can try re-installing the command line tools. Also, what's the sha1 sum of /usr/include/readline.h? Check using openssl dgst -sha1 /usr/include/readline.h.

comment:14 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Is /usr/include/readline.h provided by the command line tools? I figured it would have been part of the operating system (in which case the fix is reinstall the operating system or restore this and any other modified files from your backups).

comment:15 Changed 10 years ago by FiReTiTi

Hi, thank you for your answers.

  • openssl dust -sha1 /usr/include/readline.h => No such file or directory
  • Is /usr/include/readline.h => command not found (logical because the file doesn't exist.

I have lot of work to do right now, I can not afford to reinstall my OS :-(

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

You didn't mention which version of OS X you are using, but you didn't install the command line tools, which provide /usr/include. Please install the command line tools (on Mavericks using xcode-select --install from a Terminal).

comment:17 Changed 10 years ago by FiReTiTi

I use Mac OS X Mavericks 10.9.2 when I wrote this post; now it is 10.9.4. I already have installed the command line tools, a while ago, because I needed it for something else.

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

Oh, you're right, there is no /usr/include/readline.h, but a /usr/include/readline/readline.h. Instead, what is the output of

openssl dgst -sha1 /usr/include/readline/readline.h
openssl dgst -sha1 /usr/lib/libreadline.dylib
ls -lash /usr/lib/libreadline.dylib
locate libreadline.dylib
locate readline.h
nm /usr/lib/libreadline.dylib | grep username_

On my system, the output is

$> openssl dgst -sha1 /usr/include/readline/readline.h
SHA1(/usr/include/readline/readline.h)= 36d79499fa4b1cb5885596d8b6feae802283a0c3
$> openssl dgst -sha1 /usr/lib/libreadline.dylib
SHA1(/usr/lib/libreadline.dylib)= eb8b69ff85d3bb72d144596d20c127a2ef543796
$> ls -lash /usr/lib/libreadline.dylib
8 lrwxr-xr-x  1 root  wheel    15B Oct 23  2013 /usr/lib/libreadline.dylib -> libedit.3.dylib
$> locate libreadline.dylib
/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
/opt/local/lib/libreadline.dylib
/usr/lib/libreadline.dylib
$> 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
$> nm /usr/lib/libreadline.dylib | grep username_
000000000000bcd2 T _username_completion_function

There must be a readline.h on your system in a place that is picked up by MacPorts' configure that defines rl_username_completion_function, which isn't defined by the system header.

comment:19 Changed 10 years ago by FiReTiTi

Ok, but how?

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

How you run the commands that generate the output I requested? You should be able to copy and paste the whole block into a terminal.

Or how a different readline.h was installed on your system? Third-party installers, other package managers, Frameworks, etc. There is a myriad of possibilities there. Usually, the location of additional readline.h files can shed some light on where they come from, which is why I asked for the output of locate readline.h.

comment:21 Changed 10 years ago by FiReTiTi

Sorry, I didn't get what you meant in your second last post. Here are the outputs:

FiReTiTi ~ $  openssl dgst -sha1 /usr/include/readline/readline.h
SHA1(/usr/include/readline/readline.h)= 36d79499fa4b1cb5885596d8b6feae802283a0c3
FiReTiTi ~ $  openssl dgst -sha1 /usr/lib/libreadline.dylib
SHA1(/usr/lib/libreadline.dylib)= eb8b69ff85d3bb72d144596d20c127a2ef543796
FiReTiTi ~ $  ls -lash /usr/lib/libreadline.dylib
8 lrwxr-xr-x  1 root  wheel    15B 29 oct  2013 /usr/lib/libreadline.dylib -> libedit.3.dylib
FiReTiTi ~ $  locate libreadline.dylib
/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
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libreadline.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libreadline.dylib
/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libreadline.dylib
/opt/local/lib/libreadline.dylib
/usr/lib/libreadline.dylib
FiReTiTi ~ $  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
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/include/editline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/include/readline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/usr/include/editline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/usr/include/readline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/include/editline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/include/readline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/include/editline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/include/readline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/editline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/readline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/include/editline/readline.h
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/include/readline/readline.h
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/readline/readline.h
/Developer/SDKs/MacOSX10.5.sdk/usr/include/editline/readline.h
/Developer/SDKs/MacOSX10.5.sdk/usr/include/readline/readline.h
/Developer/SDKs/MacOSX10.6.sdk/usr/include/editline/readline.h
/Developer/SDKs/MacOSX10.6.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/db/dports/sources/rsync.rsync.darwinports.org_dpupdate1/base/src/pextlib1.0/readline.h
/opt/local/var/macports/sources/rsync.macports.org/release/base/src/pextlib1.0/readline.h
/usr/include/editline/readline.h
/usr/include/readline/readline.h
FiReTiTi ~ $  nm /usr/lib/libreadline.dylib | grep username_
000000000000bcd2 T _username_completion_function

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

Can you attach /opt/local/var/macports/sources/rsync.macports.org/release/base/config.log? This is getting weird. All the readline.hs on your system seem to be correct.

comment:23 Changed 10 years ago by FiReTiTi

Here it is: www.thibault.biz/OHSU/config.log

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

How come /usr/bin/cc --version prints

cc (MacPorts gcc47 4.7.3_3) 4.7.3

on your system? Did you modify /usr/bin/cc? What is the output of ls -l /usr/bin/cc?

comment:25 Changed 10 years ago by FiReTiTi

FiReTiTi ~ $  /usr/bin/cc --version
cc (MacPorts gcc47 4.7.3_3) 4.7.3
FiReTiTi ~ $  ls -l /usr/bin/cc
lrwxr-xr-x  1 root  wheel    18B 22 nov  2013 /usr/bin/cc -> /opt/local/bin/gcc

Yes, I had to modify it because Xcode modified the link on gcc for a link on clang. So I modified everything in order to use only gcc.

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

You cannot have /usr/bin/cc point to /opt/local/bin/gcc. MacPorts' GCC will automatically add /opt/local/include to its header search path, which means you cannot avoid the readline.h installed by MacPorts itself. Obviously, this would lead to a cyclic dependency if it worked, but in this case leads to a header/library mismatch and the problem you see.

Please put the link back as it was, i.e.:

lrwxr-xr-x  1 root  wheel      5 Oct 23  2013 /usr/bin/cc -> clang

If you need cc and gcc to be GCC compilers (I wonder why you'd need that, though, clang is a pretty good compiler these days), adjust your $PATH accordingly and put the symlinks in one of the directories before /usr/bin in $PATH (for example, /opt/local/bin or /usr/local/bin). /usr/bin is Apple land, you should never ever modify it, simply because Apple's software and 3rd party software (like MacPorts) relies on it being in the state in which it was installed.

comment:27 Changed 10 years ago by FiReTiTi

I needed to use high level compilation, as auto-vectorization, and according what I read clang doesn't do it (at least at this time).

Sorry, but I didn't get your explanation to have cc and gcc pointing on GCC.

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

It's fine if you need GCC for some specific project. What isn't OK is adjusting a symlink in /usr/bin, especially because it breaks stuff such as this. Please create those symlinks in /opt/local/bin instead:

sudo rm /usr/bin/cc
sudo ln -s clang /usr/bin/cc
sudo ln -s gcc /opt/local/bin/cc

This way, typing cc on the command line will run the same compiler as typing gcc would (both from /opt/local/bin, so your requirement should be fulfilled), but the system wasn't changed.

comment:29 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.