Ticket #51 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

pthreads detection broken on OS X

Reported by: dmacks@… Owned by: lennart
Milestone: Avahi 0.6.13 Component: other
Keywords: Cc:

Description

Trying to build avahi-0.6.10 on OS X 10.3 (gcc3.3):

checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... -D_THREAD_SAFE
checking for cc_r... gcc
checking whether to check for GCC pthread/shared inconsistencies... yes
checking whether -pthread is sufficient with -shared... no
checking whether -lpthread fixes that... no
checking whether -lc_r fixes that... no
configure: WARNING: Impossible to determine how to use pthreads with shared libraries
configure: error: Missing POSIX Threads support

The configure tests related to pthread/shared all pass -Wl-z,defs in addition to the flags being tested, but -z isn't valid at all for my compiler. All tests therefore fail, not because of the specific feature being tested but because of a test artifact. If I remove -Wl,-z,defs, configure successfully tests for the features it's trying to test:

checking how to hardcode library paths into programs... immediate
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... -D_THREAD_SAFE
checking for cc_r... gcc
checking whether to check for GCC pthread/shared inconsistencies... yes
checking whether -pthread is sufficient with -shared... yes

and ./configure doesn't abort.

Attachments

avahi_acx_pthread.patch Download (1.5 KB) - added by sjoerd 7 years ago.
Update acx_pthread to the current upstream version and fix-up for darwin
avahi_acx_pthread_2.patch Download (1.5 KB) - added by sjoerd 7 years ago.
Fixed patch, use -o instead of -a so it actually skips check if they are not needed.. Tested on OS X

Change History

Changed 7 years ago by lennart

  • status changed from new to assigned

Hmm. We had lots of trouble with acx_pthread in the past. It is a slightly modified copy of a script from the autoconf archive:

 http://autoconf-archive.cryp.to/acx_pthread.html

This script has been updated recently, could you please test if it works for you? Just replace acx_pthread.m4, rerun "bootstrap.sh" and try to build Avahi.

Unfortunately I don't have access to MacOSX so I cannot do much about it myself.

If it works I will merge that script into our upstream packages.

Thanks!

Changed 7 years ago by sebest

I tested the script from autocong archive and it works correctly on my mac.

i remember that we had a lot of issues with this script, especially for Mips as far as remember, we should ask sjoerd to test it.

Changed 7 years ago by lennart

  • milestone set to Avahi 0.6.13

Changed 7 years ago by sjoerd

I'll attach a patch which solves this issue by not check for inconsitencies on darwin, as the -Wl-z flag is really needed for the tests but apparently doesn't work on OS X/darwin.

Please test this patch on OS X :)

Changed 7 years ago by sjoerd

Update acx_pthread to the current upstream version and fix-up for darwin

Changed 7 years ago by sjoerd

Fixed patch, use -o instead of -a so it actually skips check if they are not needed.. Tested on OS X

Changed 7 years ago by lennart

  • status changed from assigned to closed
  • resolution set to fixed

(In [1277]) fix build on MacOSX (patch from Sjoerd Simmons, closes #51)

Note: See TracTickets for help on using tickets.