You are not logged in.

#1 2017-10-03 20:32:20

orangecake
Member
Registered: 2017-10-03
Posts: 4

Building qemu issues.

I am currently trying to build qemu from the official testing package.

But I currently get the following error while building:

   LINK    qemu-ga
/usr/bin/ld: libqemuutil.a(qemu-thread-posix.o): undefined reference to symbol 'pthread_setname_np@@GLIBC_2.12'
/usr/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:447: qemu-ga] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
makepkg  41.00s user 4.96s system 102% cpu 44.655 total

I am also currently using the testing repo.

Offline

#2 2017-10-03 20:52:12

orangecake
Member
Registered: 2017-10-03
Posts: 4

Re: Building qemu issues.

Huh, this is strange. Last time I recompiled qemu 2.10.0 it successfully built, but now I am getting the same error as bulding 2.10.1.
I am not sure but I guess some package update has caused some changes in the build system somehow, as "-pthread" is probably missing while linking.

Offline

#3 2017-10-03 21:38:28

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Building qemu issues.

Do you have custom LDFLAGS?

Offline

#4 2017-10-03 21:41:26

orangecake
Member
Registered: 2017-10-03
Posts: 4

Re: Building qemu issues.

brebs wrote:

Do you have custom LDFLAGS?

No? I just checked the LDFLAGS which has been set by makepkg, which shows:
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"

Well, I fixed this by adding "-pthread" to LDFLAGS in the PKGBUILD file. Still, I am not sure if this is the right way to fix this, as the package maintainer seems to be able to build the package without hacks.

Offline

#5 2017-10-04 15:15:43

orangecake
Member
Registered: 2017-10-03
Posts: 4

Re: Building qemu issues.

Oh boi, this search for a fix was intense. I've traced down the issue to the following command:

> pkg-config --libs gthread-2.0
-lgthread-2.0 -lglib-2.0

As you can see that "-pthread" is missing, hence qemu doesn't link with pthread. Then I've noticed that I have different packages of glib installed. I still had glib installed instead of glib2 which also includes a patch "libs.diff" which has these additions:

+# HACK
+glib_conf.set('G_THREAD_LIBS', '-pthread')
+glib_conf.set('G_THREAD_CFLAGS', '-pthread')
+glib_conf.set('G_MODULE_LDFLAGS', '-Wl,--export-dynamic')
+glib_conf.set('PCRE_REQUIRES', 'libpcre')

So I fixed this by installing glib2 which replaced glib. I am not sure why glib didn't get automatically upgraded.

Offline

Board footer

Powered by FluxBB