After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 739201 - openh264: configure check requires -pthread on ubuntu (broken compiler defaults ?)
openh264: configure check requires -pthread on ubuntu (broken compiler defaul...
Status: RESOLVED NOTGNOME
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-26 08:52 UTC by Edward Hervey
Modified: 2018-05-04 10:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
config.log (349.80 KB, text/plain)
2014-10-28 10:52 UTC, Sebastian Dröge (slomo)
Details
config.log (357.06 KB, text/plain)
2014-10-28 10:55 UTC, Sebastian Dröge (slomo)
Details

Description Edward Hervey 2014-10-26 08:52:39 UTC
-bad's config.log:

configure:46562: *** checking feature: openh264 library ***
configure:46566: *** for plug-ins: openh264 ***
configure:46615: checking for WelsSnprintf in -lopenh264
configure:46640: ccache g++ -o conftest  -Wall -g -O2 -m64  -Wall -g -O2 -m64  -Wall -g -O2 -m64   -Wno-error    -Wno-error  -L/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib  -m64  -m64  -m64  conftest.cpp -lopenh264   >&5
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `sem_init'
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `sem_destroy'
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `sem_timedwait'
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `pthread_create'
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `sem_post'
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `sem_trywait'
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `sem_wait'
/var/lib/jenkins/workspace/cerbero-debian/workdir/dist/linux_x86_64/lib/libopenh264.so: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
configure:46640: $? = 1
Comment 1 Edward Hervey 2014-10-26 08:55:54 UTC
hmm... this might actually be because of some broken pthread detection on that debian machine, we end up with PTHREAD_LIBS=''

...
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 whether to check for GCC pthread/shared inconsistencies... yes
checking whether -pthread is sufficient with -shared... yes
checking for unistd.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for stdint types... stdint.h (shortcircuit)
make use of stdint.h in _stdint.h (assuming C99 compatible system)
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
...

Would this maybe be because the check for -lpthread requirement is done on the C compiler and not the C++ compiler ?
Comment 2 Sebastian Dröge (slomo) 2014-10-26 10:47:52 UTC
What exactly is required to give to the C++ compiler here? It sounds like the C compiler can find the symbols without linking to any libs at all... but the C++ compiler needs to use -lpthread? That seems wrong.

What exactly is the configure check testing there?
Comment 3 Tim-Philipp Müller 2014-10-26 10:50:46 UTC
Note that PTHREAD_CFLAGS is "-pthread" here on my debian sid machine, but PTHREAD_CFLAGS isn't used anywhere (even if just gcc was used).
Comment 4 Edward Hervey 2014-10-27 07:36:39 UTC
content of config.log:

configure:24258: checking whether pthreads work with -pthread
configure:24343: ccache gcc -std=gnu99 -o conftest  -Wall -g -O2 -m64  -Wall -g -O2 -m64  -Wall -g -O2 -m64   -Wno-error  -pthread   -Wno-error  -L/var/lib/jenkins/workspace/cerber
conftest.c: In function 'main':
conftest.c:45:1: warning: missing braces around initializer [-Wmissing-braces]
 pthread_t th; pthread_attr_t attr = {0, };
 ^
conftest.c:45:1: warning: (near initialization for 'attr.__size') [-Wmissing-braces]
configure:24343: $? = 0
configure:24352: result: yes


So on this machine (debian buildslave), we *need* -pthread. Looking more in details at how other checks for libraries that also require -pthread work .. they suceed because .pc provides -pthread in the CFLAGS.

If only openh264 had a .pc ...
Comment 5 Sebastian Dröge (slomo) 2014-10-28 08:58:15 UTC
(In reply to comment #4)

> If only openh264 had a .pc ...

It now has :)
Comment 6 Sebastian Dröge (slomo) 2014-10-28 10:52:50 UTC
Created attachment 289511 [details]
config.log

config.log for when it works
Comment 7 Sebastian Dröge (slomo) 2014-10-28 10:55:56 UTC
Created attachment 289512 [details]
config.log

this time with gcc instead of clang
Comment 8 Edward Hervey 2014-10-28 11:16:29 UTC
so by the looks of things ... g++ on ubuntu is a bit of a trainwreck : https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201

Essentially it won't link libpthread by default if you use -pthread

Unsure what workaround we could use...
Comment 9 Olivier Crête 2018-05-04 10:01:50 UTC
No one has complained in 4 years so hopefully Ubuntu fixed their compiler by now. Please re-open if it's still an issue.