patchGNU Autoconf Archive - Patches: patch #8585, ax_pthread and different CFLAGS...


patch #8585: ax_pthread and different CFLAGS and LDFLAGS

Submitter:  Pavel Janík <pj>
Submitted:  Tue 23 Dec 2014 09:02:35 AM UTC
Priority:  5 - Normal Status:  Need Info
Assigned to:  simons Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:
       No canned response available


Wed 10 Feb 2016 11:15:04 PM UTC, comment #4: 

Great to see! And thank you for the telemetry. Please let me know if you find anything amiss on other platforms, or if your users report an unusual failure mode.

(Hmm, quashing the -pie warning was an unintended side effect. But Clang is no better justified to warn about that than it was for -pthread)

Daniel Richard G. <iskunk>
Wed 10 Feb 2016 09:08:22 PM UTC, comment #3: 


no problem for the delay. Thank you for your work!

I have replaced our (Bitcoin Core) copy of ax_pthread.m4 with draft3.

configure output changes (diff against our master):

-checking if compiler needs -Werror to reject unknown flags... yes
-checking whether pthreads work with -pthread... yes
+checking whether gcc is Clang... yes
+checking whether Clang needs flag to prevent "argument unused" warning when linking with -pthread... -Qunused-arguments
 checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
-checking if more special flags are required for pthreads... -D_THREAD_SAFE
+checking whether more special flags are required for pthreads... no

Ie. expected.

The build finished without issues on OS X without these messages:

-clang: warning: argument unused during compilation: '-pthread'
-clang: warning: argument unused during compilation: '-pie'
-clang: warning: argument unused during compilation: '-pthread'

Ie. it works perfectly for our case.

Thank you!

Pavel Janík <pj>
Wed 10 Feb 2016 08:55:31 PM UTC, comment #2: 

Hi Pavel,

I've recently been working on just this issue. Please have a look at

and try out the -draft3 version of the macro I recently posted there.

To make a long story short: Passing CFLAGS to the linking phase is standard, correct and indeed required behavior; Clang is categorically in the wrong to print that warning. Thankfully, newer versions of Clang no longer complain about this, so it is only older versions (perhaps still the current version on Darwin/OSX) that are a problem. The correct solution is to add a flag that quashes the warning, which the draft AX_PTHREAD now does.

Apologies for the delay---you posted this bug report while I was on holiday :]

Daniel Richard G. <iskunk>
Mon 29 Dec 2014 10:46:45 AM UTC, comment #1: 

Hi Pavel, thank you very much for your message. Unfortunately, this is probably not the right place to discuss technical details about this macro. The Archive is a distribution of other people's efforts and we (the people running the distribution) cannot maintain develop every single macro that we distribute. The authors of ax_pthread are Steven and Daniel, whom I've put into Cc. If you have suggestions for improvement and/or a bug report about their code, then it's probably best to direct that feedback at them.

If you have a patch that ought to be applied to the macro, then this would be the right place to submit it, of course, although patches should also be coordinated with the macro's authors to make sure they have a chance to articulate their opinions about the change.

I hope this helps,

Peter Simons <simons>
Project Administrator
Tue 23 Dec 2014 09:02:35 AM UTC, original submission:  

For the full discussion, see:

Some compilers (e.g. clang on  Mac OS X) want different flags at compile phase and link phase.

At link phase, clang emits this warning when detected CFLAGS are used also in the link phase:

clang: warning: argument unused during compilation: '-pthread'

The macros should check for both compile and link phase options and do not make them the same.

Pavel Janík <pj>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by iskunk (Posted a comment)
  • -email is unavailable- added by simons (Updated the item)
  • -email is unavailable- added by simons
  • -email is unavailable- added by simons
  • -email is unavailable- added by pj (Submitted the item)
  • -email is unavailable- added by pj




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-01 simons StatusIn Progress Need Info
        Open/ClosedOpen Closed
    2014-12-29 simons StatusNone In Progress
        Assigned toNone simons
        Carbon-Copy- Added steven g. johnson
        Carbon-Copy- Added daniel richard g.
    2014-12-23 pj Carbon-Copy- Added pj

    Back to the top

    Powered by Savane 3.9