unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* make check fails to link due to missing -lpthread?
@ 2019-05-03 16:07 Jeffrey Walton
  2019-05-03 23:18 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Walton @ 2019-05-03 16:07 UTC (permalink / raw)
  To: emacs-devel

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
-Wl,--enable-new-dtags
         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')
do
    echo "patching $file"
    sed -e 's|-lrt|-lrt -lpthread|g' "$file" > "$file.fixed"
    mv "$file.fixed" "$file"
    touch -t 197001010000 "$file"
done

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).

Jeff



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-03 23:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-03 16:07 make check fails to link due to missing -lpthread? Jeffrey Walton
2019-05-03 23:18 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).