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 8459607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:22:39+00:00 2026-06-10T13:22:39+00:00

What’s the best practice for including Boost libraries in the built process? To illustrate,

  • 0

What’s the best practice for including Boost libraries in the built process?

To illustrate, assume that our project makes use of Boost’s regular expressions and is compiled as follows:

g++ -lboost_regex -o main main.cpp

… which means that I could write a Makefile which contains just the following:

LDFLAGS+=-lboost_regex

Unfortunately, this doesn’t work on my system:

$ make main
ld: library not found for -lboost_regex
collect2: error: ld returned 1 exit status

Which is understandable since I didn’t specify a library path, and Boost is installed in a location where the compiler doesn’t find it.

I don’t want to hard-code that path in my Makefile, obviously. Otherwise, the project cannot be built on other machines.

One solution would be to set LD_LIBRARY_PATH but this is discouraged.

The “real” solution for normal libraries is to use pkg-config, e.g. like this:

LDFLAGS+=$(shell pkg-config --libs sqlite3)

… which is resolved to something along the lines of -L/path/to/sqlite/lib -lsqlite3.

Unfortunately, Boost still doesn’t support pkg-config.

This leaves me in a dilemma. There doesn’t seem to be a universal way of determining the Boost library installation path. How do other projects handle this?

(Someone suggested the environment variable BOOST_ROOT but that doesn’t seem to be universally present either, you’d need to manually set it in on one of the bashrc/profile files.)

  • 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-06-10T13:22:41+00:00Added an answer on June 10, 2026 at 1:22 pm

    Since I’m the one who suggested using BOOST_ROOT, I may aswell put it up as an answer.

    Background: Boost’s bjam build program requires a BOOST_ROOT environment variable if it’s not executed inside the boosts installation root.
    With this thought, one might aswell “rely” on it, i.e. require it to be present when make is invoked by either having it as a full environment variable all the time or just have it set during the session / command like BOOST_ROOT=/foo/bar/boost make.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've built a PHP app, and I've read that it's a best-practice to use
The best practice seems to be to use assert for a condition that should
The Maven best practice page describes a single use of including a pom as
I have a question regarding best-practice when including headers. Obviously include guards protect us
Best practice is to use unique ivs, but what is unique? Is it unique
I was wondering what, if there is one, is the best practice for including
I am wondering what is the best practice for including class specific exception files.
What is the best practice for including image dimensions in HTML code. I had
I'm looking for the best practice for including GNU Bash in the cross-compilation of
I'm struggling trying to sort out what the best-practice is for putting a project

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.