multiple definition of `__i686.get_pc_thunk.bx'

I needed to compile postgresql from source on debian box. I obtained source/dsc/diff files and tried to build debian package:

$ apt-get source postgresql

$ cd postgresql-7.4.7

$ dpkg-buildpackage -rfakeroot -uc -us
And during compilation i got following error:
/usr/lib/libc_nonshared.a(elf-init.oS)(.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0): In function `__i686.get_pc_thunk.bx':
: multiple definition of `__i686.get_pc_thunk.bx'
../ecpglib/typename.o(.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0):
/tmp/postgres/postgresql-7.4.7/build-tree/postgresql-7.4.7/src/interfaces/ecpg/ecpglib/typename.c:18: first defined here
collect2: ld returned 1 exit status

In google i found a few links about such errors. It seemed like it was gcc related issue. From some maillist archive/forum:

« After a little research I tried upgrading from gcc-3.4 to gcc-3.5, which is the latest version currently available in debian stable. The error persisted. After that I tried upgrading to gcc-4.0 out of debian testing, which solved the issue. »

I was running gcc 3.3.5 on that box, so i decided to try with gcc 3.4.4, which is also available in Debian Sarge. The outcome was the same. I changed symlink /usr/bin/gcc from /usr/bin/gcc-3.3 to /usr/bin/gcc-3.4 - stil no luck. And after a dozen of failed compilations with different paramenters set/unset i noticed that it uses /usr/bin/i386-linux-gcc as a compiler. Which was a symlink to /usr/bin/i386-linux-gcc-3.3 (which was a symlink to /usr/bin/gcc-3.3)

I changed it to /usr/bin/i386-linux-gcc-3.4 and successfully compiled postgresql :)

3 responses to «multiple definition of `__i686.get_pc_thunk.bx'»

Post a comment