Page 1 of 2

Glib failing thread test

Posted: Thu Apr 13, 2017 12:25 pm
by praetor242
I'm trying to get glib 2.52 compiled, but it fails one of it's tests when it configures. It's a test looking for pthread.h. I've tried passing -lpthread to gcc and --enable-thread=posix to ./configure, but no love. I talked to the glib devs on IRC (which are really nice guys) and they pointed me to the particular test that is failing.

https://github.com/GNOME/glib/blob/master/configure.ac#L1852-L1865

But they said I'd have to modify the test to pass on IRIX, but C is not my best language :(

Any ideas how to get it to pass?

Re: Glib failing thread test

Posted: Thu Apr 13, 2017 12:42 pm
by foetz
look into configure.log for the exact error

Re: Glib failing thread test

Posted: Thu Apr 13, 2017 12:47 pm
by praetor242
This is where it fails in ./configure

#include <pthread.h>
| int
| main ()
| {
| pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
| ;
| return 0;
| }
configure:26696: result: none available
configure:26698: error: No thread implementation found.

Re: Glib failing thread test

Posted: Thu Apr 13, 2017 5:49 pm
by foetz
check the compile line. it's likely using the wrong libs

Re: Glib failing thread test

Posted: Thu Apr 13, 2017 7:25 pm
by praetor242
It says it's using pthread.h, and there is a pthread.h in /usr/include. Not sure what I should change it to.

Re: Glib failing thread test

Posted: Thu Apr 13, 2017 8:52 pm
by foetz
nothing, have a look at the configure.log again and search for the link line

Re: Glib failing thread test

Posted: Fri Apr 14, 2017 1:11 pm
by jpstewart
I don't think the configure script will figure out the right libraries/flags needed for pthreads on IRIX. Rather than trying to patch the configure script, I'd just manually add '-lpthread' to either LIBS or LDFLAGS before configuring:

Code: Select all

LIBS="$LIBS -lpthread" ./configure ...

(Of course, exact syntax will depend on which shell you're using.)

Or, as foetz suggests, post the exact compile/link line that's failing and we'll help you diagnose it.

Re: Glib failing thread test

Posted: Sun Apr 16, 2017 12:50 pm
by praetor242
I have to add "-L/usr/local/lib" or else configure doesn't see gettext. But when I add "-lpthread" to LDFLAGS, it no longer sees gettext. Not sure why :( this is so aggravating. I know what the fix for this is, but it's not cooperating D:

Re: Glib failing thread test

Posted: Mon Apr 17, 2017 6:12 pm
by praetor242
I've put the full config.log on github for you guys to look at.

It's at https://gist.github.com/gwfisher/e1426d7bd9795195dab88596657b5cc2

I've tried adding -lpthread to LDFLAGS, and still no love :( I've tried it with MIPSPro and gcc 4.7 and it keeps telling me it can't find a threading implementation. Not sure.

Re: Glib failing thread test

Posted: Mon Apr 17, 2017 8:02 pm
by foetz
that's the gcc log but the mipspro log would be the interesting one

Re: Glib failing thread test

Posted: Mon Apr 17, 2017 8:05 pm
by praetor242
I can post a mipspro one, but it gives a ton of warnings.

Re: Glib failing thread test

Posted: Mon Apr 17, 2017 8:56 pm
by praetor242
Here is the MIPSPro version. Configure runs fine with MIPSPro. It finds the threading libraries, but when you gmake it, it won't compile.

https://gist.github.com/gwfisher/b1451516cd8f34b5358630ef6f5411fd

Re: Glib failing thread test

Posted: Tue Apr 18, 2017 11:09 am
by foetz
praetor242 wrote:Here is the MIPSPro version. Configure runs fine with MIPSPro. It finds the threading libraries, but when you gmake it, it won't compile.

okay then we'd need to see those errors

Re: Glib failing thread test

Posted: Tue Apr 18, 2017 12:58 pm
by jpstewart
I'm not surprised current GLib won't build with MIPS Pro. I encountered problems three years ago with GLib 2.31 (and up). I mentioned it briefly in an old post. Personally, I wouldn't bother trying to build GLib with MIPS Pro anymore, to be frank.

However, it should work with GCC. The log from praetor242 shows GCC having "unknown type name" errors in GCC's own include-fixed/pthread.h header. The specific error message suggests that praetor242 is using a GCC package (with "fixed" headers) from a newer version of IRIX than what is installed and running on his machine. Those missing types are not defined on my 6.5.22 machines, but are defined on the one that's running 6.5.29. (I don't know exactly where in between they were added.) So it looks to me like praetor242 is (inadvertently) mixing headers from two IRIX versions: his own, and those on which GCC was built.

That can be fixed by upgrading the build system to the same version of IRIX on which GCC was compiled, or compiling his own GCC on his current version of IRIX. If one wants to get really creative, it's theoretically possible to alter the installed GCC "fixed" headers to match the running system, but who knows what else that might break.

In short, it's just a mis-match between two versions of pthread.h.

Re: Glib failing thread test

Posted: Tue Apr 18, 2017 3:23 pm
by praetor242
That makes sense jpstewart. I'll compile my own GCC. My O2 is running 6.5.22. But yeah, no amount of futzing with MIPSPro will get it to work. I talked to the glib devs and they said it's best to just build it with gcc (and then gave me a million reasons why)

Thanks!