Boost logo

Boost Users :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-09-12 08:45:40


--- In Boost-Users_at_y..., "robertpsather" <tropostropos_at_h...> wrote:
> Building Boost on AIX is difficult. Here's a recipe that worked
for
> me, for building on the following platform:
> Boost source download version 28
> AIX 4.3.3 on RS/6000
> VisualAge 5.0
> Jam: downloaded binary of Boost.Jam Version 3.1.0. OS=AIX.
> bash shell
>
> Building Boost
>
> Setup: Downloaded version 28 tar.gz file to ~/boost. Un-gzipped
and
> untarred. Set export BOOST_ROOT=/home/satherb/boost/boost_1_28_0
> Attempt: jam "-sTOOLS=vacpp"
> Result: Many compilation errors, in building of regexp library.
For
> example:
> Error: "libs/regex/build/../src/cpp_regex_traits.cpp", line
> 196.39: 1540-0257 (S) An object or reference of
> type "std::messages_base::catalog" cannot be
> initialized with an expression of type "int".
> Attempt: in cpp_regex_traits.cpp", line 196, changed "-1"
> to "(size_t) –1"
> Result: compiler says "cannot be initialised with type unsigned
> long." for the same line.
> Attempt: Noted that www.boost.org says that threads lib does not
> depend on regex or python. Edited Jamfile to comment out
unnecessary
> targets python and regex.

Not needed. If you need to compile only a part of Boost using bjam,
all you have to do is switch to the appropriate build directory (in
this case $BOOST_ROOT/libs/thread/build) and execute bjam there.

> Result: Most errors are "Thread support is unavailable". Looking
at
> source indicates this is because BOOST_HAS_THREADS macro is
undefined.
> Attempt: export BOOST_HAS_THREADS=1

Generally a bad idea. BOOST_HAS_THREADS should be defined by
<boost/config.hpp> according to the following:

* Platform must have thread support for one of the supported
threading systems (POSIX, Mac carbon threads, Win32).

* The appropriate compiler flags or other system dependent mechanisms
must be used to enable compilation of multi-threaded code.

Manually setting BOOST_HAS_THREADS will bypass the second portion of
this. This is one of the most frequent mistakes users make when
trying to compile Boost.Threads with their own build process. Since
you're using bjam, however, the Jamfiles should be insuring that
you're system is using the appropriate steps for compiling multi-
threaded applications. So it sounds like either Boost.Config is
broken on your platform, or the bjam toolset for your compiler is
broken. I'm not familiar with your platform, so I can't guess which
is true, but hopefully others can help you diagnose this.

> Result: same errors.
> Attempt: run ./configure
> Result: configure gives error message that says "compiler does not
> produce output" (or something like that)
> However, running configure again worked! Here were the recent
> settings of environmental variables:
> export BOOST_ROOT=/home/satherb/boost/boost_1_28_0
> export _MT=1
> export CC=xlC_r
> export CXX=xlC
> export _POSIX_THREADS=1
> export LIBS=-lpthread
>
> (I don't know which of these was the key. If you discover the
> answer, please let me know.)

Several of those are important. My understanding is that xlC_r turns
on MT support for your platform, while _MT and _POSIX_THREADS are
what cause BOOST_HAS_THREADS to be defined and -lpthread is the magic
that makes linking a multi-threaded application work.

> Attempt: Did as configure suggested: "Adjustments to boost
> configuration have been written to user.hpp, copy this to
> boost/config/user.hpp to use "as is" "
> Result: jam still gives "Thread support is unavailable" errors.
> Attempt: added a line to boost/config/user.hpp:
> #define BOOST_HAS_THREADS
> Result: builds!

That sounds like it might be a minor bug in the configure script, but
Mr. Maddock can talk more authoritatively about that.

> (Don't know yet if it works properly, of course. The examples
don't
> build.)

If the library builds, the examples (and more importantly, the tests)
should.

Bill Kempf


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net