Discussion:
[Openexr-user] OpenEXR 1.6.1 build problem (Linux): "configure:
Frank Thommen
2009-08-30 15:00:16 UTC
Permalink
Hi,

I'm currently running into problems building OpenEXR 1.6.1 on CentOS 5.3
(fully updated) on a x86_64 PC. I'm installing OpenEXR as a
prerequisite for Blender (http://www.blender.org). The error appears
during configure:

# ./configure --with-ilmbase-prefix=/usr/struct/pack/openexr-1.6 \
--prefix=/usr/struct/pack/openexr-1.6 \
LD_LIBRARY_PATH=/usr/struct/pack/openexr-1.6/
[...]
using ilmbase-prefix to set ILMBASE_CXXFLAGS, ILMBASE_LDFLAGS and
ILMBASE_LIBS:
ILMBASE_CXXFLAGS = -I/usr/struct/pack/openexr-1.6/include/OpenEXR
ILMBASE_LDFLAGS = -L/usr/struct/pack/openexr-1.6/lib -L/usr/lib64
-L/usr/local/lib
ILMBASE_LIBS = -lImath -lHalf -lIex -lIlmThread
checking for IlmBase... no
*** Could not run the IlmBase test program, checking why...
*** The IlmBase test program could be compiled, but could not be
dynamically.
*** or statically linked.
***
*** Make sure the LDFLAGS points to the location of the IlmBase library.
*** (e.g. -L/usr/local/lib).
*** If the run-time linker is not finding IlmBase, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location Also, make sure you have run ldconfig if that
*** is required on your system.
***
*** Flags used by the test:
*** cflags: -g -O2 -I/usr/struct/pack/openexr-1.6/include/OpenEXR
*** ldflags: -L/usr/struct/pack/openexr-1.6/lib -L/usr/lib64
-L/usr/local/lib
***
*** You can also run configure with --disable-ilmbasetest to skip this test.
configure: error: Could not compile IlmBase test program.
#

(the full output of configure can be seen at http://pastie.org/599517).
ilmbase 1.0.1 is installed correctly (with /usr/struct/pack/openexr-1.6/
as prefix) and built w/o errors (including `make check`).

In config.log I find the following relevant entries:

[...]
configure:20450: checking for IlmBase
configure:20491: g++ -o conftest -g -O2
-I/usr/struct/pack/openexr-1.6/include/OpenEXR
-L/usr/struct/pack/openexr-1.6/lib -L/usr/lib64 -L/usr/local/lib
conftest.cc -lImath -lHalf -lIex -lIlmThread >&5
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_init'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_destroy'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`pthread_create'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_post'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_trywait'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_getvalue'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_wait'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`pthread_join'
collect2: ld returned 1 exit status
[...]

The full config.log can be seen at http://pastie.org/599523. I could
not find any helfpul information on the web, but maybe someone of you
has an idea, how this problem could be fixed or if there is a workaround.

Cheers & thanks

frank
Ger Hobbelt
2009-08-30 16:46:15 UTC
Permalink
Off the cuff, by only looking at the functions that are reported
missing by the linker, my first guess would be that the configure
script couldn't find a viable pthread library. This most probably
happened to the ./configure for IlmBase as IlmThread wraps those, the
effect becoming 'visible' once you compile&link OpenEXR itself..

Also, check to make sure IlmBase and OpenEXR are both build with
'--enable-threading' turned on (this is the default).
Post by Frank Thommen
configure:20491: g++ -o conftest -g -O2
-I/usr/struct/pack/openexr-1.6/include/OpenEXR
-L/usr/struct/pack/openexr-1.6/lib -L/usr/lib64 -L/usr/local/lib conftest.cc
 -lImath -lHalf -lIex -lIlmThread >&5
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_init'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_destroy'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`pthread_create'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_post'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_trywait'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_getvalue'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_wait'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`pthread_join'
--
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web: http://www.hobbelt.com/
http://www.hebbut.net/
mail: ***@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------
Frank Thommen
2009-08-30 17:14:22 UTC
Permalink
Hi Ger,

thanks a lot
Post by Ger Hobbelt
Off the cuff, by only looking at the functions that are reported
missing by the linker, my first guess would be that the configure
script couldn't find a viable pthread library. This most probably
happened to the ./configure for IlmBase as IlmThread wraps those, the
effect becoming 'visible' once you compile&link OpenEXR itself..
There is libpthread.so in /usr/lib and /usr/lib64. I assume these
should be found by configure ;-). Setting LD_LIBRARY_PATH to /usr/lib64
didn't help.
Post by Ger Hobbelt
Also, check to make sure IlmBase and OpenEXR are both build with
'--enable-threading' turned on (this is the default).
I made sure by adding this option to my configure commands, but the
error is still there.
Post by Ger Hobbelt
configure:20491: g++ -o conftest -g -O2
Post by Frank Thommen
-I/usr/struct/pack/openexr-1.6/include/OpenEXR
-L/usr/struct/pack/openexr-1.6/lib -L/usr/lib64 -L/usr/local/lib conftest.cc
-lImath -lHalf -lIex -lIlmThread >&5
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_init'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_destroy'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`pthread_create'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_post'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_trywait'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_getvalue'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`sem_wait'
/usr/struct/pack/openexr-1.6/lib/libIlmThread.so: undefined reference to
`pthread_join'
I have no software development knowledge and therefore these error
messages are somehow cryptic to me. But I see, that libIlmThread.so
does not refer (link?) to pthread.so at all:

openexr-1.6 > ldd ../../lib/libIlmThread.so
libIex.so.6 => /usr/struct/pack/openexr-1.6/lib/libIex.so.6
(0x00002ae626943000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002ae626b60000)
libm.so.6 => /lib64/libm.so.6 (0x00002ae626e80000)
libc.so.6 => /lib64/libc.so.6 (0x00002ae627104000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002ae62745a000)
/lib64/ld-linux-x86-64.so.2 (0x00000031e8c00000)
openexr-1.6 >


Could that be the problem and is there a way to fix it?


frank
Frank Thommen
2009-09-02 16:28:24 UTC
Permalink
Hi Ger,

sorry for not keeping up, I was busy with other projects...
hmmmm... haven't built EXR on Linux for a long time myself - let's see...
when you run the ./configure for IlmBase, it reports back what's
seeing and going to use. A part of output concerns threading; here's
the snippet from my 64-bit Ubuntu dev box; the point is that there
should be at least one 'yes' in this section ;-)
---snip---
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
---snip---
In my ./configure ouput for ilmbase (1.0.1) I have exactly the same
lines as you listed above.
I'm curious what your platform is saying there; before we dive any
deeper this 'detection code' in the configure script should give us an
idea where to poke next.
After some additional searching I found this page:
http://www.mail-archive.com/openexr-***@nongnu.org/msg00690.html (I
hadn't searched in the devel list previously). It describes exactly my
problem and after adding '-lrt -fPIC' to gcc and g++, openexr compiled
and built w/o error messages.
I have no software development knowledge and therefore these error messages
are somehow cryptic to me. But I see, that libIlmThread.so does not refer
You're doing fine for a non-dev. Keep it up ;-)
openexr-1.6 > ldd ../../lib/libIlmThread.so
libIex.so.6 => /usr/struct/pack/openexr-1.6/lib/libIex.so.6
(0x00002ae626943000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002ae626b60000)
libm.so.6 => /lib64/libm.so.6 (0x00002ae626e80000)
libc.so.6 => /lib64/libc.so.6 (0x00002ae627104000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002ae62745a000)
/lib64/ld-linux-x86-64.so.2 (0x00000031e8c00000)
openexr-1.6 >
Could that be the problem and is there a way to fix it?
That's the issue; the tough question is two-part: (1) where did the
process screw up exactly --> (2) once we know the 'where' in more
detail, what can we do to kick it into cooperating.
... oh dang. dang. dang. I forgot. Had this issue already /several/
times in a row with other folks on Linux (it's due to the Linux
package installer systems being geared a bit too much to 'using' IMO;
creating a bit of a bother when 'users' take the obvious step thinking
"heck, what's so hard in typing './configure' and 'make install'
anyway?" And then they get a nasty surprise they should _not_ have
got. I got a few nasty surprises myself when I returned to this
platform after several years. But I digress.)
your system has a 'package installer' of some sort where you select
the 'packages' you want installed on your system, e.g. 'pthreads',
'gcc compiler', 'open office', etc.etc.
Now here's the nasty bit: I bet myself a bottle of good single malt
you've got 'pthreads' or 'libpthreads' or whatever they'll call it in
your package manager (e.g. on Ubuntu: System>Administration>Synaptic
Package Manager) checked as 'already installed' in that manager
(that's why you could find that libpthreads.so loadable library) but
you (and this is my bet) do /not/ have the 'libpthreads-dev' package
installed /as well/ (should be called the same with ' dev' or '-dev'
something appended to the name). Maybe it even comes with a
description where it says that the 'dev' package will install the
'header files'. Tick that one and install, because /that's/ what
./configure is looking for too: to build a piece of software which
depends on a library of any sort, in Linux nowadays you need both the
'libraryXYZ' _plus_ the 'libraryXYZ-dev' packages installed or you get
a situation very much like this one: everything looks good, meanwhile
nothing builds, linker errors galore and you're left pulling your
hair.
If that 'pthreads-dev' package was not yet installed, and now that it
is, rerun all ./configure scripts (IlmBase, OpenEXR, etc.) and 'make',
'make check' and 'make install' commands like you did before, so that
the newfound pthreads 'header files' can be detected by the configure
scripts and alter the OpenEXR build instructions accordingly.
... do I win my bet or did I loose? ;-)
I'm sorry, but you lost the bet :-)). In CentOS, libpthread comes with
the glibc and glibc-devel packages, but the glibc-headers with all
headerfiles was also installed. So I think it was really the missing
options and the old/not updated autoconf script that comes with OpenEXR.
Don't be sad, there will other bets to win in the future :-).

For the single malt: An old Cragganmore would be perfect. Yummy!


Thanks a lot for your help. Now I'll go on and try to solve the Blender
build error messages :-(

frank
Ger Hobbelt
2009-09-03 18:50:11 UTC
Permalink
searched in the devel list previously).  It describes exactly my problem and
after adding '-lrt -fPIC' to gcc and g++, openexr compiled and built w/o
error messages.
I'm sorry, but you lost the bet :-)). In CentOS, libpthread comes with the
glibc and glibc-devel packages, but the glibc-headers with all headerfiles
was also installed. So I think it was really the missing options and the
old/not updated autoconf script that comes with OpenEXR. Don't be sad,
there will other bets to win in the future :-).
My bad. Hadn't thought of the libtool stuff. Too bad about the bet but
I'll have one anyway, so as to lift my spirits. ;-) (A Cragganmore you
say? Have to go and test that one...)

Good to hear that you found the solution that works for you.

Take care,

Ger
--
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web: http://www.hobbelt.com/
http://www.hebbut.net/
mail: ***@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------
Loading...