all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ashish.is@lostca.se (Ashish SHUKLA)
To: emacs-devel <emacs-devel@gnu.org>
Subject: [PATCH] emacs-25 dynamic modules support not compiling on FreeBSD 10.x
Date: Tue, 15 Dec 2015 20:29:39 +0530	[thread overview]
Message-ID: <86lh8vpxk4.fsf@chateau.d.if> (raw)

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

Hi,

Due to C11 threads.h check in configure, we get HAVE_THREADS_H defined in
config.h, which results in thrd_current getting invoked in `module_init' as
shown below:

--8<---------------cut here---------------start------------->8---
1123 void
1124 module_init (void)
1125 {
1126   /* It is not guaranteed that dynamic initializers run in the main thread,
1127      therefore detect the main thread here.  */
1128 #ifdef HAVE_THREADS_H
1129   main_thread = thrd_current ();
1130 #elif defined HAVE_PTHREAD
1131   main_thread = pthread_self ();
1132 #elif defined WINDOWSNT
1133   /* The 'main' function already recorded the main thread's thread ID,
1134      so we need just to use it . */
1135   main_thread = dwMainThreadId;
1136 #endif
1137 }
--8<---------------cut here---------------end--------------->8---

thrd_current(3)[1] on FreeBSD 10.x requires -lstdthreads to be included in
libraries, or you'll get linker error about missing `thrd_current'.

Attached diff (w.r.t. 0ad27a5a) fixes this on FreeBSD 10.x, but needs to be
rewritten to be portable.

--8<---------------cut here---------------start------------->8---
--- configure.ac.orig
+++ configure.ac
@@ -2204,7 +2204,7 @@
     [emacs_cv_pthread_lib=no
      OLD_CPPFLAGS=$CPPFLAGS
      OLD_LIBS=$LIBS
-     for emacs_pthread_lib in 'none needed' -lpthread; do
+     for emacs_pthread_lib in 'none needed' '-lpthread -lstdthreads'; do
        case $emacs_pthread_lib in
 	 -*) LIBS="$OLD_LIBS $emacs_pthread_lib";;
        esac
--8<---------------cut here---------------end--------------->8---

References:
[1]  https://www.freebsd.org/cgi/man.cgi?query=thrd_current

HTH
-- 
Ashish SHUKLA

“If we live, we live; if we die, we die; if we suffer, we suffer; if we are
terrified, we are terrified. No problem.” (Alan Watts)

Sent from my Emacs

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

             reply	other threads:[~2015-12-15 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 14:59 Ashish SHUKLA [this message]
2015-12-16  7:13 ` [PATCH] emacs-25 dynamic modules support not compiling on FreeBSD 10.x Paul Eggert
2015-12-16 11:12   ` Ashish SHUKLA

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

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

  git send-email \
    --in-reply-to=86lh8vpxk4.fsf@chateau.d.if \
    --to=ashish.is@lostca.se \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.