pthreads not found with newest xz 5.2.4?
#1
pthreads not found with newest xz 5.2.4?
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:
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:
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:
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:
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
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
08-08-2018, 02:17 PM
#2
Re: pthreads not found with newest xz 5.2.4?
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.
mrthinlysliced
Octane

Posts: 76
Threads: 5
Joined: May 2018
Find Reply
08-08-2018, 04:48 PM
#3
Re: pthreads not found with newest xz 5.2.4?
mrthinlysliced post_id=2100 time=1533746900 user_id=83 Wrote: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
jpstewart
Octane

Posts: 54
Threads: 0
Joined: May 2018
Find Reply
08-08-2018, 04:58 PM
#4
Re: pthreads not found with newest xz 5.2.4?
jpstewart post_id=2101 time=1533747532 user_id=129 Wrote: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" .-)
mrthinlysliced
Octane

Posts: 76
Threads: 5
Joined: May 2018
Find Reply
08-08-2018, 05:04 PM
#5
Re: pthreads not found with newest xz 5.2.4?
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.
jan-jaap
SGI Collector

Posts: 202
Threads: 5
Joined: Jun 2018
Website Find Reply
08-08-2018, 07:46 PM
#6
Re: pthreads not found with newest xz 5.2.4?
jpstewart post_id=2101 time=1533747532 user_id=129 Wrote: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.
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
08-08-2018, 10:06 PM
#7
Re: pthreads not found with newest xz 5.2.4?
mrthinlysliced post_id=2102 time=1533747896 user_id=83 Wrote:
jpstewart post_id=2101 time=1533747532 user_id=129 Wrote: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...
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
08-08-2018, 10:07 PM
#8
Re: pthreads not found with newest xz 5.2.4?
mrthinlysliced post_id=2100 time=1533746900 user_id=83 Wrote: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:
./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:
":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:
-GCM:array_sp=ON
is no longer supported /edit

The only thing I'm really not sure of is if having
Code:
"-Ofast=ip35"

and having
Code:
"-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.
gijoe77
Tezro

Posts: 469
Threads: 28
Joined: Jun 2018
Find Reply
08-08-2018, 11:00 PM


Forum Jump:


Users browsing this thread: 1 Guest(s)