Boost logo

Boost :

From: John Maddock (john_maddock_at_[hidden])
Date: 2002-04-26 07:05:13


> A couple things came to mind after seeing this. I am using Solaris' ld ,
not
> gnu's ld. (Do I have to use gnu's ld?) Secondly, is the -fPIC flag being
used in
> building the libraries? -fPIC for gcc (or corresponding position
independent code
> flag for any other compiler) for building libs on Solaris are essential.
Ommiting
> this flag would definately cause problems.

Yes, -fPIC should be being used for dynamic lib builds (and not for static
libs), and no you don't need to use GNU ld, however the Jam build system in
the last boost release doesn't realise that solaris doesn't have GNU ld and
that's why you're getting those errors form the Jam build tests - the
current CVS version has been patched to fix, but I don't have a release date
:-(

Just out of interest, what about building using the regex makefiles?

> With libs/regex/test/Jamfile, I get:
>
> cd /usr/local/gcc/gcc-3.0.4/boost/libs/regex/test/
> hrdhhs35:[test] # ls
> Jamfile c_compiler_checks/ regress/
> hrdhhs35:[test] # jam -sBOOST_ROOT=/usr/local/gcc/gcc-3.0.4/boost
> -sTOOLS=gcc-stlport
>
> ...found 253 targets...
> ...updating 10 targets...
> gcc-Link-action
>
../../../libs/regex/test/bin/regress/gcc-stlport/debug/runtime-link-dynamic/
regress
>
> ld: fatal: option -dn and -P are incompatible
> ld: fatal: Flags processing errors
> collect2: ld returned 1 exit status
>
> g++ -g -o
>
"../../../libs/regex/test/bin/regress/gcc-stlport/debug/runtime-link-dynamic
/regress"
> -Lc:/downloads/STLPort-0601/lib
>
"../../../libs/regex/test/bin/regress/gcc-stlport/debug/runtime-link-dynamic
/parse.o"
>
"../../../libs/regex/test/bin/regress/gcc-stlport/debug/runtime-link-dynamic
/regress.o"
>
"../../../libs/regex/test/bin/regress/gcc-stlport/debug/runtime-link-dynamic
/tests.o"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
> -lstlport_gcc_stldebug -Wl,-rpath-link,.
>
> ...failed gcc-Link-action
>
../../../libs/regex/test/bin/regress/gcc-stlport/debug/runtime-link-dynamic/
regress
> ...
> gcc-C++-action
>
../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynamic
/parse.o
>
> In file included from regress/parse.cpp:26:
> regress/regress.h:60: parse error before `&'
> regress/regress.h: In function `class string make_narrow(...)':
> regress/regress.h:61: `s' undeclared (first use this function)
> regress/regress.h:61: (Each undeclared identifier is reported only once
> regress/regress.h:61: for each function it appears in.)
> regress/regress.h:61: warning: control reaches end of non-void function
> `make_narrow(...)'
> ../../../boost/regex.hpp: At top level:
> ../../../boost/regex.hpp: In instantiation of
`boost::regex_traits<__wchar_t>':
> ../../../boost/regex.hpp:464: instantiated from
>
`boost::reg_expression<__wchar_t,boost::regex_traits<__wchar_t>,allocator<__
wchar_t>
> >'
> regress/parse.cpp:111: instantiated from here
> ../../../boost/regex.hpp:464: base class
`boost::c_regex_traits<__wchar_t>' has
> incomplete type
> ../../../boost/regex.hpp: In instantiation of
>
`boost::reg_expression<__wchar_t,boost::regex_traits<__wchar_t>,allocator<__
wchar_t>
> >':
> regress/parse.cpp:111: instantiated from here
> ../../../boost/regex.hpp:464: no type named `size_type' in `class
> boost::regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:465: no type named `uchar_type' in `class
> boost::regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:466: no type named `string_type' in `class
> boost::regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:475: no type named `locale_type' in `class
> boost::regex_traits<__wchar_t>'
> ../../../boost/regex.hpp: In instantiation of
>
`boost::reg_expression<__wchar_t,boost::regex_traits<__wchar_t>,allocator<__
wchar_t>
> >':
> regress/parse.cpp:111: instantiated from here
> ../../../boost/regex.hpp:601: no type named `locale_type' in `class
> boost::regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:601: no type named `locale_type' in `class
> boost::regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:602: no type named `locale_type' in `class
> boost::regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:1058: no type named
`string_type'
> in `class boost::regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:1058: template argument 1 is
> invalid
> ../../../boost/regex/detail/regex_compile.hpp:1058: no type named
`string_type'
> in `class boost::regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:1058: template argument 1 is
> invalid
> ../../../boost/regex/detail/regex_compile.hpp:979: no type named
`string_type' in
> `class boost::regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:979: template argument 1 is
invalid
>
> ../../../boost/regex/detail/regex_compile.hpp:979: no type named
`string_type' in
> `class boost::regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:979: template argument 1 is
invalid
>
> ../../../boost/regex/detail/regex_compile.hpp:979:
>
`boost::reg_expression<__wchar_t,boost::regex_traits<__wchar_t>,allocator<__
wchar_t>
> >::compile_set_aux(...)' has already been declared in
>
`boost::reg_expression<__wchar_t,boost::regex_traits<__wchar_t>,allocator<__
wchar_t>
> >'
> ../../../boost/regex.hpp: In instantiation of
>
`boost::reg_expression<__wchar_t,boost::regex_traits<__wchar_t>,allocator<__
wchar_t>
> >':
> regress/parse.cpp:111: instantiated from here
> ../../../boost/regex.hpp:707: confused by earlier errors, bailing out
>
>

 g++ -c -Wall -ftemplate-depth-100 -DBOOST_REGEX_NO_LIB=1 -DTEST_UNICODE=1
> -DBOOST_REGEX_STATIC_LINK=1 -D_STLP_DEBUG -g -O0 -fno-inline
> -D_STLP_USE_DYNAMIC_LIB -I"../../../libs/regex/test" -I"." -I"../../.."
> -isystem "c:/downloads/STLPort-0601/stlport" -o
>
"../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynami
c/parse.o"
> "regress/parse.cpp"
>
> ...failed gcc-C++-action
>
../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynamic
/parse.o
> ...
> gcc-C++-action
>
../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynamic
/regress.o
>
> In file included from regress/regress.cpp:44:
> regress/regress.h:60: parse error before `&'
> regress/regress.h: In function `class string make_narrow(...)':
> regress/regress.h:61: `s' undeclared (first use this function)
> regress/regress.h:61: (Each undeclared identifier is reported only once
> regress/regress.h:61: for each function it appears in.)
> regress/regress.h:61: warning: control reaches end of non-void function
> `make_narrow(...)'
>
>

 g++ -c -Wall -ftemplate-depth-100 -DBOOST_REGEX_NO_LIB=1 -DTEST_UNICODE=1
> -DBOOST_REGEX_STATIC_LINK=1 -D_STLP_DEBUG -g -O0 -fno-inline
> -D_STLP_USE_DYNAMIC_LIB -I"../../../libs/regex/test" -I"." -I"../../.."
> -isystem "c:/downloads/STLPort-0601/stlport" -o
>
"../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynami
c/regress.o"
> "regress/regress.cpp"
>
> ...failed gcc-C++-action
>
../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynamic
/regress.o
> ...
> gcc-C++-action
>
../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynamic
/tests.o
>
> In file included from regress/tests.cpp:27:
> regress/regress.h:60: parse error before `&'
> regress/regress.h: In function `class string make_narrow(...)':
> regress/regress.h:61: `s' undeclared (first use this function)
> regress/regress.h:61: (Each undeclared identifier is reported only once
> regress/regress.h:61: for each function it appears in.)
> regress/regress.h:61: warning: control reaches end of non-void function
> `make_narrow(...)'
>
/opt/sfw/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/s
td/bastring.h:
> In method `const __wchar_t *
>
basic_string<__wchar_t,string_char_traits<__wchar_t>,__default_alloc_templat
e<false,0>
> >::c_str() const':
> regress/tests.cpp:619: instantiated from here
>
/opt/sfw/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/s
td/bastring.h:335:
> return to `const __wchar_t *' from `const char *'
> ../../../boost/regex.hpp: At top level:
> ../../../boost/regex.hpp: In instantiation of
>
`boost::reg_expression<__wchar_t,boost::c_regex_traits<__wchar_t>,jm_debug_a
lloc>':
>
> regress/tests.cpp:619: instantiated from here
> ../../../boost/regex.hpp:464: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:465: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:466: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:475: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:601: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:601: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:602: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:1058: invalid use of
undefined type
> `class boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:1058: template argument 1 is
> invalid
> ../../../boost/regex/detail/regex_compile.hpp:1058: invalid use of
undefined type
> `class boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:1058: template argument 1 is
> invalid
> ../../../boost/regex/detail/regex_compile.hpp:979: invalid use of
undefined type
> `class boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:979: template argument 1 is
invalid
>
> ../../../boost/regex/detail/regex_compile.hpp:979: invalid use of
undefined type
> `class boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/detail/regex_compile.hpp:979: template argument 1 is
invalid
>
> ../../../boost/regex/detail/regex_compile.hpp:979:
>
`boost::reg_expression<__wchar_t,boost::c_regex_traits<__wchar_t>,jm_debug_a
lloc>::compile_set_aux(...)'
> has already been declared in
>
`boost::reg_expression<__wchar_t,boost::c_regex_traits<__wchar_t>,jm_debug_a
lloc>'
>
> ../../../boost/regex.hpp: In instantiation of
>
`boost::reg_expression<__wchar_t,boost::c_regex_traits<__wchar_t>,jm_debug_a
lloc>':
>
> regress/tests.cpp:619: instantiated from here
> ../../../boost/regex.hpp:492: invalid use of undefined type `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex/regex_traits.hpp:37: forward declaration of `class
> boost::c_regex_traits<__wchar_t>'
> ../../../boost/regex.hpp:707: confused by earlier errors, bailing out
>
>

 g++ -c -Wall -ftemplate-depth-100 -DBOOST_REGEX_NO_LIB=1 -DTEST_UNICODE=1
> -DBOOST_REGEX_STATIC_LINK=1 -D_STLP_DEBUG -g -O0 -fno-inline
> -D_STLP_USE_DYNAMIC_LIB -I"../../../libs/regex/test" -I"." -I"../../.."
> -isystem "c:/downloads/STLPort-0601/stlport" -o
>
"../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynami
c/tests.o"
> "regress/tests.cpp"
>
> ...failed gcc-C++-action
>
../../../libs/regex/test/bin/wregress/gcc-stlport/debug/runtime-link-dynamic
/tests.o
> ...
> ...skipped
> <libs!regex!test/wregress/gcc-stlport/debug/runtime-link-dynamic>wregress
for
> lack of
>
<libs!regex!test/wregress/gcc-stlport/debug/runtime-link-dynamic>parse.o...
> gcc-Link-action
>
../../../libs/regex/test/bin/posix_api_check_c/gcc-stlport/debug/runtime-lin
k-dynamic/posix_api_check_c
>
> ld: fatal: option -dn and -P are incompatible
> ld: fatal: Flags processing errors
> collect2: ld returned 1 exit status
>
> g++ -g -o
>
"../../../libs/regex/test/bin/posix_api_check_c/gcc-stlport/debug/runtime-li
nk-dynamic/posix_api_check_c"
> -Lc:/downloads/STLPort-0601/lib
>
"../../../libs/regex/test/bin/posix_api_check_c/gcc-stlport/debug/runtime-li
nk-dynamic/posix_api_check.o"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
> -lstlport_gcc_stldebug -Wl,-rpath-link,.
>
> ...failed gcc-Link-action
>
../../../libs/regex/test/bin/posix_api_check_c/gcc-stlport/debug/runtime-lin
k-dynamic/posix_api_check_c
> ...
> gcc-Link-action
>
../../../libs/regex/test/bin/wide_posix_api_check_c/gcc-stlport/debug/runtim
e-link-dynamic/wide_posix_api_check_c
>
> ld: fatal: option -dn and -P are incompatible
> ld: fatal: Flags processing errors
> collect2: ld returned 1 exit status
>
> g++ -g -o
>
"../../../libs/regex/test/bin/wide_posix_api_check_c/gcc-stlport/debug/runti
me-link-dynamic/wide_posix_api_check_c"
> -Lc:/downloads/STLPort-0601/lib
>
"../../../libs/regex/test/bin/wide_posix_api_check_c/gcc-stlport/debug/runti
me-link-dynamic/wide_posix_api_check.o"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
> -lstlport_gcc_stldebug -Wl,-rpath-link,.
>
> ...failed gcc-Link-action
>
../../../libs/regex/test/bin/wide_posix_api_check_c/gcc-stlport/debug/runtim
e-link-dynamic/wide_posix_api_check_c
> ...
> gcc-Link-action
>
../../../libs/regex/test/bin/posix_api_check/gcc-stlport/debug/runtime-link-
dynamic/posix_api_check
>
> ld: fatal: option -dn and -P are incompatible
> ld: fatal: Flags processing errors
> collect2: ld returned 1 exit status
>
> g++ -g -o
>
"../../../libs/regex/test/bin/posix_api_check/gcc-stlport/debug/runtime-link
-dynamic/posix_api_check"
> -Lc:/downloads/STLPort-0601/lib
>
"../../../libs/regex/test/bin/posix_api_check/gcc-stlport/debug/runtime-link
-dynamic/posix_api_check.o"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
>
"../../../libs/regex/build/bin/libboost_regex.a/gcc-stlport/debug/runtime-li
nk-dynamic/libboost_regex.a"
> -lstlport_gcc_stldebug -Wl,-rpath-link,.
>
> ...failed gcc-Link-action
>
../../../libs/regex/test/bin/posix_api_check/gcc-stlport/debug/runtime-link-
dynamic/posix_api_check
> ...
> gcc-C++-action
>
../../../libs/regex/test/bin/wide_posix_api_check/gcc-stlport/debug/runtime-
link-dynamic/wide_posix_api_check.o
>
> c_compiler_checks/wide_posix_api_check.cpp: In function `int main()':
> c_compiler_checks/wide_posix_api_check.cpp:41: `regex_tW' undeclared
(first use
> this function)
> c_compiler_checks/wide_posix_api_check.cpp:41: (Each undeclared identifier
is
> reported only once
> c_compiler_checks/wide_posix_api_check.cpp:41: for each function it
appears in.)
> c_compiler_checks/wide_posix_api_check.cpp:41: parse error before `;'
> c_compiler_checks/wide_posix_api_check.cpp:43: `re' undeclared (first use
this
> function)
> c_compiler_checks/wide_posix_api_check.cpp:43: implicit declaration of
function
> `int regcompW(...)'
> c_compiler_checks/wide_posix_api_check.cpp:47: implicit declaration of
function
> `int regerrorW(...)'
> c_compiler_checks/wide_posix_api_check.cpp:54: implicit declaration of
function
> `int regexecW(...)'
> c_compiler_checks/wide_posix_api_check.cpp:60: implicit declaration of
function
> `int regfreeW(...)'
>
> g++ -c -Wall -ftemplate-depth-100 -DBOOST_REGEX_NO_LIB=1
> -DBOOST_REGEX_STATIC_LINK=1 -D_STLP_DEBUG -g -O0 -fno-inline
> -D_STLP_USE_DYNAMIC_LIB -I"../../../libs/regex/test" -I"." -I"../../.."
> -isystem "c:/downloads/STLPort-0601/stlport" -o
>
"../../../libs/regex/test/bin/wide_posix_api_check/gcc-stlport/debug/runtime
-link-dynamic/wide_posix_api_check.o"
> "c_compiler_checks/wide_posix_api_check.cpp"
>
> ...failed gcc-C++-action
>
../../../libs/regex/test/bin/wide_posix_api_check/gcc-stlport/debug/runtime-
link-dynamic/wide_posix_api_check.o
> ...
> ...skipped
>
<libs!regex!test/wide_posix_api_check/gcc-stlport/debug/runtime-link-dynamic
>wide_posix_api_check
> for lack of
>
<libs!regex!test/wide_posix_api_check/gcc-stlport/debug/runtime-link-dynamic
>wide_posix_api_check.o...
>
> ...failed updating 8 targets...
> ...skipped 2 targets...
>
>
> John Maddock wrote:
>
> > > I am not able to get the regex shared library compiled. I am not
> > > concerned about this so much as I am about this error I get when I try
> > > to compile a program linked with boost regex:
> >
> > Looks like your linker is not finding the contents of the archive at
all,
> > the only thing that I know of that may cause this is a mistake in the
order
> > in which the libs appear on the command line, but it looks right to me.
> > What happens if you try and build the regex test or example programs
using
> > jam (libs/regex/test/Jamfile or libs/regex/example/Jamfile)?
> >
> > John Maddock
> > http://ourworld.compuserve.com/homepages/john_maddock/index.htm
> >
> > _______________________________________________
> > Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk