Hello,

The problem is that function pthread_setname_np is not available
in older versions of glibc.
We can use autoconf to solve this issue.
We can add a check to the configure.ac - something like:
AC_CHECK_FUNCS(pthread_setname_np)
And then, in debug.c, use conditional compiling:
#ifdef HAVE_PTHREAD_SETNAME_NP
....
#else
....
#endif

I will try to fix this and I will propose a pull request with a patch.

Best regards

Jan Černý
Security Technologies | Red Hat, Inc.

----- Original Message -----
> From: "Martin Preisler" <[email protected]>
> To: "Andreas Krause" <[email protected]>
> Cc: [email protected], "Jan Cerny" <[email protected]>
> Sent: Tuesday, March 1, 2016 5:42:20 PM
> Subject: Re: [Open-scap] Compile issues on RHEL5+SLES11
> 
> ----- Original Message -----
> > From: "Andreas Krause" <[email protected]>
> > To: [email protected]
> > Sent: Tuesday, March 1, 2016 9:59:03 AM
> > Subject: [Open-scap] Compile issues on RHEL5+SLES11
> > 
> > Hi there,
> > 
> > I'm running into difficulties when compiling openscap-1.2.8 on older
> > Linux distributions like RHEL5 or SLES11.
> > 
> > First issue:
> > 
> > /bin/sh ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
> > -I../..  -I/usr/include/libxml2 -DOSCAP_THREAD_SAFE -D_REENTRANT
> > -D_POSIX_PTHREAD_SEMANTICS -I./public -I../../src -I../../src/common
> > -I../../src/common/public -I../../src/source/public -I./adt -I./probes
> > -I./probes/public -I./probes/SEAP/public
> > -I../../src/OVAL/probes/SEAP/generic -I../../src/XCCDF_POLICY/public
> > -I../../src/XCCDF/public -I../../src/CPE/public -DSEAP_MSGID_BITS=32
> > -DSEAP_THREAD_SAFE -DOVAL_PROBE_DIR='"/usr/libexec/openscap"'   -O2 -g
> > -m64 -mtune=generic -pipe -std=c99 -W -Wall -Wnonnull -Wshadow -Wformat
> > -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas
> > -D_GNU_SOURCE -DOSCAP_THREAD_SAFE -D_POSIX_C_SOURCE=200112L
> > -Wno-unused-function -MT oval_session.lo -MD -MP -MF
> > .deps/oval_session.Tpo -c -o oval_session.lo oval_session.c
> > libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../..
> > -I/usr/include/libxml2 -DOSCAP_THREAD_SAFE -D_REENTRANT
> > -D_POSIX_PTHREAD_SEMANTICS -I./public -I../../src -I../../src/common
> > -I../../src/common/public -I../../src/source/public -I./adt -I./probes
> > -I./probes/public -I./probes/SEAP/public
> > -I../../src/OVAL/probes/SEAP/generic -I../../src/XCCDF_POLICY/public
> > -I../../src/XCCDF/public -I../../src/CPE/public -DSEAP_MSGID_BITS=32
> > -DSEAP_THREAD_SAFE -DOVAL_PROBE_DIR=\"/usr/libexec/openscap\" -O2 -g
> > -m64 -mtune=generic -pipe -std=c99 -W -Wall -Wnonnull -Wshadow -Wformat
> > -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas
> > -D_GNU_SOURCE -DOSCAP_THREAD_SAFE -D_POSIX_C_SOURCE=200112L
> > -Wno-unused-function -MT oval_session.lo -MD -MP -MF
> > .deps/oval_session.Tpo -c oval_session.c  -fPIC -DPIC -o
> > .libs/oval_session.o
> > oval_session.c: In function 'oval_session_export':
> > oval_session.c:422: error: 'PATH_MAX' undeclared (first use in this
> > function)
> > oval_session.c:422: error: (Each undeclared identifier is reported only
> > once
> > oval_session.c:422: error: for each function it appears in.)
> > oval_session.c:422: warning: unused variable 'pwd'
> > make[4]: *** [oval_session.lo] Error 1
> > make[4]: Leaving directory `/usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL'
> > make[3]: *** [all-recursive] Error 1
> > make[3]: Leaving directory `/usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL'
> > make[2]: *** [all-recursive] Error 1
> > make[2]: Leaving directory `/usr/src/redhat/BUILD/openscap-1.2.8/src'
> > make[1]: *** [all-recursive] Error 1
> > make[1]: Leaving directory `/usr/src/redhat/BUILD/openscap-1.2.8'
> > make: *** [all] Error 2
> > 
> > 
> > I've managed to fix this by adding "#include <linux/limits.h>" to
> > src/OVAL/oval_session.c
> > 
> > 
> > Second issue:
> > /bin/sh ../../../libtool  --tag=CC   --mode=link gcc  -O2 -g -m64
> > -mtune=generic -pipe -std=c99 -W -Wall -Wnonnull -Wshadow -Wformat
> > -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas
> > -D_GNU_SOURCE -DOSCAP_THREAD_SAFE -D_POSIX_C_SOURCE=200112L
> > -Wno-unused-function -I/usr/include/libxml2   -DOSCAP_THREAD_SAFE
> > -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DTHREAD_SAFE -DSEAP_THREAD_SAFE
> > -I../../../src -I../../../src/common -I../../../src/common/public
> > -I../../../src/source/public -I../../../src/OVAL
> > -I../../../src/OVAL/public -I../../../src/OVAL/probes/public
> > -I../../../src/OVAL/probes/SEAP/public -I../../../lib   -o
> > probe_system_info system_info.o probe/libprobe.la  -lbz2
> > libtool: link: gcc -O2 -g -m64 -mtune=generic -pipe -std=c99 -W -Wall
> > -Wnonnull -Wshadow -Wformat -Wundef -Wno-unused-parameter
> > -Wmissing-prototypes -Wno-unknown-pragmas -D_GNU_SOURCE
> > -DOSCAP_THREAD_SAFE -D_POSIX_C_SOURCE=200112L -Wno-unused-function
> > -I/usr/include/libxml2 -DOSCAP_THREAD_SAFE -D_REENTRANT
> > -D_POSIX_PTHREAD_SEMANTICS -DTHREAD_SAFE -DSEAP_THREAD_SAFE
> > -I../../../src -I../../../src/common -I../../../src/common/public
> > -I../../../src/source/public -I../../../src/OVAL
> > -I../../../src/OVAL/public -I../../../src/OVAL/probes/public
> > -I../../../src/OVAL/probes/SEAP/public -I../../../lib -o
> > .libs/probe_system_info system_info.o  probe/.libs/libprobe.a
> > /usr/src/redhat/BUILD/openscap-1.2.8/src/.libs/libopenscap.so
> > -L/usr/kerberos/lib64 -lrpm -lpcre -lcurl -ldl -lgssapi_krb5 -lkrb5
> > -lk5crypto -lcom_err -lidn -lssl -lcrypto -lexslt -lxslt -lgcrypt
> > -lgpg-error -lxml2 -lz -lm -lpthread -lrt -lbz2
> > probe/.libs/libprobe.a(libprobe_la-input_handler.o): In function
> > `probe_input_handler':
> > /usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL/probes/probe/input_handler.c:55:
> > undefined reference to `pthread_setname_np'
> > probe/.libs/libprobe.a(libprobe_la-worker.o): In function
> > `probe_worker_runfn':
> > /usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL/probes/probe/worker.c:50:
> > undefined reference to `pthread_setname_np'
> > probe/.libs/libprobe.a(libprobe_la-signal_handler.o): In function
> > `probe_signal_handler':
> > /usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL/probes/probe/signal_handler.c:67:
> > undefined reference to `pthread_setname_np'
> > probe/.libs/libprobe.a(libprobe_la-icache.o): In function
> > `probe_icache_worker':
> > /usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL/probes/probe/icache.c:95:
> > undefined reference to `pthread_setname_np'
> > probe/.libs/libprobe.a(liboscapcommon_la-debug.o): In function
> > `debug_message_devel_metadata':
> > /usr/src/redhat/BUILD/openscap-1.2.8/src/common/debug.c:175: undefined
> > reference to `pthread_getname_np'
> > collect2: ld returned 1 exit status
> > make[3]: *** [probe_system_info] Error 1
> > make[3]: Leaving directory
> > `/usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL/probes'
> > make[2]: *** [all-recursive] Error 1
> > make[2]: Leaving directory
> > `/usr/src/redhat/BUILD/openscap-1.2.8/src/OVAL/probes'
> > make[1]: *** [all-recursive] Error 1
> > make[1]: Leaving directory `/usr/src/redhat/BUILD/openscap-1.2.8'
> > make: *** [all] Error 2
> > 
> > Does anyone know if there's a workaround for the second issue?
> 
> You can comment the calls and initialize the thread name to something
> like "unknown". Then it should compile.
> 
> This was introduced in https://github.com/OpenSCAP/openscap/commit/dea7eb64
> CC-ing Jan Cerny who is the author.
> 
> Jan, could we perhaps use "unknown" or something like that for the
> thread names in case glibc is older than 2.12? What do you think?
> 
> --
> Martin Preisler
> Identity Management and Platform Security | Red Hat, Inc.
> 

_______________________________________________
Open-scap-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/open-scap-list

Reply via email to