[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make check fails to link due to missing -lpthread?

From: Jeffrey Walton
Subject: make check fails to link due to missing -lpthread?
Date: Fri, 3 May 2019 12:07:30 -0400

Hi Everyone,

I have some build scripts that use consistent flags and options for
all packages. It is helpful when acceptance testing a package, like
adding -fsanitize=undefined during testing.

The non-testing flags are:

  BITNESS: 64-bits
   PREFIX: /usr/local
   LIBDIR: /usr/local/lib64

PKG_CONFIG_PATH: /usr/local/lib64/pkgconfig
       CPPFLAGS: -I/usr/local/include -DNDEBUG
         CFLAGS: -g2 -O2 -march=native -fPIC
       CXXFLAGS: -g2 -O2 -march=native -fPIC
        LDFLAGS: -L/usr/local/lib64 -Wl,-R,/usr/local/lib64
         LDLIBS: -ldl -lpthread

In the case of Emacs 'make check' fails to link on Fedora:

gcc -Demacs  -I. -I. -I../lib -I../lib                     -MMD -MF
deps/.d -MP       -g2 -O2 -march=native -fPIC  -Wl,-znocombreloc
-no-pie -L/usr/local/lib64 -Wl,-R,/usr/local/lib64
-Wl,--enable-new-dtags \
  -o temacs   dispnew.o frame.o scroll.o xdisp.o menu.o  window.o
charset.o coding.o category.o ccl.o character.o chartab.o bidi.o cm.o
term.o terminal.o xfaces.o    emacs.o keyboard.o macros.o keymap.o
sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o
dired.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o
alloc.o data.o doc.o editfns.o callint.o eval.o floatfns.o fns.o
font.o print.o lread.o  syntax.o unexelf.o bytecode.o process.o
gnutls.o callproc.o region-cache.o sound.o atimer.o doprnt.o
intervals.o textprop.o composite.o xml.o lcms.o inotify.o  profiler.o
decompress.o thread.o systhread.o sheap.o          terminfo.o
lastfile.o gmalloc.o     ../lib/libegnu.a                 -lrt
  -ltinfo          -lanl   -lm -lz
/bin/ld: emacs.o: undefined reference to symbol 'pthread_sigmask@@GLIBC_2.2.5'
/bin/ld: //usr/lib64/libpthread.so.0: error adding symbols: DSO
missing from command line
collect2: error: ld returned 1 exit status

On Red Hat and Fedora I believe this is because of `-lrt`. I patch the
makefiles so '-lrt' becomes '-;rt -lpthread'. I do so (1) after
unpacking the tarball; and (2) after configure. It usually sidesteps
this error.

for file in $(find "$PWD" -iname 'Makefile')
    echo "patching $file"
    sed -e 's|-lrt|-lrt -lpthread|g' "$file" > "$file.fixed"
    mv "$file.fixed" "$file"
    touch -t 197001010000 "$file"

In the case of Emacs it is not working. I suspect Emacs is creating
makefiles after configure so they can't be patched.

My question is, how do I have Emacs honor the use of -lpthread? Or how
do I patch Emacs so my changes are used?

(The preferred solution does not require autoreconf. Some systems I
build on are so old Autools creates too problems when trying to run
autoreconf. Autotools is effectively a DoS in these cases. That's why
touch is used to set the filetime in the past on some files).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]