pthreads not found with newest xz 5.2.4?

If you're coding on or porting to IRIX, this is the forum for discussion.
Post Reply
User avatar
gijoe77
Posts: 215
Joined: Fri Jun 22, 2018 9:17 pm

pthreads not found with newest xz 5.2.4?

Post by gijoe77 » Wed Aug 08, 2018 10:17 am

So I'm mucking something up but I just can't seem to figure out what I'm doing wrong - can someone shed some light?

Basically when I use MIPSpro, the configure script doesn't seem to see pthreads support, it does when I use GCC. I'm sort of running on a hunch that if I can get pthreads working, maybe I can get the MIPSpro version to pass all the "gmake check" tests...

Here are my notes:

Code: Select all

from INSTALL:

1.2.2. IRIX

    MIPSpro 7.4.4m has been reported to produce broken code if using
    the -O2 optimization flag ("make check" fails). Using -O1 should
    work.

    A problem has been reported when using shared liblzma. Passing
    --disable-shared to configure works around this. Alternatively,
    putting "-64" to CFLAGS to build a 64-bit version might help too.


export CC=/usr/bin/cc
export CXX=/usr/bin/CC
export CFLAGS="-c99 -diag_suppress 3649 -diag_error 1035 -woff all -Ofast=ip35 -g0 -O1 -n32 -mips4 -OPT:Olimit=0:roundoff=3:IEEE_ar=3:fast_sq=ON:div_split=ON:alias=typed -GCM:array_sp=ON -lfastm -TARG:platform=IP35:proc=r16000 -IPA"
export CXXFLAGS="-ptused -diag_suppress 3649 -woff all -Ofast=ip35 -g0 -O1 -n32 -mips4 -OPT:Olimit=0:roundoff=3:IEEE_ar=3:fast_sq=ON:div_split=ON:alias=typed -GCM:array_sp=ON -lfastm -TARG:platform=IP35:proc=r16000 -IPA"
export CPPFLAGS="-I/usr/nekoware/include -I/usr/local/include -L/usr/nekoware/lib -L/usr/local/lib"

./configure --prefix=/usr/local --libdir=/usr/nekoware/lib --includedir=/usr/nekoware/include --disable-shared 
here is the point in the configure script where "-lpthread" doesn't seem to work

Code: Select all

POSIX threading support:
checking if compiler needs -Werror to reject unknown flags... yes
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
checking for library containing clock_gettime... none required
checking for clock_gettime... yes
checking for pthread_condattr_setclock... no
checking whether CLOCK_MONOTONIC is declared... no
it finishes compiling (or at least it doesn't error out, it uses libtools - I'm still trying to figure out what that's all about), but the last two tests of "gmake check" aren't run because the wrapper script src/xz/xz is not generated


When I build it with GCC it see's "-lpthread", compiles fine, and all nine of the "make check" tests pass

Code: Select all

export CC=/usr/nekoware/gcc-4.7/bin/gcc
export CXX=/usr/nekoware/gcc-4.7/bin/g++
export CFLAGS="-std=gnu99 -g0 -O1 -mips4"
export CXXFLAGS="-g0 -O1 -mips4"
export CPPFLAGS="-I/usr/nekoware/include -I/usr/local/include -L/usr/nekoware/lib -L/usr/local/lib"


./configure --prefix=/usr/local --libdir=/usr/nekoware/lib --includedir=/usr/nekoware/include 

Code: Select all

POSIX threading support:
checking if compiler needs -Werror to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for library containing clock_gettime... none required
checking for clock_gettime... yes
checking for pthread_condattr_setclock... no
checking whether CLOCK_MONOTONIC is declared... no

mrthinlysliced
Posts: 43
Joined: Mon May 14, 2018 9:21 am
Location: Colchester. UK

Re: pthreads not found with newest xz 5.2.4?

Post by mrthinlysliced » Wed Aug 08, 2018 12:48 pm

Hey gijoe,

MIPSPro works fine for me with "O1" and a simple --prefix=BLAH on the configure line - and it picks up pthreads with the "check whether pthreads work with -pthread... yes".

Then I went and added all your CFLAGS + "--disable-shared" - and indeed it no longer picks up pthreads (and of course doesn't build a shared library either).

Maybe give a simple "./configure --prefix=/usr/nekoware" and reduce your CFLAGS? (I use CFLAGS=-mips4 -O1)

In all honesty I don't know what some of the ones you are using there do - with the simple ones above I mentioned the MIPSPro compilation is good and passes all the "make check" tests.

Kr,

Mr Ts.

jpstewart
Posts: 27
Joined: Wed May 23, 2018 11:19 am
Location: Southwestern Ontario, Canada

Re: pthreads not found with newest xz 5.2.4?

Post by jpstewart » Wed Aug 08, 2018 12:58 pm

mrthinlysliced wrote:
Wed Aug 08, 2018 12:48 pm
Then I went and added all your CFLAGS + "--disable-shared" - and indeed it no longer picks up pthreads (and of course doesn't build a shared library either).
Hmm ... that might be because libpthread is only available as a shared library (.so file) on IRIX. There isn't a static libpthread.a to use to create a static libxz.a. It would make a lot of sense that --disable-shared is to blame for the pthreads issue.

Also, as I pointed out the other day, --includedir and --libdir tell configure where to put the output. It looks really odd to me to specify the combination of --prefix, --includedir, and --libdir that the OP had. Just specify --prefix=/usr/local and then the resulting includes and libraries will go into /usr/local/include and /usr/local/lib respectively. I don't think you want to build /usr/local/bin/xz and then put includes and libraries in /usr/nekoware.
SGI: Indigo, Indigo2, Octane, Origin 300
Sun: SPARCstation 20, Ultra 2, Blade 2500, T5240
HP: 9000/380, 425e, C8000
Digital: DECstation 5000/125

mrthinlysliced
Posts: 43
Joined: Mon May 14, 2018 9:21 am
Location: Colchester. UK

Re: pthreads not found with newest xz 5.2.4?

Post by mrthinlysliced » Wed Aug 08, 2018 1:04 pm

jpstewart wrote:
Wed Aug 08, 2018 12:58 pm
Hmm ... that might be because libpthread is only available as a shared library (.so file) on IRIX. There isn't a static libpthread.a to use to create a static libxz.a. It would make a lot of sense that --disable-shared is to blame for the pthreads issue.
Yeah, I thought that might be the case too, so I tried the same CFLAGS from gijoe without the "--disable-shared" - and it still doesn't pick up pthreads. Something in those CFLAGS is "one rice too far" .-)

User avatar
jan-jaap
Posts: 79
Joined: Fri Jun 01, 2018 5:11 pm
Location: Netherlands
Contact:

Re: pthreads not found with newest xz 5.2.4?

Post by jan-jaap » Wed Aug 08, 2018 3:46 pm

It's slightly more subtle than that: the pthreads symbols are implemented in libpthreads, but also present as dummy weak symbols in libc.

That means that when e.g. autoconf tries to figure out what to link to have pthreads work, it can easily be fooled into thinking that nothing needs to be linked to resolve the pthreads symbols, except the resulting binary doesn't work. Usually you can work around this by explicitly telling autoconf the location of the pthreads lib to link, or by setting an autoconf cache variable to the desired value before calling configure, causing it to skip the test.

User avatar
gijoe77
Posts: 215
Joined: Fri Jun 22, 2018 9:17 pm

Re: pthreads not found with newest xz 5.2.4?

Post by gijoe77 » Wed Aug 08, 2018 6:06 pm

jpstewart wrote:
Wed Aug 08, 2018 12:58 pm
Also, as I pointed out the other day, --includedir and --libdir tell configure where to put the output. It looks really odd to me to specify the combination of --prefix, --includedir, and --libdir that the OP had. Just specify --prefix=/usr/local and then the resulting includes and libraries will go into /usr/local/include and /usr/local/lib respectively. I don't think you want to build /usr/local/bin/xz and then put includes and libraries in /usr/nekoware.
Ah yeah thanks for reminding me - I was just going through all the compiling notes of mine, decided to just throw the entire sink (with water) of all my previous successful compilation notes at it, the one I posted was my last try where I forgot about that and included the "--includedir" and "--libdir" options. I have literally dozens of separate notes that I need to consolidate.

User avatar
gijoe77
Posts: 215
Joined: Fri Jun 22, 2018 9:17 pm

Re: pthreads not found with newest xz 5.2.4?

Post by gijoe77 » Wed Aug 08, 2018 6:07 pm

mrthinlysliced wrote:
Wed Aug 08, 2018 1:04 pm
jpstewart wrote:
Wed Aug 08, 2018 12:58 pm
Hmm ... that might be because libpthread is only available as a shared library (.so file) on IRIX. There isn't a static libpthread.a to use to create a static libxz.a. It would make a lot of sense that --disable-shared is to blame for the pthreads issue.
Yeah, I thought that might be the case too, so I tried the same CFLAGS from gijoe without the "--disable-shared" - and it still doesn't pick up pthreads. Something in those CFLAGS is "one rice too far" .-)
I figured out it was turning off all warning that was causing the problem in CFLAGS. I would have never thought "-woff all" would actually break things...

User avatar
gijoe77
Posts: 215
Joined: Fri Jun 22, 2018 9:17 pm

Re: pthreads not found with newest xz 5.2.4?

Post by gijoe77 » Wed Aug 08, 2018 7:00 pm

mrthinlysliced wrote:
Wed Aug 08, 2018 12:48 pm
In all honesty I don't know what some of the ones you are using there do
That makes two of us HAHA!

But basically here is where I came up with those.

I have old notes from nekochan where I was told to compile using this:

Code: Select all

./configure '--prefix=/usr/nekoware' --mandir=/usr/nekoware/man 'CC=/usr/bin/c99' 'CFLAGS= -diag_suppress 3649 -diag_error 1035 -DIP32 -DIRIX -O3 -n32 -mips4 -OPT:Olimit=0:roundoff=3 -TARG:platform=IP27:proc=r10000 -L/usr/nekoware/lib -L/usr/local/lib -L/usr/lib32 -I/usr/nekoware/include ' 'CPPFLAGS= -diag_suppress 3649 -diag_error 1035 -DIP32 -DIRIX -I/usr/nekoware/include/freetype2 -I/usr/nekoware/include/ -I/usr/nekoware/include/SDL ' 'CXXFLAGS= -ptused -diag_suppress 3649 -diag_error 1035 -DIP32 -DIRIX -O3 -n32 -mips4 -OPT:Olimit=0:roundoff=3 -TARG:platform=IP27:proc=r10000 -I/usr/nekoware/include ' 'CXX=/usr/bin/CC' 'LDFLAGS= -rpath /usr/nekoware/lib -L/usr/nekoware/lib -L/usr/lib32/mips4 -L/usr/local/lib -L/usr/lib32 -lfastm -lm '
There was a post a few pages long on Nekochan about optimizing xmame (can't find a working archive link, but I think Foetz gave me alot of the optimizations that I'm currently using, thee was a bunch of discussion in that thread what does what - I have it saved somewhere), the

Code: Select all

":IEEE_ar=3:fast_sq=ON:div_split=ON:alias=typed -GCM:array_sp=ON -lfastm "
I got from this site https://www.astro.ku.dk/~aake/optimize/, but I don't know if these optimizations still apply or if they are too old.

edit: looks like

Code: Select all

 -GCM:array_sp=ON
is no longer supported /edit

The only thing I'm really not sure of is if having

Code: Select all

"-Ofast=ip35"

and having

Code: Select all

 "-03 -TARG:platform=IP35:proc=r16000 -OPT:Olimit=0:roundoff=3"

is redundant or not, I'm still looking into it, but I did notice a little bit of a speed improvment in some emulators with my current CFLAGS so I sort of just kept them.

Post Reply