13 Replies Latest reply on Dec 19, 2008 5:14 PM by 807575

    Cannot compile boost libraries

    807575
      Hi. I have the following problem compiling boost 1.36 libraries. Some files fail to compile with the following error:

      ...failed sun.compile.c++ bin.v2/libs/math/build/sun/debug/link-static/cyl_bessel_il.o...
      sun.compile.c++ bin.v2/libs/math/build/sun/debug/link-static/cyl_bessel_jl.o
      "./boost/array.hpp", line 75: Error: Too few arguments for template std::reverse_iterator<boost::T*>.
      "./boost/array.hpp", line 289:     Where: While specializing "boost::array<boost::T, boost::N>".
      "./boost/array.hpp", line 289:     Where: Specialized in non-template code.
      "./boost/array.hpp", line 76: Error: Too few arguments for template std::reverse_iterator<const boost::T*>.
      "./boost/array.hpp", line 289:     Where: While specializing "boost::array<boost::T, boost::N>".
      "./boost/array.hpp", line 289:     Where: Specialized in non-template code.
      2 Error(s) detected.
      Some with this error:
      "libs/program_options/src/options_description.cpp", line 341: Error: Could not find a match for std::count<std::InputIterator, std::T, std::Size>(char*, char*, char) needed in::format_paragraph(std::ostream &, std::string, unsigned, unsigned).
      "libs/program_options/src/options_description.cpp", line 391: Error: Could not find a match for std::distance<std::ForwardIterator, std::Distance>(const char*, const char*const) needed in::format_paragraph(std::ostream &, std::string, unsigned, unsigned).
      "{code}
      
      Some with this error:
      {code}...failed sun.compile.c++ bin.v2/libs/wave/build/sun/debug/link-static/cpplexer/re2clex/aq.o...
      sun.compile.c++ bin.v2/libs/wave/build/sun/debug/link-static/cpplexer/re2clex/cpp_re.o
      "./boost/wave/util/flex_string.hpp", line 119: Error: Templates can only declare classes or functions.
      "./boost/wave/util/flex_string.hpp", line 122: Error: "," expected instead of "!=".
      "./boost/wave/util/flex_string.hpp", line 122: Error: A declaration was expected instead of "--".
      "./boost/wave/util/flex_string.hpp", line 122: Error: Multiple declaration for n.
      "./boost/wave/util/flex_string.hpp", line 122: Error: Use ";" to terminate declarations.
      "./boost/wave/util/flex_string.hpp", line 122: Error: A declaration was expected instead of "++".
      "./boost/wave/util/flex_string.hpp", line 122: Error: Use ";" to terminate declarations.
      "./boost/wave/util/flex_string.hpp", line 122: Error: A declaration was expected instead of "++".
      "./boost/wave/util/flex_string.hpp", line 122: Error: "," expected instead of ")".
      "./boost/wave/util/flex_string.hpp", line 126: Error: A declaration was expected instead of "return".
      "./boost/wave/util/flex_string.hpp", line 2473: Error: A declaration was expected instead of "}".
      "./boost/wave/util/flex_string.hpp", line 2474: Error: A declaration was expected instead of "}".
      "./boost/wave/token_ids.hpp", line 328: Error: flex_string is not a member of boost::wave::util.
      "./boost/wave/token_ids.hpp", line 328: Error: A declaration does not specify a tag or an identifier.
      "./boost/wave/token_ids.hpp", line 328: Error: Use ";" to terminate declarations.
      "./boost/wave/token_ids.hpp", line 328: Error: A declaration was expected instead of "<"./boost/wave/token_ids.hpp", line 328: Error: A declaration does not specify a tag or an identifier.
      "./boost/wave/token_ids.hpp", line 328: Error: Use ";" to terminate declarations.
      "./boost/wave/token_ids.hpp", line 328: Error: A declaration was expected instead of ",".
      "./boost/wave/token_ids.hpp", line 328: Warning: declarator required in declaration.
      "./boost/wave/token_ids.hpp", line 328: Error: Use ";" to terminate declarations.
      "./boost/wave/token_ids.hpp", line 328: Error: A declaration was expected instead of ",".
      "./boost/wave/token_ids.hpp", line 328: Warning: declarator required in declaration.
      "./boost/wave/token_ids.hpp", line 328: Error: Use ";" to terminate declarations.
      "./boost/wave/token_ids.hpp", line 328: Error: A declaration was expected instead of ",".
      "./boost/wave/token_ids.hpp", line 328: Error: CowString is not a member of boost::wave::util.
      "./boost/wave/token_ids.hpp", line 328: Error: A declaration does not specify a tag or an identifier.
      I am building using the following command:
      ./tools/jam/src/bin.solaris/bjam -sICU_PATH=/usr build-type=complete toolset=sun prefix=/home/gimenero/fuentes/libs/boost/boost_1_36_0 stdlib=sun-stlport instruction-set=v9 address-model=64 install

      My conf. is:

      gimenero@tst-bill1 ~$ uname -a
      SunOS tst-bill1 5.10 Generic_120011-14 sun4u sparc SUNW,SPARC-Enterprise

      gimenero@tst-bill1 ~$ CC -V
      CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
        • 1. Re: Cannot compile boost libraries
          807575
          Have a look at the instructions for compiling BOOST with Sun Studio here:
          [http://blogs.sun.com/sga/category/Boost]

          I don't think we've tried compiling 1.36 yet. It might be new problems.
          If you have determined that the compilation options are correct, maybe you could provide a reduced test case that shows a possible compiler bug.
          • 2. Re: Cannot compile boost libraries
            807575
            This seems like a new problem because version 1.35 compiles fine. How do I create a reduced test case?

            In my scenario I use bjam and the following command line:
            bjam toolset=sun build-type=complete stdlib=sun-stlport with-serialization stage

            Compiler's version is "CC: Sun C++ 5.8 2005/10/13". OS version is 5.10.

            Thank you,

            Konstantin

            Edited by: kostya on Aug 28, 2008 6:47 AM
            • 3. Re: Cannot compile boost libraries
              marc1842fr
              At least the first two errors look like configuration issues where -library=stlport4 was forgotten. Is there some kind of log where we could check what command line was used?
              By the way, the way CC adds namespace:: in front of template parameters in error messages is a bug.
              • 4. Re: Cannot compile boost libraries
                807575
                Yes that was the problem, I just wasn't modifying the user-config.jam correctly. I also modified the generated Makefile.
                Here's the final .configure command, user-config.jam and Makefile are:

                configure
                ./configure --with-toolset=sun --prefix=/home/gimenero/fuentes/libs/boost/boost_1_36_0 
                user-config.jam
                # Boost.Build Configuration
                # Automatically generated by Boost configure 
                
                # Compiler configuration
                using sun : 5.9 : /opt/SUNWspro/bin/CC : <stdlib>sun-stlport <cxxflags>-library=stlport4 -m64 -xcode=pic32 -erroff=wvarhidemem,hidevf,hidevfinvb -errtags=yes <link-flags>-library=stlport4 ;
                
                # Python configuration
                using python : 2.4 : /usr ;
                Makefile
                BJAM=./tools/jam/src/bin.solaris/bjam
                BJAM_CONFIG= -sICU_PATH=/usr
                prefix=/home/gimenero/fuentes/libs/boost/boost_1_36_0
                exec_prefix=$(prefix)
                libdir=$(exec_prefix)/lib
                includedir=$(prefix)/include
                LIBS=
                
                all: .dummy
                     @echo "$(BJAM) $(BJAM_CONFIG) --user-config=user-config.jam $(LIBS)"
                     @$(BJAM) $(BJAM_CONFIG) --user-config=user-config.jam $(LIBS) || \
                     echo "Not all Boost libraries built properly."
                
                clean: .dummy
                     rm -rf bin.v2
                
                distclean: clean
                     rm -rf Makefile config.log
                
                check: .dummy
                     @cd status && ../$(BJAM) $(BJAM_CONFIG) --user-config=../user-config.jam || echo "Some Boost regression tests failed. This is normal for many compilers."
                
                install: .dummy
                     @echo "$(BJAM) $(BJAM_CONFIG) --build-type=complete --user-config=user-config.jam --prefix=$(prefix) --exec-prefix=$(exec_prefix) --libdir=$(libdir) --includedir=$(includedir) $(LIBS) install"
                     @$(BJAM) $(BJAM_CONFIG) --build-type=complete --user-config=user-config.jam --prefix=$(prefix) --exec-prefix=$(exec_prefix) --libdir=$(libdir) --includedir=$(includedir) $(LIBS) install || echo "Not all Boost libraries built properly."
                
                .dummy:
                I still can't compile some libraries thou. The error messages are:
                sun.link bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass
                Undefined                       first referenced
                 symbol                             in file
                std::ios_base::_Loc_init::_Loc_init()  bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass.o
                std::ios_base::_Loc_init::~_Loc_init()  bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass.o
                ld: fatal: Symbol referencing errors. No output written to bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass
                
                    "/opt/SUNWspro/bin/CC" -s -mt   -o "bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass" "bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass.o"  -Bdynamic -lrt -Bstatic  -Bdynamic
                
                ...failed sun.link bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass...
                ...skipped <pbin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi>no_std_locale_pass.run for lack of <pbin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi>no_std_locale_pass...
                sun.link bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass
                Undefined                       first referenced
                 symbol                             in file
                std::ios_base::_Loc_init::_Loc_init()  bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::wstreambuf::_M_xsputnc(wchar_t,int) bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::streambuf::_M_xsputnc(char,int) bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::wstreambuf::xsputn(const wchar_t*,int) bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::streambuf::xsputn(const char*,int) bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::wstreambuf::xsgetn(wchar_t*,int) bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::wstreambuf::showmanyc() bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::streambuf::xsgetn(char*,int) bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                std::ios_base::_Loc_init::~_Loc_init()  bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                int std::streambuf::showmanyc() bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass.o
                ld: fatal: Symbol referencing errors. No output written to bin.v2/libs/config/test/all/no_std_wstreambuf_pass.test/sun-5.9/release/link-static/threading-multi/no_std_wstreambuf_pass
                .
                .
                .
                I guess you'll want a test case. I'll try to come up with one.
                • 5. Re: Cannot compile boost libraries
                  marc1842fr
                  Chila wrote:
                  "/opt/SUNWspro/bin/CC" -s -mt -o "bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass" "bin.v2/libs/config/test/all/no_std_locale_pass.test/sun-5.9/release/link-static/threading-multi/no_std_locale_pass.o" -Bdynamic -lrt -Bstatic -Bdynamic
                  I can't see -library=stlport4 in this command line...
                  It might be easiest to create a script that calls CC -library=stlport4 "$@" and tell boost to use that as a compiler, not to forget one.
                  • 6. Re: Cannot compile boost libraries
                    807575
                    The make process outputs a compilation line that is not the actual compilation line. I have made some small modifications to user-config.jam and the Makefile, and now it compiles fine. Now the files are:

                    user-config.jam
                    # Boost.Build Configuration
                    # Automatically generated by Boost configure 
                    
                    # Compiler configuration
                    using sun : 5.9 : /opt/SUNWspro/bin/CC : <stdlib>sun-stlport <cxxflags>-library=stlport4 -m64 -xcode=pic32 -erroff=wvarhidemem,hidevf,hidevfinvb -errtags=yes <linkflags>-library=stlport4 -m64 ;
                    
                    # Python configuration
                    using python : 2.4 : /usr ;
                    Makefile
                    BJAM=./tools/jam/src/bin.solaris/bjam
                    BJAM_CONFIG= -sICU_PATH=/usr
                    prefix=/home/gimenero/fuentes/libs/boost/boost_1_36_0
                    exec_prefix=$(prefix)
                    libdir=$(exec_prefix)/lib
                    includedir=$(prefix)/include
                    LIBS=
                    
                    all: .dummy
                         @echo "$(BJAM) $(BJAM_CONFIG) --user-config=user-config.jam $(LIBS)"
                         @$(BJAM) $(BJAM_CONFIG) --user-config=user-config.jam $(LIBS) || \
                         echo "Not all Boost libraries built properly."
                    
                    clean: .dummy
                         rm -rf bin.v2
                    
                    distclean: clean
                         rm -rf Makefile config.log
                    
                    check: .dummy
                         @cd status && ../$(BJAM) $(BJAM_CONFIG) --user-config=../user-config.jam || echo "Some Boost regression tests failed. This is normal for many compilers."
                    
                    install: .dummy
                         @echo "$(BJAM) $(BJAM_CONFIG) address-model=64 --user-config=user-config.jam --prefix=$(prefix) --exec-prefix=$(exec_prefix) --libdir=$(libdir) --includedir=$(includedir) $(LIBS) install"
                         @$(BJAM) $(BJAM_CONFIG) address-model=64 --user-config=user-config.jam --prefix=$(prefix) --exec-prefix=$(exec_prefix) --libdir=$(libdir) --includedir=$(includedir) $(LIBS) install || echo "Not all Boost libraries built properly."
                    
                    .dummy:
                    Now I'm compiling without --build-type=complete* but with *<linkflags>-library=stlport4 -m64* which was incorrectly set as "<link-flags>".

                    Thanks everyone for the replies.

                    Edited by: Chila on Sep 3, 2008 6:52 AM
                    • 7. Re: Cannot compile boost libraries
                      807575
                      Hi,

                      Adding the following line to user-config.jam did solve the problem:
                      using sun : : CC : <compileflags>-library=stlport4 <linkflags>-library=stlport4 ;

                      Thanks to everyone, who helped!

                      Konstantin
                      • 8. Re: Cannot compile boost libraries
                        807575
                        Hi,*

                        I am getting the followin*g errors when trying to compile

                        Error: Default arguments cannot be added in later declarations of the template function in the same scope.
                        "./boost/math/tools/precision.hpp", line 108: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
                        "./boost/math/tools/precision.hpp", line 116: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
                        "./boost/math/tools/precision.hpp", line 122: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
                        "./boost/math/tools/precision.hpp", line 128: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
                        "./boost/math/tools/precision.hpp", line 141: Error: Default arguments cannot be added in later declarations of the template function in the same scope.
                        "./boost/math/tools/precision.hpp", line 172: Error: Default arguments cannot be added in later declarations of the template function in the same scope.


                        I have done configuration as following

                        %> ./configure with-toolset=sun prefix=/u/jn/boost/boost_1_36_0

                        my usr-config.jam file looks as bellow

                        # Boost.Build Configuration
                        # Automatically generated by Boost configure

                        # Compiler configuration
                        using sun : 6 : /home/nfs/sollocal/beatlehome1/F6U2/SUNWspro/bin/CC : <stdlib>sun-stlport
                        <cxxflags>-library=stlport4 -m64 -xcode=pic32 -erroff=wvarhidemem,hidevf,hidevfinvb -errtag
                        s=yes <linkflags>-library=stlport4 -m64 ;

                        # Python configuration
                        using python : 2.6 : /usr/local ;


                        my Makefile
                        BJAM=./tools/jam/src/bin.solaris/bjam
                        BJAM_CONFIG= -sICU_PATH=/usr
                        prefix=/u/jnarayan/boost/boost_1_36_0
                        exec_prefix=$(prefix)
                        libdir=$(exec_prefix)/lib
                        includedir=$(prefix)/include
                        LIBS=

                        all: .dummy
                        @echo "$(BJAM) $(BJAM_CONFIG) --user-config=user-config.jam $(LIBS)"
                        @$(BJAM) $(BJAM_CONFIG) --user-config=user-config.jam $(LIBS) || \
                        echo "Not all Boost libraries built properly."

                        clean: .dummy
                        rm -rf bin.v2

                        distclean: clean
                        rm -rf Makefile config.log

                        check: .dummy
                        @cd status && ../$(BJAM) $(BJAM_CONFIG) --user-config=../user-config.jam || echo "S
                        ome Boost regression tests failed. This is normal for many compilers."

                        install: .dummy
                        @echo "$(BJAM) $(BJAM_CONFIG) address-model=64 user-config=user-config.jam pref
                        ix=$(prefix) exec-prefix=$(exec_prefix) libdir=$(libdir) --includedir=$(includedir) $(L
                        IBS) install"
                        @$(BJAM) $(BJAM_CONFIG) address-model=64 --user-config=user-config.jam --prefix=$(p
                        refix) --exec-prefix=$(exec_prefix) --libdir=$(libdir) --includedir=$(includedir) $(LIBS) i
                        nstall || echo "Not all Boost libraries built properly."

                        .dummy:

                        thanks in advance for your help


                        {code}{code}
                        • 9. Re: Cannot compile boost libraries
                          807575
                          You posted the same question in another thread:
                          [http://forums.sun.com/thread.jspa?threadID=5338800]

                          See my answer there.

                          Please do not post the same question in more than one thread.
                          • 10. Re: Cannot compile boost libraries
                            807575
                            While trying to compile boost 1.37, y discovered this:

                            In user-config.jam, the line:
                            using sun : 5.9 : /opt/SUNWspro/bin/CC : <stdlib>sun-stlport <cxxflags>-library=stlport4 -m64 -xcode=pic32 -erroff=wvarhidemem,hidevf,hidevfinvb -errtags=yes <linkflags>-library=stlport4 -m64 ;
                            should be:
                            using sun : 5.9 : /opt/SUNWspro/bin/CC : <stdlib>sun-stlport <cxxflags>"-library=stlport4 -m64 -xcode=pic32 -erroff=wvarhidemem,hidevf,hidevfinvb -errtags=yes" <linkflags>"-library=stlport4 -m64 -xcode=pic32" ;
                            With the quotes, otherwise, it doesn't take the arguments. The stlport+64bit mode worked because of "<stdlib>" flag in user-config.jam and "address-model=64" that is in the Makefile. Now that -m64 is taken,
                            "address-model=64" is no longer needed. The las flag "-xcode=pic32" in "using sun" was also missing. I was not able to generate dynamic libraries using boost libraries, now I can.

                            Boost Rulez!
                            • 11. Re: Cannot compile boost libraries
                              807575
                              There's some "accesibility problems" when trying to compile Boost 1.37.

                              sun.compile.c++ bin.v2/libs/thread/build/sun-5.9/release/link-static/threading-multi/thread.o
                              "./boost/thread/detail/thread.hpp", line 344: Error, inaccessible: boost::thread::thread(boost::thread&) is not accessible from boost::move(boost::detail::thread_move_t<boost::thread>).
                              1 Error(s) detected.


                              sun.compile.c++ bin.v2/libs/thread/build/sun-5.9/release/threading-multi/thread.o
                              "./boost/thread/detail/thread.hpp", line 344: Error, inaccessible: boost::thread::thread(boost::thread&) is not accessible from boost::move(boost::detail::thread_move_t<boost::thread>).
                              1 Error(s) detected.

                              I solved them by modifing the file at (boostDir)/boost/thread/detail/thread.hpp and making the thread(thread&) public:
                              .
                              .
                              .
                                  class BOOST_THREAD_DECL thread
                                  {
                                  public:
                                      thread(thread&);
                              
                                  private:
                              //        thread(thread&);
                                      thread& operator=(thread&);
                              .
                              .
                              .
                              This is of course just a patch, not the solution. I guess some friends are needed. Anyway, the problem is solved, just don't use the new public constructor,
                              since it is not intended for public use.

                              I'll inform the Boost people about the problem.
                              • 12. Re: Cannot compile boost libraries
                                807575
                                Chila,

                                Any idea about which boost release the "thread" copyconstructor problem will be fixed ?

                                Thanks
                                Pravlm
                                • 13. Re: Cannot compile boost libraries
                                  807575
                                  I'm not sure. I forgot to post the bug at boost but now I have. Here's the ticket: https://svn.boost.org/trac/boost/ticket/2602
                                  I hope they fix it soon.

                                  Regards.