[SERVER-16663] options requested in top-level SConstruct to support non-default libraries and includes Created: 24/Dec/14 Updated: 27/Mar/15 Resolved: 21/Jan/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | None |
| Fix Version/s: | 3.0.0-rc6 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Mark Callaghan | Assignee: | Jonathan Reams |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Sprint: | BUILD 1 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
I have a small diff but I am waiting for legal to let me know whether I can share that so I will describe the change. I am building MongoDB with a compiler and library toolchain that works "in production" so I don't want to use the default locations for libraries and include files. I ended up needing two options in the top-level SConstruct to make this work: 1) --dont-add-local-paths - this changes MongoDB to not add local paths. For example, I want to keep this from being added for 64-bit linux: 2) --linkflags - values here get appended to LINKFLAGS. I used this to add extra flags and libraries to link with jemalloc. I ended up using ":" as the option separator because options already use "," and the following is an example of a value I used: I can also use this to set rpath options, although I don't need to do that yet we do that for other binaries like mysqld... --linkflags="--enable-new-dtags:-Wl,-rpath=/path/to/production/lib" |
| Comments |
| Comment by Mark Callaghan [ 23/Mar/15 ] | |
|
For RPATH https://jira.mongodb.org/browse/SERVER-17694 I still haven't figured out the right way to quote it. If my shell script echoes the command line, I can copy/paste it to run scons. But if my shell script invokes scons directly, then it isn't working yet. My shell quoting knowledge is weak so I will ask a local expert. | |
| Comment by Andrew Morrow (Inactive) [ 23/Mar/15 ] | |
|
Hi mcallaghan@fb.com - Re the quoting, the single quotes worked fine for me for passing multiple arguments in via LINKFLAGS, both from the command line and from a shell script, at least on OS X. For the SCons RPATH variable: I agree we should have this. I just found a need for it myself and had been planning to add it. Would you mind filing a new ticket though? I think it is likely we would want to backport to 3.0 and the legacy C++ driver, and it would be easier to track that workflow under a new ticket. | |
| Comment by Mark Callaghan [ 23/Mar/15 ] | |
|
It works, but I still would like for SConstruct to support RPATH. I need to read up on shell quoting. I have a shell script that calls scons and using this in the shell script does work... But this works in the shell script | |
| Comment by Mark Callaghan [ 23/Mar/15 ] | |
|
Can you add RPATH too? CPPPATH worked for me but I get errors from LINKFLAGS for: Warning: the -W option is not yet implemented scons: *** Error converting option: LINKFLAGS — In MySQL 5.6 with cmake we do stuff like: ${CMAKE} ${CMAKE_FLAGS} -DWITH_MYSQLD_LDFLAGS="$MYSQLD_LDFLAGS" | |
| Comment by Jonathan Reams [ 21/Jan/15 ] | |
|
We added scons variables to set the initial values of ARFLAGS, CCFLAGS, CFLAGS, CPPDEFINES CPPPATH, CXXFLAGS, LIBPATH, LIBS, LINKFLAGS, SHCCFLAGS, SHCFLAGS, SHCXXFLAGS, and SHLINKFLAGS on the command line. Different flags are separated by a space, as though you were setting the corresponding shell environment variable.
| |
| Comment by Githook User [ 21/Jan/15 ] | |
|
Author: {u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}Message: | |
| Comment by Andrew Morrow (Inactive) [ 31/Dec/14 ] | |
|
Hi Mark - If we move to allowing command line overrides of things like CFLAGS, SHLINKFLAGS, etc., then I think it would be natural to extend that syntax to allow setting CPPPATH and LIBPATH as well, and probably deprecate or remove the cpppath, libpath, and extrapath options, which have less than ideal semantics at present. Thanks, | |
| Comment by Mark Callaghan [ 31/Dec/14 ] | |
|
I had another problem and my workaround is to change --extrapath so that it only sets paths for libraries and then added --extraincpath to do the same for include paths. I use gcc 4.8.1 and with non-standard library paths have been using --extrapath to find them, but that also added include paths and there was a compile error courtesy of some (questionable) code in src/mongo/crypto/tom/tomcrypt_custom.h that declares functions that libc provides leading to a compile error when the declarations did not match. <noformat> Which resulted in ...
void qsor(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); clock_t clock(void); void * memcpy(void *dest, const void *src, size_t n); int strcmp(const char *s1, const char *s2); | |
| Comment by Andrew Morrow (Inactive) [ 24/Dec/14 ] | |
|
Hi Mark - Thanks for the bug report. A few comments.
Overall, there is agreement that improvements along these lines would be beneficial. |