Can't Install Most Ports

Hello.

I have been having an issue with the majority of the ports I've been trying to install. Apache22, MySQL, PHP, PostgreSQL, Python, Ruby, and Subversion all give me the same errors related an .so file -- it is a different for each one.

Here are the errors:
Code:
undefined reference to `_sem_timedwait'
undefined reference to `_sem_getvalue'
undefined reference to `_sem_destroy'
undefined reference to `_sem_wait'
undefined reference to `_sem_init'
undefined reference to `_sem_post'
undefined reference to `_sem_trywait'

The undefined references are always the same, but the .so file causing the error is different.

I saw this post from someone with the same issue with Python:
http://forums.freebsd.org/showthread.php?t=29442

I tried to do the solution, but I get the following error:
Code:
ld: warning: cannot find entry symbol _start; not setting start address
/lib/libc.so.7: undefined reference to `__progname'
/lib/libc.so.7: undefined reference to `environ'

I am using FreeBSD 9.1-RELEASE.

I don't have any problems installing or running the software from packages, it's only when I build them that there's a problem.

I don't know what to do to fix this issue and it's stopping me from using my server. I need to install software with certain options enabled and I can't do that.

Does anyone know what's wrong and how to fix it?

Thank you.
 
If you need to set options, stop using packages. After that, fix all your installed ports. It is probably easiest and fastest to just rebuild all ports following the procedure at the end of the portmaster(8) man page.

After that, please be sure to check /usr/ports/UPDATING before installing or updating ports.
 
Thank you for the reply.

I know I need to stop using packages. I'm trying to install the ports but they won't build. I tried rebuilding with portmaster, but they still have that error I mentioned. I've even tried uninstalling everything and starting over and I'm still getting those errors. I don't know what I'm missing, I looked at the dependencies for the ports that won't install, and I have the ones that I'm able to install, installed through ports. The ones I can't install through ports because of that error, I installed with a package.

I've read a large portion of /usr/ports/UPDATING to see if there might be something in there about the issue I'm having, I didn't see anything.
 
Do the portmaster procedure mentioned earlier. Not only does it delete all installed ports, it also deletes the configurations, another possible source of problems. When the ports are reinstalled, be very cautious about enabling or disabling options.
 
Unrelated Lesson Learned: Make sure root doesn't have a shell that was installed before doing something like this -- actually, just don't change roots shell. My server is 700 miles away and I spent 12 hours trying to explain to my hosting company how to boot in single-user mode, mount the drive, and then edit the passwd files to change the shell so I could re-login after getting disconnected.


Thank you, but that did not fix the problem.

At the moment, I'm doing 'clean' and 'rmconfig' on the entire ports tree to help make sure that nothing is around from previous builds before trying again.

If that doesn't work, I'm thinking about deleting and re-downloading the entire tree. Do you know the best way to do that?

And can you think of anything else I can try?

While I wait, I'm also looking at the dependencies of the software that does and doesn't install, to see if maybe the key is somewhere in there.
 
Sorry for posting again, I'm not allowed to edit yet.


I haven't tracked down the problem itself, but I did track down what ports are causing it. Here's a paste of the build errors from both ports:

http://pastie.org/6172358 - pcre
http://pastie.org/6172361 - python27

It seems that everything else I'm having an issue installing requires one of those two ports, which is why I keep getting the same errors.

So far I've been able to install all the other dependencies that are needed, just not those two.
 
Do you have any custom settings like CFLAGS in /etc/make.conf ?

Both ports you mention build perfectly fine on my system that has 9.1-RELEASE jail for building packages.
 
No, here is my /etc/make.conf file:

Code:
# added by use.perl 2013-02-15 01:13:38
PERL_VERSION=5.14.2
 
Wolfenhex said:
At the moment, I'm doing 'clean' and 'rmconfig' on the entire ports tree to help make sure that nothing is around from previous builds before trying again.
This is usually faster and has the same result:
Code:
# rm -rf /usr/ports/*/*/work
# rm -rf /var/db/ports/*
 
SirDice said:
This is usually faster and has the same result:
Code:
# rm -rf /usr/ports/*/*/work
# rm -rf /var/db/ports/*

Thank you. That probably saved me a lot of time. This didn't fix the problem though, same errors.

According to this thread I linked earlier, their problem was that files in /usr/lib weren't linked correctly. But when I tried doing the fix they did, I received an error. Is it possible to re-install /usr/lib without re-installing the entire operating system?
 
Wolfenhex said:
Is it possible to re-install /usr/lib without re-installing the entire operating system?
I think the simplest way would be to build and installworld from source. I'm not exactly sure if you can only rebuild those libraries.
 
You don't need to build anything from source, you can just fetch the distribution sets from the FreeBSD website:
ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/9.1-RELEASE/

base.txz is probably what you want.

(This is for amd64, if you're using i386, then use that directory).

You should be able to extract them with:
$ tar xpf base.txz -C /

Some files have the immutable flag set, so you'll want to remove that before you extract the new files:
$ chflag -R noschg /bin /usr/bin /sbin /usr/sbin /lib /usr/lib


Here's a script to check for broken libraries by the way:
http://code.arp242.net/pkg_sanity/raw/f2ddc38f7b4cd39d0700c3c83cd89ec5af9df521/pkg_sanity

Use the -l option.
 
Thank you, I will give the script a try first. I did try pkg_libchk, but it didn't return anything.

Assuming I will still need to re-install the libraries. Should I remove the content of /usr/bin before I extract base.txz? I'm worried about something old being left in there and keeping it screwed up. And how can I change the flag set back once the files are copied over to make sure they are immutable again?
 
Be aware that extracting the whole base.txz over your existing system overwrites /etc as well with master.passwd and group files. If you still want to go with this route make a backup first and make sure you can either recover overwritten files from the backup or extract only /usr/lib from the archive.
 
I ran pkg_sanity -l and this was the output:

Code:
===> Checking for unresolvable libraries
Checking /bin
Checking /sbin
Checking /libexec
Checking /lib
Checking /usr/bin
Checking /usr/sbin
Checking /usr/lib
Checking /usr/libexec
Checking /usr/local/bin
Checking /usr/local/sbin
Checking /usr/local/lib
Checking /usr/local/libexec

I doesn't look like it found anything wrong.
 
Solved! Thank you very much everyone! Here is what I did to fix it.

I downloaded base.txz from:
http://ftp.freebsd.org/pub/FreeBSD/releases/i386/9.1-RELEASE/

Once downloaded, I ran:
# chflags -R noschg /usr/lib
# tar -xpf base.txz -C / './usr/lib/*'

I have successfully installed both ports that were giving me problems.

Is there anything I should do to help make sure this doesn't happen again or to make sure I didn't screw anything up with this fix?
 
Carpetsmoker said:
You don't need to build anything from source, you can just fetch the distribution sets from the FreeBSD website:
ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/9.1-RELEASE/

base.txz is probably what you want.

(This is for amd64, if you're using i386, then use that directory).

You should be able to extract them with:
$ tar xpf base.txz -C /

Some files have the immutable flag set, so you'll want to remove that before you extract the new files:
$ chflag -R noschg /bin /usr/bin /sbin /usr/sbin /lib /usr/lib


Here's a script to check for broken libraries by the way:
http://code.arp242.net/pkg_sanity/raw/f2ddc38f7b4cd39d0700c3c83cd89ec5af9df521/pkg_sanity

Use the -l option.

I am wondering which line(s) (and how) one may modify that script so that it only checks a*, or b*, or c* so as to only present a subset of stuff that needs fixing... so one could do a subset as time allows, maybe even a cronjob so that problems could be discovered more or less automatically if set up right... or at least not a whole lot at once. (Or even another option to the script....)
 
Wolfenhex said:
Solved! Thank you very much everyone! Here is what I did to fix it.

I downloaded base.txz from:
http://ftp.freebsd.org/pub/FreeBSD/releases/i386/9.1-RELEASE/

Once downloaded, I ran:
# chflags -R noschg /usr/lib
# tar -xpf base.txz -C / './usr/lib/*'

I have successfully installed both ports that were giving me problems.

Is there anything I should do to help make sure this doesn't happen again or to make sure I didn't screw anything up with this fix?

I ran into the problem today. I upgraded an i386 system to FreeBSD 9.1. After the OS updates, portupgrade -af worked for everything I had installed except pcre. After updating /usr/lib as shown above, pcre was able to compile.
 
tnpimatt said:
I ran into the problem today. I upgraded an i386 system to FreeBSD 9.1. After the OS updates, portupgrade -af worked for everything I had installed except pcre. After updating /usr/lib as shown above, pcre was able to compile.

I'm glad this thread was able to help someone else. I had a hard time finding information about the problem. I looked for a few days before I finally posted here for help.
 
If you need to set options, stop using packages. After that, fix all your installed ports. It is probably easiest and fastest to just rebuild all ports following the procedure at the end of the portmaster(8) man page.

After that, please be sure to check /usr/ports/UPDATING before installing or updating ports.

Sounds good until you realize you can't build any ports because you don't have a linker and now you have to use packages and hope they work.

Code:
../cups/libcups.so: undefined reference to `_sem_timedwait'
../cups/libcups.so: undefined reference to `_sem_getvalue'
../cups/libcups.so: undefined reference to `_sem_destroy'
../cups/libcups.so: undefined reference to `_sem_wait'
../cups/libcups.so: undefined reference to `_sem_init'
../cups/libcups.so: undefined reference to `_sem_post'
../cups/libcups.so: undefined reference to `_sem_trywait'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
 
paulbeard You're responding to a 9-year old thread.

If you don't have a linker on your system, you have more problems than what the OP has.
If you have to hope your packages work, you have more problems than what the OP has.
 
Except, not having a linker isn't possible unless you build base yourself and set something strange like WITHOUT_TOOLCHAIN=yes.
 
Back
Top