MongoDB 4.4+ scons build tool does not install files in destdir/prefix


I do not understand how scons works with 4.4, it does not install the files in DESTDIR/PREFIX.

Here’s the command I run:

PREFIX=/usr DESTDIR=/tmp/destdir python3 which scons --disable-warnings-as-errors install-servers

Which ends up in:

Install file: “build/opt/mongo/mongod” as “build/install/bin/mongod”
Install file: “build/opt/mongo/mongos” as “build/install/bin/mongos”
scons: done building targets.

That’s not what I asked for, I expect mongod to be installed in /tmp/destdir/usr/bin/mongod, can you help me ?


Hi @Adam_Adam - The PREFIX and DESTDIR flags aren’t shell variables, they are SCons variables: i.e. arguments to SCons. Try:

python3 which scons --disable-warnings-as-errors install-servers PREFIX=/usr DESTDIR=/tmp/destdir
1 Like

Hello, thanks for the response, I managed to have it working once like this, then it was ignored again.
I’m not sure, maybe it’s because I also run the unittests and don’t want them to be installed in the target folder.

Anyway, to be honest I gave up and just copy relevant files from build/install folder, but it used to work like a charm before 4.4 release, but I guess you have your reasons :wink:

@Adam_Adam -

The v4.4 release offers a lot more control over the build than was possible on prior stable branches. Note that you do not need to worry about having the tests and the server binaries co-located into the installation directory, because if you ever want to pick out just the server binaries, you can build the archive-servers target which will tar up only those files that form part of install-servers, no matter what may be in the installation directory. The PREFIX and DESTDIR SCons variables only have effect in v4.4 and newer. I don’t entirely know what you mean by “working like this once”, but maybe you tried it on an older branch where it doesn’t? If you are correctly passing those variables as arguments to SCons on v4.4 or newer, they should be honored and place the files as instructed. The archive targets will also respect the PREFIX. Could you please try it again? If for some reason it isn’t working for you, I’d really like to get to the bottom of the issue.