
The boost.filesystem does not compile succesfully on HPUX/itanium with aCC because (in bbv1) the function readdir_r is not known. It compiles fine though if the flag '-mt' (to enable multi-threading) is added to the command-line. Does anybody now any other flag that might influence this? Is it normal (never used readdir_r myself) that it is only defined in multi-threading-mode? Should we instruct bbv1 to compile the boost.filesystem always with the -mt flag on hpux ? toon

On 6/20/05, Toon Knapen <toon.knapen@fft.be> wrote:
Does anybody now any other flag that might influence this? Is it normal (never used readdir_r myself) that it is only defined in multi-threading-mode? Should we instruct bbv1 to compile the
Yes that seems eminently reasonable (that readdir_r only be prototyped/available if -mt is supplied).
boost.filesystem always with the -mt flag on hpux ?
Well, there is code in libs/filesystem/src/operations_posix_windows.cpp that attempts to detect if it is being compiled with multi-threading enabled: # if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && defined(_SC_THREAD_SAFE_FUNCTIONS) \ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) Presumably aCC sets these macros incorrectly, or this code is not correct. Maybe the check should be for >0? Perhaps you can check what _POSIX_THREAD_SAFE_FUNCTIONS is defined to on aCC both with and without -mt? On Linux 2.4.21 + gcc 3.3.4, I get 200112 both with -pthread and without. #include <pthread.h> #include <iostream> int main () { std::cout << _POSIX_THREAD_SAFE_FUNCTIONS << std::endl; } -- Caleb Epstein caleb dot epstein at gmail dot com

Caleb Epstein wrote:
Well, there is code in libs/filesystem/src/operations_posix_windows.cpp that attempts to detect if it is being compiled with multi-threading enabled:
# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && defined(_SC_THREAD_SAFE_FUNCTIONS) \ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)
Presumably aCC sets these macros incorrectly, or this code is not correct. Maybe the check should be for >0?
Since somebody suggested that _REENTRANT is defined on HP when the '-mt' flag is used, what about only adding adding following to this #if # if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && defined(_SC_THREAD_SAFE_FUNCTIONS) \ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) || (defined(__HP_aCC) && defined(_REENTRANT)) toon

"Toon Knapen" <toon.knapen@fft.be> wrote in message news:42B70E25.9080307@fft.be...
Caleb Epstein wrote:
Well, there is code in libs/filesystem/src/operations_posix_windows.cpp that attempts to detect if it is being compiled with multi-threading enabled:
# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && defined(_SC_THREAD_SAFE_FUNCTIONS) \ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)
Presumably aCC sets these macros incorrectly, or this code is not correct. Maybe the check should be for >0?
Since somebody suggested that _REENTRANT is defined on HP when the '-mt' flag is used, what about only adding adding following to this #if
# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && defined(_SC_THREAD_SAFE_FUNCTIONS) \ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) || (defined(__HP_aCC) && defined(_REENTRANT))
If someone with access to HPUX verifies this helps, I'll be happy to add it. (But do fix the missing backslash on line 3) --Beman

On 6/20/05, Toon Knapen <toon.knapen@fft.be> wrote:
Caleb Epstein wrote:
Well, there is code in libs/filesystem/src/operations_posix_windows.cpp that attempts to detect if it is being compiled with multi-threading enabled:
# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && defined(_SC_THREAD_SAFE_FUNCTIONS) \ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)
Presumably aCC sets these macros incorrectly, or this code is not correct. Maybe the check should be for >0?
Since somebody suggested that _REENTRANT is defined on HP when the '-mt' flag is used, what about only adding adding following to this #if
# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && defined(_SC_THREAD_SAFE_FUNCTIONS) \ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) || (defined(__HP_aCC) && defined(_REENTRANT))
I don't use boost build, but I thought the existing ifdef block seemed like it should work. I don't know much about HPUX on Itanium, but I went grepping on my HP 11i box, and found the _POSIX_THREAD_SAFE_FUNCTIONS define in /usr/include/sys/unistd.h. Then I remembered that to use the new posix friendly APIs on 11i, you need a -D_POSIX_C_SOURCE=199506L. I'd bet that if you added that to your build, things would work a lot more nicely. I think that define is only contra-indicated if you're still trying to use CMA threads (which is not a good idea). If you do end up needing a modification of the define block above, I'd recommend __hpux rather than __HP_aCC since this is a platform issue rather than a compiler issue.

On 6/20/05, Toon Knapen <toon.knapen@fft.be> wrote:
The boost.filesystem does not compile succesfully on HPUX/itanium with aCC because (in bbv1) the function readdir_r is not known. It compiles fine though if the flag '-mt' (to enable multi-threading) is added to the command-line.
Does anybody now any other flag that might influence this? Is it normal (never used readdir_r myself) that it is only defined in multi-threading-mode? Should we instruct bbv1 to compile the boost.filesystem always with the -mt flag on hpux ?
There are a number of _r interfaces on HP, they are only available if _REEENTRANT is defined, which I would assume -mt activates. I don't know anything about Boost.Build, but I'd guess the best way to handle it would be to require -mt for filesystem, and not build it if -mt is not requested. I always define _REENTRANT in my stuff, but its not terribly performance critical stuff. HP isn't like MS where you need uniform mt or not across all translation units if you want happiness, but I wouldn't think you'd want to enable mt settings behind the users' back. Tom
participants (4)
-
Beman Dawes
-
Caleb Epstein
-
Thomas Matelich
-
Toon Knapen