1

I'm trying to statically link to the boost regex library. I'm using the latest version of boost (1.54) and I can't seem to get it to work. I tried compiling the libraries by first running bootstrap.sh, and then b2 link=static.

When compiling my program, I am using the compiler flags -I/path/to/boost, and I add /path/to/boost/lib/libboost_regex.a as one of my linker objects. Making calls to boost::regex methods don't work as expected, such as boost::regex_search.

I have confirmed that my code works as expected when I link to the boost library dynamically. Is there some sort of initialization that needs to be performed when linking statically?

Brian Schlenker
  • 4,966
  • 6
  • 31
  • 44
  • 2
    A previous discussion suggests `-static` when compiling your program: http://stackoverflow.com/questions/2328439/boost-static-linking – Steve Howard Oct 15 '13 at 19:31

1 Answers1

1

I must have been doing something wrong. Adding libboost_regex.a to my list of linker objects seems to work fine.

Brian Schlenker
  • 4,966
  • 6
  • 31
  • 44