Hi Valentin -
That would certainly work, however, I have a few comments:
- SCons doesn't propagate the shell environment by default, but you can override that behavior in the MongoDB build by passing the --propogate-shell-environment to scons. Note however, that SCons choice to not make those variables available is there explicitly to permit repeatable builds. Opening the door to arbitrary shell environments affecting the build is risky.
- Your wrapper scripts are certainly a viable approach, but you will need to keep them around, which is sort of a pain.
- How you build your toolchain is, of course, up to you, but I personally would consider a toolchain that required that LD_LIBRARY_PATH be set in order to invoke its components to be broken. You should investigate how to build GCC such that the necessary runtime link path is set in DT_RPATH or DT_RUNPATH for the compiler components, so that you don't need LD_LIBRARY_PATH at all.
- If the custom toolchain that you have built includes a dynamic libstdc++, you must ensure that this libstdc++ is found by mongod when it is run, rather than a system default one. To do so when libstdc++ is in a non-standard location may require that you set a runpath for the mongo binaries that points into your custom toolchain's library directory, if GCC is not automatically doing this for you. Otherwise you will also need LD_LIBRARY_PATH in your environment when you run mongod. Potentially, you can work around this by tunneling in an RPATH setting by customizing the LINKFLAGS Variable to scons, by saying 'scons LINKFLAGS=-Wl,-rpath=/path/to/needed/runtime/lib'
- In my opinion, you should try to avoid LD_LIBRARY_PATH if at all possible.
I hope the above proves useful. Please let me know if there is anything more I can help you with.
Andrew