Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7028833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:27:35+00:00 2026-05-28T00:27:35+00:00

I am using boost serialization. I compiled with: -L/opt/local/lib -lboost_serialization -stdlib=libc++ , but got

  • 0

I am using boost serialization. I compiled with: -L/opt/local/lib -lboost_serialization -stdlib=libc++, but got several (ungooglable) errors:

Undefined symbols for architecture x86_64:
  "boost::archive::text_oarchive_impl::save(std::__1::basic_string, std::__1::allocator > const&)", referenced from:
      void boost::archive::save_access::save_primitive, std::__1::allocator > >(boost::archive::text_oarchive&, std::__1::basic_string, std::__1::allocator > const&) in main.o
  "boost::archive::basic_text_oprimitive > >::~basic_text_oprimitive()", referenced from:
      boost::archive::text_oarchive_impl::~text_oarchive_impl() in main.o
  "boost::archive::text_oarchive_impl::text_oarchive_impl(std::__1::basic_ostream >&, unsigned int)", referenced from:
      boost::archive::text_oarchive::text_oarchive(std::__1::basic_ostream >&, unsigned int) in main.o
ld: symbol(s) not found for architecture x86_64

I am serializing an std::vector<std::string>:

boost::archive::text_oarchive oa(std::cout);
oa << tasks;

Is there a problem with my installation of boost?


The boost libraries are universal binaries containing both 32-bit and 64-bit machine code (so that’s not the problem I guess):

$ file libboost_serialization.dylib
libboost_serialization.dylib: Mach-O universal binary with 2 architectures
libboost_serialization.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libboost_serialization.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64

I installed boost using sudo port install boost +universal on Mac OS X 10.7.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:27:36+00:00Added an answer on May 28, 2026 at 12:27 am

    I could reproduce the problem using the following code:

    #include "boost/archive/text_oarchive.hpp"
    #include "boost/serialization/vector.hpp"
    #include <vector>
    #include <string>
    
    int main()
    {
        std::vector<std::string> tasks;
        boost::archive::text_oarchive oa(std::cout);
        oa << tasks;
    }
    

    This compiles and links without problems when using g++ or clang++ with their respective default flags and linking with -lboost_serialization. However, when using clang++ with libc++ linking fails with essentially the error messages quote (I have Boost installed at /opt/boost):

    clang++ -c -stdlib=libc++ -I/opt/boost -W -Wall -ansi serialize.cpp
    clang++ -o serialize.tsk -L/opt/boost/stage/lib -stdlib=libc++ serialize.o -lboost_serialization
    

    Based on this I assumed that a build with -stdlib=libc++ wants to have its own Boost build and build one using based on the Boost installation guide:

    tar jxvf ~/Downloads/boost_1_48_0.tar.bz2
    cd boost_1_48_0/tools/build/v2
    
    # change the build rules to use -stdlib=libc++:
    mv tools/clang-darwin.jam tools/clang-darwin.jam.orig
    sed -e 's/CONFIG_COMMAND)"/CONFIG_COMMAND)" -stdlib=libc++/' < tools/clang-darwin.jam.orig > tools/clang-darwin.jam
    
    ./boostrap.sh
    sudo ./b2 install --prefix=/opt/boost-clang
    cd ../../..
    /opt/boost-clang/bin/b2 --build-dir=/opt/tmp toolset=clang stage
    sudo /opt/boost-clang/bin/b2 --build-dir=/opt/tmp toolset=clang install --prefix=/opt/boost-clang
    

    The edits I made to clang-darwin.jam are almost certainly not those intended but they seem to do the trick: I don’t know much about “bjam” and I just tried to find an appropriate location to apply the change. Some step of the installation use sudo to install things into protected directories. Obviously, you can install into some other directory where you have write permissions as well. I just installed things on my machine in a way preventing me from accidentally messing it up.

    However, with this installation in place I could successfully build the program:

    /opt/llvm/bin/clang++ -stdlib=libc++ -W -Wall -ansi -I/opt/boost-clang  -c -o serialize.o serialize.cpp
    /opt/llvm/bin/clang++ -stdlib=libc++ -L/opt/boost-clang/lib serialize.o -lboost_serialization -o serialize.tsk
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using boost for several C++ projects. I recently made a upgrade (1.33.1 to
I have a problem using boost serialization using binary archives. It works when using
I am using boost serialization with xml files with a C++ program. When I
I am using boost::serialization in my project. The project is large, and serializes my
I am using boost::variant and boost::serialize in my application. The serialization module has built
I'm using boost singletons (from serialization). For example, there are some classes which inherit
I am trying to serialize a class to a string using the boost serialization
Is it possible to serialize data structures (using boost::serialization) into string variable or buffer
I've been using the Boost serialization library, which is actually pretty nice, and lets
so I'm using the boost::serialization library, and I'm trying to overide how a class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.