linuxboostboost-pythonboost-buildbjam

Boost::Python: Passing custom arguments to gcc when building python-extension


I need to pass -Wl,-rpath,\$$ORIGIN/lib/ to g++'s linker (reason). Is there a way to pass this argument in Jamroot file?


Solution

  • Ivan Vucica already described how to do it by modifying the toolset. Another option is to add it to the properties of the project. At the top of your Jamroot, add the following rule (or modify a pre-existing project rule).

    project
      : requirements
          <toolset>gcc:<linkflags>"-Wl,-rpath,\\$ORIGIN/lib"
      ;
    

    This will only affect gcc on this project, and works even if the current using gcc ; command is called from outside Jamroot (as in Ubuntu's default configuration).

    There might be a better way by somehow modifying the python-for-extensions alias that Boost.Build links against when calling python-extension, but I'm not sure how to do it, or even if it can be done.