unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: emacs-devel@gnu.org
Subject: make check fails to link due to missing -lpthread?
Date: Fri, 3 May 2019 12:07:30 -0400	[thread overview]
Message-ID: <CAH8yC8=z4anCcTciAUxT-5-iDin-tiiHb87oAzn0Tt8mp+_TNg@mail.gmail.com> (raw)

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



             reply	other threads:[~2019-05-03 16:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 16:07 Jeffrey Walton [this message]
2019-05-03 23:18 ` make check fails to link due to missing -lpthread? Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH8yC8=z4anCcTciAUxT-5-iDin-tiiHb87oAzn0Tt8mp+_TNg@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).