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

  • Home
  • SEARCH
  • 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 793009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:04:58+00:00 2026-05-14T22:04:58+00:00

My job mostly consists of engineering analysis, but I find myself distributing code more

  • 0

My job mostly consists of engineering analysis, but I find myself distributing code more and more frequently among my colleagues. A big pain is that not every user is proficient in the intricacies of compiling source code, and I cannot distribute executables.

I’ve been working with C++ using Boost, and the problem is that I cannot request every sysadmin of every network to install the libraries. Instead, I want to distribute a single source file (or as few as possible) so that the user can g++ source.c -o program.

So, the question is: can you pack the Boost libraries with your code, and end up with a single file? I am talking about the Boost libraries which are “headers only” or “templates only”.

As an inspiration, please look at the distribution of SQlite or the Lemon Parser Generator; the author amalgamates the stuff into a single source file which is trivial to compile.

Thank you.

Edit:

A related question in SO is for Windows environment. I work in Linux.

  • 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-14T22:04:58+00:00Added an answer on May 14, 2026 at 10:04 pm

    There is a utility that comes with boost called bcp, that can scan your source and extract any boost header files that are used from the boost source. I’ve setup a script that does this extraction into our source tree, so that we can package the source that we need along with our code. It will also copy the boost source files for a couple of boost libraries that we use that are no header only, which are then compiled directly into our applications.

    This is done once, and then anybody who uses the code doesn’t even need to know that it depends on boost. Here is what we use. It will also build bjam and bcp, if they haven’t been build already.

    #!/bin/sh
    BOOST_SRC=.../boost_1_43_0
    DEST_DIR=../src/boost
    TOOLSET=
    if ( test `uname` = "Darwin") then
        TOOLSET="--toolset=darwin"
    fi
    
    # make bcp if necessary
    if ( ! test -x $BOOST_SRC/dist/bin/bcp ) then
        if ( test -x $BOOST_SRC/tools/jam/*/bin.*/bjam ) then
            BJAM=$BOOST_SRC/tools/jam/*/bin.*/bjam
        else
            echo "### Building bjam"
            pushd $BOOST_SRC/tools/jam
            ./build_dist.sh
            popd
            if ( test -x $BOOST_SRC/tools/jam/*/bin.*/bjam ) then
                BJAM=$BOOST_SRC/tools/jam/*/bin.*/bjam
            fi
    
        fi
        echo "BJAM: $BJAM"
        pushd $BOOST_SRC/tools/bcp
        echo "### Building bcp"
        echo "$BJAM $TOOLSET"
        $BJAM $TOOLSET
        if [ $? == "0" ]; then
            exit 1;
        fi
        popd
    fi
    
    if ( ! test -x $BOOST_SRC/dist/bin/bcp) then
        echo "### Couldn't find bpc"
        exit 1;
    fi
    
    mkdir -p $DEST_DIR
    
    echo "### Copying boost source"
    MAKEFILEAM=$DEST_DIR/libs/Makefile.am
    rm $MAKEFILEAM
    # Signals
    # copy source libraries
    mkdir -p $DEST_DIR/libs/signals/src
    cp $BOOST_SRC/libs/signals/src/* $DEST_DIR/libs/signals/src/.
    echo -n "boost_sources += " >> $MAKEFILEAM
    for f in `ls $DEST_DIR/libs/signals/src | fgrep .cpp`; do
        echo -n "boost/libs/signals/src/$f " >> $MAKEFILEAM
    done
    echo >> $MAKEFILEAM
    
    echo "### Extracting boost includes"
    $BOOST_SRC/dist/bin/bcp --scan --boost=$BOOST_SRC ../src/*/*.[Ch] ../src/boost/libs/*/src/*.cpp ../src/smart_assert/smart_assert/priv/fwd/*.hpp $DEST_DIR
    if [ $? != "0" ]; then
        echo "### bcp failed"
        rm -rf $DEST_DIR
        exit 1;
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more of a theoretical question rather than language specific, but I'm mostly
I am starting a job with a mid size company working mostly on writing
The application's code and configuration files are maintained in a code repository. But sometimes,
I know that Job.all returns an array of all jobs. But, what would be
I've been learning matlab for the past week as my job requires it, but
My job would be easier, or at least less tedious if I could come
I have a job interview tomorrow for a .NET shop. For the past few
In my last job we ended up rewriting the complete ASP.NET stack (forms, controls,
On my side job as programmer, I am to write a program in C++
I have a cron job on an Ubuntu Hardy VPS that only half works

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.