On 02 Jan 2020, at 16:16, Yann Ylavic <ylavic....@gmail.com> wrote:

>> It looks like, in the generated "apr.h",
>> APR_USE_PROC_PTHREAD_SERIALIZE is set but not
>> APR_HAS_PROC_PTHREAD_SERIALIZE?
> 
> This possibly has to do with "/dev/zero" detection from:
> 
> APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
>             func:pthread_mutexattr_setpshared dnl
>             file:/dev/zero,
>             hasprocpthreadser="1", hasprocpthreadser="0")
> 
> I'm not sure it can work for cross-compilation, does forcing it with
> "./configure ... ac_cv_file__dev_zero=yes ..." help?

Working backwards, I tried the ac_cv_file__dev_zero=yes, and it made no 
difference in this case.

Possibly because they are setting the following flags explicitly:

CONFIGURE_VARS += \
        ac_cv_sizeof_struct_iovec=1 \
        ac_cv_struct_rlimit=yes \
        ac_cv_func_sem_open=yes \
        ac_cv_func_pthread_mutexattr_setpshared=yes \
        apr_cv_mutex_robust_shared=yes \
        apr_cv_tcp_nodelay_with_cork=yes \
        apr_cv_sock_cloexec=yes \
        apr_cv_process_shared_works=yes \
        apr_cv_mutex_recursive=yes \
        apr_cv_epoll_create1=yes \
        apr_cv_epoll=yes \
        apr_cv_dup3=yes \
        apr_cv_accept4=yes 

The lines from config.log with pthread in them are as follows:

[minfrin@bob openwrt]$ cat 
/home/minfrin/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/apr-1.7.0/config.log
 | grep pthread
configure:19224: checking pthread.h usability
configure:19224: checking pthread.h presence
configure:19224: checking for pthread.h
configure:19272: checking for CFLAGS needed for pthreads
configure:19362: checking for LIBS needed for pthreads
configure:19456: checking for pthread.h
configure:19757: checking whether pthread_getspecific takes two arguments
conftest.c:37:1: error: too many arguments to function 'pthread_getspecific'
 pthread_getspecific(key,&tmp);
/home/minfrin/src/openwrt/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/include/pthread.h:140:7:
 note: declared here
 void *pthread_getspecific(pthread_key_t);
| #include <pthread.h>
| pthread_key_t key;
| pthread_getspecific(key,&tmp);
configure:19802: checking whether pthread_attr_getdetachstate takes one argument
conftest.c:36:1: error: too few arguments to function 
'pthread_attr_getdetachstate'
 pthread_attr_getdetachstate(attr);
/home/minfrin/src/openwrt/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/include/pthread.h:150:5:
 note: declared here
 int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
| #include <pthread.h>
| pthread_attr_t *attr;
| pthread_attr_getdetachstate(attr);
configure:19892: checking for pthread_key_delete
configure:19892: checking for pthread_rwlock_init
configure:19892: checking for pthread_attr_setguardsize
configure:19892: checking for pthread_yield
conftest.c:(.text.startup+0x2): undefined reference to `pthread_yield'
| /* Define pthread_yield to an innocuous variant, in case <limits.h> declares 
pthread_yield.
| #define pthread_yield innocuous_pthread_yield
|     which can conflict with char pthread_yield (); below.
| #undef pthread_yield
| char pthread_yield ();
| #if defined __stub_pthread_yield || defined __stub___pthread_yield
| return pthread_yield ();
configure:19903: checking for pthread_rwlock_t
|     /* When using the unproven-pthreads package, we need to pull in this
|      * on.  XXX Should probably be fixed in the unproven-pthreads package.
| #include <pthread.h>
configure:26041: checking for PTHREAD_PROCESS_SHARED in pthread.h
configure:26077: checking for pthread_mutex_timedlock
configure:26077: checking for pthread_mutexattr_setpshared
configure:26516: checking for pthread_condattr_setpshared
configure:26750: result: decision on apr_lock implementation method... pthread 
pshared mutex
ac_cv_func_pthread_attr_setguardsize=yes
ac_cv_func_pthread_condattr_setpshared=yes
ac_cv_func_pthread_key_delete=yes
ac_cv_func_pthread_mutex_timedlock=yes
ac_cv_func_pthread_mutexattr_setpshared=yes
ac_cv_func_pthread_rwlock_init=yes
ac_cv_func_pthread_yield=no
ac_cv_header_pthread_h=yes
ac_cv_pthread_attr_getdetachstate_one_arg=no
ac_cv_pthread_getspecific_two_args=no
hasprocpthreadser='0'
have_pthread_condattr_setpshared='1'
have_pthread_mutex_timedlock='1'
procpthreadser='1'
pthreadh='1'
pthreadser=ā€˜1

Right at the bottom, we have:

hasprocpthreadser=ā€˜0'

which means (if Iā€™m reading this correctly) APR_HAS_PROC_PTHREAD_SERIALIZE is 
not set.

Looking at the PTHREAD matches in apr.h:

[minfrin@bob apr-1.7.0]$ cat 
/home/minfrin/src/openwrt/openwrt/build_dir/target-mips_24kc_musl/apr-1.7.0/include/apr.h
 | grep PTHREAD
#define APR_HAVE_PTHREAD_H       1
#define APR_USE_PROC_PTHREAD_SERIALIZE    1 
#define APR_USE_PTHREAD_SERIALIZE         1 
#define APR_HAS_PROC_PTHREAD_SERIALIZE    0

On my Mac, this works:

Little-Net:apr-1.7 minfrin$ cat include/apr.h | grep PTHREAD
#define APR_HAVE_PTHREAD_H       1
#define APR_USE_PROC_PTHREAD_SERIALIZE    0 
#define APR_USE_PTHREAD_SERIALIZE         1 
#define APR_HAS_PROC_PTHREAD_SERIALIZE    0

Regards,
Graham
ā€”

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to