Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#40984 closed defect (invalid)

ncurses@5.9.2+command execution failed-build failed

Reported by: idleft@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: ryandesign (Ryan Carsten Schmidt), idleft@…
Port: ncurses

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Hi~ I met a problem when I trying to build the port ncurses

The story is silly. After I upgraded OSX to 10.9, I found the port wasn't work. The reason might be I haven't update for a long time or the system update. Then I did a silly operation. I run 'port -fp uninstall installed' without backup the installed list. After the pkg for Mavericks released, I reinstalled this package and finally get my port work properly, but the packages are missing. The terminal keeps noticing

dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
  Referenced from: /usr/bin/dircolors
  Reason: image not found

And the time I building other packages, this problem also occurs. I read the log and this is also the problem. Is there any suggestion for this? Thanks a lot~

Attachments (6)

ncurses.log (36.4 KB) - added by idleft@… 10 years ago.
main.log
coreutils-files.txt (4.3 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
coreutils-files-ls.txt (6.6 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
coreutils-remove.sh (2.2 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
bom-results.txt (9.5 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
bom-results-sorted.txt (9.5 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.

Download all attachments as: .zip

Change History (13)

Changed 10 years ago by idleft@…

Attachment: ncurses.log added

main.log

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

Cc: ryandesign@… added
Description: modified (diff)
Keywords: ncurses removed
Resolution: invalid
Status: newclosed

First, ensure you've followed the migration instructions.

Then, delete the file /usr/bin/dircolors. It is not a part of OS X and it is linked to a library from MacPorts, which suggests you compiled it yourself and installed it there. You should not install software into /usr/bin; that directory is only for Apple to install software in.

If you want the dircolors program, you can get it from MacPorts by installing the coreutils port. It will be called gdircolors. If you would like it to be called dircolors instead, add /opt/local/libexec/gnubin to your PATH.

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

Actually the fact that you have /usr/bin/dircolors at all makes me worried you may have installed all of coreutils into /usr/bin, and without the "g" prefix that we add in MacPorts. Is that possible? If so, that would be bad, because coreutils contains GNU versions of many utilities, many of which are already on OS X, and coreutils probably overwrote the OS X versions with its own.

comment:3 in reply to:  2 ; Changed 10 years ago by idleft@…

Replying to ryandesign@…:

Actually the fact that you have /usr/bin/dircolors at all makes me worried you may have installed all of coreutils into /usr/bin, and without the "g" prefix that we add in MacPorts. Is that possible? If so, that would be bad, because coreutils contains GNU versions of many utilities, many of which are already on OS X, and coreutils probably overwrote the OS X versions with its own.

Yes, your concern is right. It's an old problem I have in Mountain Lion. I stupidly followed some guide, compiled and installed the coreutils into the /usr/bin. I thought the new installation of Mavericks would overwritten this problem, but it seems doesn't work, as your assumption. I checked out the utilities in /usr/bin, likie 'ls', etc. None of them working properly, and I have to add path /bin in front of /usr/bin to make these basic commands working. Is there are anything else I can do to solve this problem?

comment:4 Changed 10 years ago by idleft@…

Cc: idleft@… added

Cc Me!

comment:5 in reply to:  3 ; Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to idleft@…:

Yes, your concern is right. It's an old problem I have in Mountain Lion. I stupidly followed some guide, compiled and installed the coreutils into the /usr/bin. I thought the new installation of Mavericks would overwritten this problem, but it seems doesn't work, as your assumption. I checked out the utilities in /usr/bin, likie 'ls', etc. None of them working properly, and I have to add path /bin in front of /usr/bin to make these basic commands working. Is there are anything else I can do to solve this problem?

I also would have thought that upgrading to Mavericks (or reinstalling Mountain Lion) would have replaced the bad coreutils files with the correct OS X versions. You can solve it manually, but it'll take a bit of work. Here is how I'd do it.

First, take a full system backup using Time Machine or your preferred method. If you don't have a backup drive or don't have space for a full backup, at least back up /usr, e.g. using:

sudo /usr/bin/tar cjf ~/Desktop/usr-backup.tar.bz2 /usr

On my system that comes to about 310MiB so hopefully you at least have room for that.

Next, identify all the files that coreutils installed into /usr/bin. We could try to use the coreutils port for this, but instead I manually untarred the coreutils source and ran:

./configure --prefix=/tmp/coreutils
make -j8
make install
find /tmp/coreutils -type f | sed -e s,/tmp/coreutils,/usr, > ~/Desktop/coreutils-files.txt

Then we need to figure out which of those files belong on OS X and which of them don't. Here's how I did this:

xargs ls -1 < ~/Desktop/coreutils-files.txt > ~/Desktop/coreutils-files-ls.txt 2>&1

I've attached the resulting files for reference. In the second file, all of those lines that say "No such file or directory" don't belong on OS X and should be removed. Here's how I generated a script to do that:

sed -E -n -e 's,^ls: (.*): .*$,rm -fv '\''\1'\'',p' < ~/Desktop/coreutils-files-ls.txt > ~/Desktop/coreutils-remove.sh

This script is attached and if it looks good to you, you can download it to your Desktop and run it with:

sudo sh ~/Desktop/coreutils-remove.sh

The rest of the coreutils files need to be restored to their original OS X versions. This is the tricky part, if you don't have a backup.

Assuming you don't have /Applications/Install OS X Mavericks.app anymore (it gets removed after installing OS X), download it again from the Mac App Store. Then mount the image inside it:

open '/Applications/Install OS X Mavericks.app/Contents/SharedSupport/InstallESD.dmg'

Now open the Packages folder. Here it gets a bit messy, because the files you need aren't all in the same package. If you're not sure which package a particular file came from, you can look it up in the bills of materials (BOMs) that the installer leaves on your drive. There may be a better way to do this, but I used this command to create a single file containing all the Apple BOMs:

find /private/var/db/receipts -name 'com.apple.pkg.*.bom' -print0 | xargs -0 -n 1 -I % sh -c 'lsbom -s % | sed "s,^,%: ,";' | tee ~/Desktop/all-boms.txt

We can then grep this for files of interest. For example, to grep this file for all the coreutils files:

while read LINE; do grep " \.$LINE$" ~/Desktop/all-boms.txt; done < ~/Desktop/coreutils-files.txt | tee ~/Desktop/bom-results.txt

all-boms.txt is about 225 MiB on my system so it takes awhile to grep, but after awhile it's done and we can sort it to get the list of files ordered by the package they're in:

sort -u < ~/Desktop/bom-results.txt > ~/Desktop/bom-results-sorted.txt

Looks like the files are spread between BSD, BaseSystemBinaries and Essentials. You can open these packages from the install volume with Pacifist and extract individual files from them. (There are also commands for doing that on the command line but I don't remember them off hand.)

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: coreutils-files.txt added

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: coreutils-files-ls.txt added

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: coreutils-remove.sh added

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: bom-results.txt added

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: bom-results-sorted.txt added

comment:6 in reply to:  5 Changed 10 years ago by idleft@…

Replying to ryandesign@…:

Replying to idleft@…:

Yes, your concern is right. It's an old problem I have in Mountain Lion. I stupidly followed some guide, compiled and installed the coreutils into the /usr/bin. I thought the new installation of Mavericks would overwritten this problem, but it seems doesn't work, as your assumption. I checked out the utilities in /usr/bin, likie 'ls', etc. None of them working properly, and I have to add path /bin in front of /usr/bin to make these basic commands working. Is there are anything else I can do to solve this problem?

I also would have thought that upgrading to Mavericks (or reinstalling Mountain Lion) would have replaced the bad coreutils files with the correct OS X versions. You can solve it manually, but it'll take a bit of work. Here is how I'd do it.

First, take a full system backup using Time Machine or your preferred method. If you don't have a backup drive or don't have space for a full backup, at least back up /usr, e.g. using:

sudo /usr/bin/tar cjf ~/Desktop/usr-backup.tar.bz2 /usr

On my system that comes to about 310MiB so hopefully you at least have room for that.

Next, identify all the files that coreutils installed into /usr/bin. We could try to use the coreutils port for this, but instead I manually untarred the coreutils source and ran:

./configure --prefix=/tmp/coreutils
make -j8
make install
find /tmp/coreutils -type f | sed -e s,/tmp/coreutils,/usr, > ~/Desktop/coreutils-files.txt

Then we need to figure out which of those files belong on OS X and which of them don't. Here's how I did this:

xargs ls -1 < ~/Desktop/coreutils-files.txt > ~/Desktop/coreutils-files-ls.txt 2>&1

I've attached the resulting files for reference. In the second file, all of those lines that say "No such file or directory" don't belong on OS X and should be removed. Here's how I generated a script to do that:

sed -E -n -e 's,^ls: (.*): .*$,rm -fv '\''\1'\'',p' < ~/Desktop/coreutils-files-ls.txt > ~/Desktop/coreutils-remove.sh

This script is attached and if it looks good to you, you can download it to your Desktop and run it with:

sudo sh ~/Desktop/coreutils-remove.sh

The rest of the coreutils files need to be restored to their original OS X versions. This is the tricky part, if you don't have a backup.

Assuming you don't have /Applications/Install OS X Mavericks.app anymore (it gets removed after installing OS X), download it again from the Mac App Store. Then mount the image inside it:

open '/Applications/Install OS X Mavericks.app/Contents/SharedSupport/InstallESD.dmg'

Now open the Packages folder. Here it gets a bit messy, because the files you need aren't all in the same package. If you're not sure which package a particular file came from, you can look it up in the bills of materials (BOMs) that the installer leaves on your drive. There may be a better way to do this, but I used this command to create a single file containing all the Apple BOMs:

find /private/var/db/receipts -name 'com.apple.pkg.*.bom' -print0 | xargs -0 -n 1 -I % sh -c 'lsbom -s % | sed "s,^,%: ,";' | tee ~/Desktop/all-boms.txt

We can then grep this for files of interest. For example, to grep this file for all the coreutils files:

while read LINE; do grep " \.$LINE$" ~/Desktop/all-boms.txt; done < ~/Desktop/coreutils-files.txt | tee ~/Desktop/bom-results.txt

all-boms.txt is about 225 MiB on my system so it takes awhile to grep, but after awhile it's done and we can sort it to get the list of files ordered by the package they're in:

sort -u < ~/Desktop/bom-results.txt > ~/Desktop/bom-results-sorted.txt

Looks like the files are spread between BSD, BaseSystemBinaries and Essentials. You can open these packages from the install volume with Pacifist and extract individual files from them. (There are also commands for doing that on the command line but I don't remember them off hand.)

Thank you so much. Your generous help and detailed solution solved my problem.

Firstly, I followed your instruction step by step, and finally I understood that I should use your result since my /usr is full of coreutil files.

I use the pacifit to extract the files from pkg, and use rsync copied files to the target directory.

Now it's all works perfectly. Thank you very much

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

Great! I'm glad that worked. I'm sure you now realize why using a package manager like MacPorts is much easier than trying to install (and especially uninstall) software manually and I hope MacPorts will be your first choice for your future software installation needs. If there's any software you want to use that's not in MacPorts yet I hope you'll file a ticket and let us know so that we can add it (or you can even write a Portfile for it yourself and contribute it).

Note: See TracTickets for help on using tickets.