Python27 failed to compile after upgrade to 9.0-RELEASE-i386

I am getting undefined reference error when I try to reinstall all ports (using portupgrade) after upgrade from 8.2 to 9.0. Remove all packages (pkg_delete -a) and reinstall from port tree does not help. Any idea?

Code:
./libpython2.7.so: undefined reference to `_sem_timedwait'
./libpython2.7.so: undefined reference to `_sem_getvalue'
./libpython2.7.so: undefined reference to `_sem_destroy'
./libpython2.7.so: undefined reference to `_sem_wait'
./libpython2.7.so: undefined reference to `_sem_init'
./libpython2.7.so: undefined reference to `_sem_post'
./libpython2.7.so: undefined reference to `_sem_trywait'
*** Error code 1

Stop in /usr/ports/lang/python27/work/Python-2.7.2/portbld.shared.
*** Error code 1

Stop in /usr/ports/lang/python27.
*** Error code 1

Stop in /usr/ports/lang/python27.

The Python27 compiled okay in my new installation of 9.0-RELEASE-AMD64 on another machine.
 
How was the machine upgraded to 9.0? If you did a source based upgrade you should run
# make delete-old
# make delete-old-libs

in /usr/src to get rid of outdated libraries.
 
If you have up to date 9.0-Release sources installed you can still run those commands. It's odd that freebsd-update(8) didn't clean up old files properly... The reason for the compilation failure is most likely /lib/libthr.so.2 that is now obsolete and shouldn't exist on a 9.0 system and the up to date version is /lib/libthr.so.3.
 
What I did after your suggestion.

1) cd /usr/src
2) make delete-old
3) make delete-old-libs
4) cd /usr/ports/lang/python27
5) make
6) same compile error
7) ls -l /lib/libth*
Code:
r--r--r--  1 root  wheel  95636 Jan 14 15:50 libthr.so.3

8) Install cvsup-without-gui from port and waiting for it to be compiled.

So will do a cvsup again on *default release=cvs tag=RELENG_9_0 solve the problem?
 
Do a

# make clean in /usr/ports/lang/python27 to make sure there's no old work files left from previous compilations.

Also double check that you have an up to date ports tree in /usr/ports, I recommend using portsnap(8) instead of csup(1) if you're not already using it.

Initial checkout of the tree (may take a long time):
# portsnap fetch
# portsnap extract

Updating of the ports tree:
# portsnap fetch
# portsnap update
 
Also something that didn't occur to me right away, reset the options of lang/python27 to defaults with:

# cd /usr/ports/lang/python27
# make rmconfig

And try again.
 
What I did.

  1. # rm -R /usr/src
  2. # rm -R /usr/ports
  3. # pkg_add -r bsdadminscripts
  4. # portsnap fetch
  5. # portsnap extract
  6. logout and relogin as root
  7. # pkg_libchk
  8. pkg_libchk run for a while, return nothing (no error)
  9. # cd /usr/local/lang/python27
  10. # make rmconfig
  11. # make
  12. same error
    Code:
    .o  Modules/zipimport.o  Modules/symtablemodule.o  Modules/xxsubtype.o   -lutil  -lm ;  fi
    cc -c -fno-strict-aliasing -O2 -pipe  -fno-strict-aliasing -DNDEBUG -O2 -pipe  -fno-strict-aliasing 
     -I. -IInclude -I./../Include -fPIC -DPy_BUILD_CORE -o Modules/python.o ./../Modules/python.c
    cc -pthread -Wl,--export-dynamic -o python  Modules/python.o  -L. -lpython2.7 -lutil   -lm
    ./libpython2.7.so: undefined reference to `_sem_timedwait'
    ./libpython2.7.so: undefined reference to `_sem_getvalue'
    ./libpython2.7.so: undefined reference to `_sem_destroy'
    ./libpython2.7.so: undefined reference to `_sem_wait'
    ./libpython2.7.so: undefined reference to `_sem_init'
    ./libpython2.7.so: undefined reference to `_sem_post'
    ./libpython2.7.so: undefined reference to `_sem_trywait'
    *** Error code 1
    
    Stop in /usr/ports/lang/python27/work/Python-2.7.2/portbld.shared.
    *** Error code 1
    
    Stop in /usr/ports/lang/python27.
    *** Error code 1
    
    Stop in /usr/ports/lang/python27.

By the way, if I # pkg_add -r python27, it will be installed, but I don't know will there be any side effect

It also happened to my other FreeBSD 8.2-i386 -> FreeBSD 9.0-i386 machines. These machines had upgraded using freebsd-update from 7.X->8.1->8.2 before, using GENERIC kernel.

My FreeBSD 8.2-AMD64 -> FreeBSD 9.0-AMD64 computer had compiled okay.
 
I fixed a very similar problem (with Ruby instead of Python, same symptoms otherwise) by softlinking libpthread.so -> libthr.so at /usr/lib.

What was happening was that ld linked to libpthread.a (that, somehow, being a link to libthr.a, contained _sem_init et al); creating the symlink caused the indirect link to libthr.so to appear first at link time (the proper thing to do, I suppose). I don't know why it isn't linking directly to libthr, though.
 
Thanks a lot. The software can be compiled after adding back the missing link. It seems that after upgrade from 8.2-FreeBSD-i386 to 9.0-FreeBSD-i386, the link got removed.

Fresh install of 9.0-FreeBSD-i386 and 8.2-FreeBSD-AMD64 -> 9.0-FreeBSD-AMD64 does not have the missing link problem.
 
Back
Top