[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error while compiling on FreeBSD
From: |
Wolfgang Lux |
Subject: |
Re: Error while compiling on FreeBSD |
Date: |
Sun, 7 Dec 2014 00:59:32 +0100 |
Am 04.12.2014 um 19:33 schrieb Riccardo Mottola <address@hidden>:
>
> Hi,
>
> On 12/02/14 07:57, Richard Frith-Macdonald wrote:
>> It seems there are two variants of pthread_setname_np and the autoconf
>> script didn't know about them; it was just checking for pthread_setname_np
>> or pthread_set_name_np
>> I have rewritten the tests so it should discriminate between the version
>> which takes two arguments and the one that takes three.
>> I comitted the change to trunk so you can try it out (I don't have the
>> different bsd systems to try it on).
> shortly after I reported FreeBSD, I tried NetBSD and got the same error.
> Now, after your patch, NetBSD is fixed, but FreeBSD still fails to compile.
>
> NetBSD just gives a warning about the qualifier:
>
>
> NSThread.m: In function '-[NSThread _setName:]':
> NSThread.m:810:7: warning: passing argument 3 of 'pthread_setname_np'
> discards 'const' qualifier from pointer target type [enabled by default]
> result = PTHREAD_SETNAME(pthread_self(),
> ^
> In file included from NSThread.m:46:0:
> /usr/include/pthread.h:133:5: note: expected 'void *' but argument is of type
> 'const char *'
> int pthread_setname_np(pthread_t, const char *, void *);
> ^
>
> While FreeBSD gives this error:
> Compiling file NSTask.m ...
> Compiling file NSThread.m ...
> NSThread.m:810:16: error: too few arguments to function call, expected 2,
> have 1
> result = PTHREAD_SETNAME(pthread_self(),
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ././config.h:780:51: note: expanded from macro 'PTHREAD_SETNAME'
> #define PTHREAD_SETNAME(a,b) pthread_set_name_np(b)
> ~~~~~~~~~~~~~~~~~~~ ^
> /usr/include/pthread_np.h:58:1: note: 'pthread_set_name_np' declared here
> void pthread_set_name_np(pthread_t, const char *);
> ^
> 1 error generated.
>
> The relevant configure test is I suppose:
>
> configure:13718: checking for pthread_set_name_np
> configure:13774: clang -o conftest -g -O2 -I/Local/Library/Headers
> -I/Local/Lib
> rary/Headers -I/System/Library/Headers -I/usr/local/include
> -L/Local/Library/Li
> braries -L/Local/Library/Libraries -L/System/Library/Libraries
> -L/usr/local/lib
> conftest.c -lrt -lpthread >&5
> configure:13781: $? = 0
> configure:13803: result: yes
I had a look at the code in configure.ac that checks for the
pthread_setname_np/pthread_set_name_np function in configure.ac and that code
looks fairly confused to me. It first checks for a function pthread_set_name_np
and if present assumes that it has a single parameter. If not present, it
checks for a function pthread_setname_np and then further checks if it is a the
two parameter variant from glibc or the three parameter variant as used on
NetBSD. This looks wrong to me. The single parameter variant is used on Darwin,
however it is called pthread_setname_np (like the functions on glibc and
NetBSD). On the other hand, FreeBSD has a function called pthread_set_name_np
and it expects two parameters like the glibc function. So the configure checks
apparently get things right for Linux and NetBSD, but they get it wrong for
both FreeBSD and Darwin.
Wolfgang
- Error while compiling on FreeBSD, Riccardo Mottola, 2014/12/01
- Re: Error while compiling on FreeBSD, Lundberg, Johannes, 2014/12/01
- Re: Error while compiling on FreeBSD, Richard Frith-Macdonald, 2014/12/02
- Re: Error while compiling on FreeBSD, Riccardo Mottola, 2014/12/04
- Re: Error while compiling on FreeBSD,
Wolfgang Lux <=
- Re: Error while compiling on FreeBSD, Riccardo Mottola, 2014/12/14
- Re: Error while compiling on FreeBSD, Lundberg, Johannes, 2014/12/14
- Re: Error while compiling on FreeBSD, Lundberg, Johannes, 2014/12/14
- Re: Error while compiling on FreeBSD, Riccardo Mottola, 2014/12/21
- Re: Error while compiling on FreeBSD, Riccardo Mottola, 2014/12/29
- Re: Error while compiling on FreeBSD, David Wetzel, 2014/12/29