Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2017 01:20:54 +0000
From:      Derrick McKee <derrick.mckee@gmail.com>
To:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Missing pthread support for custom libc
Message-ID:  <CAJoBWHw_hAXCn30VW3Qbk4GbhhHiyJWvten5CoSGKO4OWXooJg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

I've compiled libc using a custom version of clang, and it seems to be
missing pthread support.  When I try to compile Firefox and use my version
of libc, I get the following error:

checking for pthread_create in -lpthreads... no
checking for pthread_create in -lpthread... no
checking for pthread_create in -lc_r... no
checking for pthread_create in -lc... no
configure: error: --with-pthreads specified for a system without pthread
support
DEBUG: <truncated - see config.log for full output>
DEBUG: int main() {
DEBUG: pthread_create()
DEBUG: ; return 0; }
DEBUG: configure:10603: checking for pthread_create in -lc
DEBUG: configure:10622: /home/dmc/install/bin/clang -std=gnu99 -o conftest
-O2 -pipe -pthread -static -g -mllvm -hexsafe-analysis
-Wno-expansion-to-defined -nostdlib -I/usr/src/include -D__GNUC_VA_LIST
-D_VA_LIST_DECLARED /usr/src/lib/csu/amd64/crt*.o -O3 -DLIBICONV_PLUG
-fstack-protector -fno-strict-aliasing -fno-strict-aliasing
-ffunction-sections -fdata-sections -fno-math-errno -Qunused-arguments
-D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH_TR1 -D_DECLARE_C99_LDBL_MATH
-isystem/usr/local/include -DLIBICONV_PLUG -pthread -L/usr/src/lib/libc++
-L/usr/src/lib/libc -L/usr/lib -lc++ -lc -L/usr/local/lib
-Wl,-rpath,/usr/local/lib/firefox -Wl,--as-needed -fstack-protector
-Wl,-z,noexecstack -Wl,-z,text conftest.c -lc 1>&5
DEBUG: /tmp/conftest-e31ca2.o: In function `main':
DEBUG:
/usr/ports/www/firefox/work/firefox-50.1.0/obj-x86_64-unknown-freebsd11.0/configure:10618:
undefined reference to `pthread_create'
DEBUG: clang-4.0: error: linker command failed with exit code 1 (use -v to
see invocation)
DEBUG: configure: failed program was:
DEBUG: #line 10611 "configure"
DEBUG: #include "confdefs.h"
DEBUG: /* Override any gcc2 internal prototype to avoid an error. */
DEBUG: /* We use char because int might match the return type of a gcc2
DEBUG: builtin and then its argument prototype would still apply. */
DEBUG: char pthread_create();
DEBUG:
DEBUG: int main() {
DEBUG: pthread_create()
DEBUG: ; return 0; }
DEBUG: configure: error: --with-pthreads specified for a system without
pthread support

I've added -pthread to both CFLAGS and LDFLAGS when I compile libc, and you
can see that it is included when I attempt to compile Firefox.  Any ideas
on what I am missing?  Thanks.

- Derrick McKee
-- 
Derrick McKee
Ph.D. Student at Purdue University



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJoBWHw_hAXCn30VW3Qbk4GbhhHiyJWvten5CoSGKO4OWXooJg>