Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, December 2006
4.2.2 Build Failure

Pages: Prev | 1 | 2 | Next

Message 16 in thread

Hi,

> Just checked the man page at openbsd.org for the function you mention
> above, and the function is not documented. I assume from that that the
> function is not implemented in 4.0. 

I see. Then we really need to do something about it...

OK. I think there's something really wrong with OpenBSD here:
	io/qfsfileengine_unix.cpp:591: error: `getpwuid_r' undeclared

Function getpwuid_r() is documented here:
http://www.opengroup.org/onlinepubs/009695399/functions/getpwuid.html
It is marked as part of the Thread-Safe Functions option (TSF).

As the name implies, this is optional. However if it is not implemented 
then _POSIX_THREAD_SAFE_FUNCTIONS should obviously not be defined. As 
far as I can see, OpenBSD wrongly defines _POSIX_THREAD_SAFE_FUNCTIONS 
in its header files, because it does actually not implement the 
Thread-Safe Functions option.

OpenBSD is not the only OS not to implement the Thread-Safe Functions 
option. However other systems do not define _POSIX_THREAD_SAFE_FUNCTIONS 
if they cannot legitimately do that and acknowledge that. I seem to 
recall OpenBSD developers were not keen on fixing this - I don't know 
why. Maybe they weren't explained the problem in a convincing way.

An example with AIX:

http://fxr.watson.org/fxr/source/sys/unistd.h
/*
  * 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if
  * _POSIX_THREADS is defined, then _POSIX_THREAD_SAFE_FUNCTIONS
  * must also be defined.  (This is likely a typo (reversed
  * dependency), in which case we would be compliant if the typo
  * were officially acknowledged.)  However, we do not support
  * all of the required _r() interfaces, which means we cannot
  * legitimately define _POSIX_THREAD_SAFE_FUNCTIONS.  Therefore,
  * we are non-compliant here in two ways.
  */
/* #define _POSIX_THREAD_SAFE_FUNCTIONS */


A "hacky" way to work around this OpenBSD issue would be to undefine 
_POSIX_THREAD_SAFE_FUNCTIONS after it has been wrongly defined by 
OpenBSD in <unistd.h>. hence you could probably add at the end of the 
mkspecs/openbsd-g++/qplatformdefs.h header file something like that:

#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#endif

If this works for you, I'll fix it in the Qt 4.2 series.

--
 [ signature omitted ] 

Message 17 in thread

Dimitri,

This is a little deep for me. Best to correspond about this with
Marc Espie. E-Mail: espie@xxxxxxxxxxxx Member of the OpenBSD project.
Marc is, to the best of my knowledge, the porter of Qt to OpenBSD.

Dave

> Hi,
> 
> > Just checked the man page at openbsd.org for the function you mention
> > above, and the function is not documented. I assume from that that the
> > function is not implemented in 4.0. 
> 
> I see. Then we really need to do something about it...
> 
> OK. I think there's something really wrong with OpenBSD here:
> 
> Function getpwuid_r() is documented here:
> http://www.opengroup.org/onlinepubs/009695399/functions/getpwuid.html
> It is marked as part of the Thread-Safe Functions option (TSF).
> 
> As the name implies, this is optional. However if it is not implemented 
> then _POSIX_THREAD_SAFE_FUNCTIONS should obviously not be defined. As 
> far as I can see, OpenBSD wrongly defines _POSIX_THREAD_SAFE_FUNCTIONS 
> in its header files, because it does actually not implement the 
> Thread-Safe Functions option.
> 
> OpenBSD is not the only OS not to implement the Thread-Safe Functions 
> option. However other systems do not define _POSIX_THREAD_SAFE_FUNCTIONS 
> if they cannot legitimately do that and acknowledge that. I seem to 
> recall OpenBSD developers were not keen on fixing this - I don't know 
> why. Maybe they weren't explained the problem in a convincing way.
> 
> An example with AIX:
> 
> http://fxr.watson.org/fxr/source/sys/unistd.h
> /*
>   * 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if
>   * _POSIX_THREADS is defined, then _POSIX_THREAD_SAFE_FUNCTIONS
>   * must also be defined.  (This is likely a typo (reversed
>   * dependency), in which case we would be compliant if the typo
>   * were officially acknowledged.)  However, we do not support
>   * all of the required _r() interfaces, which means we cannot
>   * legitimately define _POSIX_THREAD_SAFE_FUNCTIONS.  Therefore,
>   * we are non-compliant here in two ways.
>   */
> /* #define _POSIX_THREAD_SAFE_FUNCTIONS */
> 
> 
> A "hacky" way to work around this OpenBSD issue would be to undefine 
> _POSIX_THREAD_SAFE_FUNCTIONS after it has been wrongly defined by 
> OpenBSD in <unistd.h>. hence you could probably add at the end of the 
> mkspecs/openbsd-g++/qplatformdefs.h header file something like that:
> 
> #ifdef _POSIX_THREAD_SAFE_FUNCTIONS
> #undef _POSIX_THREAD_SAFE_FUNCTIONS
> #endif
> 
> If this works for you, I'll fix it in the Qt 4.2 series.
> 
> --
> Dimitri
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 18 in thread

Hi,

> This is a little deep for me. Best to correspond about this [...]

I'll do that. In the meantime you could give my workaround a try. Just 
add near the end of mkspecs/openbsd-g++/qplatformdefs.h:

#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#endif

Does this help?

--
 [ signature omitted ] 

Message 19 in thread

> Hi,
> 
> > This is a little deep for me. Best to correspond about this [...]
> 
> I'll do that. In the meantime you could give my workaround a try. Just 
> add near the end of mkspecs/openbsd-g++/qplatformdefs.h:
> 
> #ifdef _POSIX_THREAD_SAFE_FUNCTIONS
> #undef _POSIX_THREAD_SAFE_FUNCTIONS
> #endif
> 
> Does this help?
> 
> --
> Dimitri

Yes it did. It looks like I built the whole thing.
I now think I need a faster computer. :-)

Dave

--
 [ signature omitted ] 

Message 20 in thread

Hi,

I've investigated this a bit more. Current OpenBSD sources still look wrong:
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libpthread/include/pthread.h

/*
  * Compile time symbolic constants for portability specifications:
  *
  * Note that those commented out are not currently supported by the
  * implementation.
  */
[...]
/* #define _POSIX_THREAD_PROCESS_SHARED */
#define _POSIX_THREAD_SAFE_FUNCTIONS


I suggest you report the problem to the OpenBSD developers:
	http://www.openbsd.org/report.html
In the meantime I'll work around this OpenBSD issue in Qt.

--
 [ signature omitted ]