Upgrade Guide to MongoDB 4.2 from 4.0 - Studio3T/robomongo GitHub Wiki
Check: Build-Mongodb-From-Source
For 4.2
// From https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
To build the master branch, you will need:
A modern and complete C++17 compiler. One of the following is required:
VS 2017 version 15.9 or newer
GCC 8.0 or newer
Clang 7 (or Apple XCode 10 Clang) or newer
On Linux and macOS, the libcurl library and header is required. MacOS includes libcurl.
Fedora/RHEL - dnf install libcurl-devel
Ubuntu/Debian - apt-get install libcurl-dev
Python 3.7
See these docs on how to install these tool upgrades:
https://github.com/Studio3T/robomongo/blob/master/docs/BuildRobo3TOnWindows.md
https://github.com/Studio3T/robomongo/blob/master/docs/BuildRobo3TOnMacAndLinux.md
b) Robo 3T Requirements
Due to compiler change, update to Qt msvc2017:
http://download.qt.io/archive/qt/5.12/5.12.8/
[to be updated... this step is still in progress]
(Todo: Can we find pre-built OpenSSL? To check => https://wiki.openssl.org/index.php/Binaries)
a) Check and update project OpenSSL version if it is changed by MongoDB.
https://docs.mongodb.com/manual/tutorial/configure-ssl/
Starting in version 4.0, MongoDB uses the native TLS/SSL OS libraries:
Windows : Secure Channel (Schannel)
Linux/BSD : OpenSSL
macOS : Secure Transport
https://www.openssl.org/source/old/1.0.1/
Method-1:
Check the file version of E:\Program Files\MongoDB\Server\4.0\bin\ssleay32.dll
Method-2:
OpenSSL version used by Mongo can be seen in MongoDB 3.4 server logs at start:
C:\Program Files\MongoDB\Server\3.4>bin\mongod.exe --port 27018
...
2017-06-08T18:05:32.660+0300 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips 22 Sep 2016
...
b) Build OpenSSL
See build pages on https://github.com/Studio3T/robomongo/wiki
Make a clone of last working local robomongo and robomongo-shell folders as backup.
a) Update robomongo-shell
Version
- Find the latest release version on https://www.mongodb.com/download-center/community (e.g. 4.0.4 for for 4.0)
- Check out new robo-shell branch from mongo branch
r3.4.3
(for 4.0 'r4.0.4' used) tag. (Find r versions instead of v) Update the tags if required:git remote add upstream https://github.com/mongodb/mongo.git git fetch upstream
b) Build robomongo-shell
- Check/update
bin/*
files of robo/robo-shell for each platform - See: https://github.com/Studio3T/robomongo/wiki
c) Apply Robomongo changes into new robomongo-shell.
d) Build robomongo-shell again after code changes
- For macOS & ubuntu: Do the final clean build with output to file.
Example macOS release build:build > build_output\mac_rel.txt
First, check/make notes of cmake/config related changes for all last version commits.
a) Update \robomongo\bin\configure.bat
with updated compiler (if needed)
Example: From "Visual Studio x 20yz Win64" to "Visual Studio j 20kl Win64"
b) Update \robomongo\cmake\FindMongoDB.cmake
with updated versions of 3rd party libs.
Example: boost, mozjs etc..
c) Update \robomongo\cmake\mongodb\
release and debug objects
Windows
- Delete file
build/opt/mongo/mongo.exe
for Windows (orbuild/opt/mongo/mongo
for other OSes) robomongo-shell\bin\build > build_output\win_rel.txt // Windows
robomongo-shell\bin\build debug > build_output\win_deb.txt // Windows
- Remove 'build\debug\mongo\shell\dbshell.obj' from both files
macOS & Ubuntu
- Do clean builds with output to file (if you did not already)
Example macOS release build:build > build_output\mac_rel.txt
- See section z-1) Object File Parser
- Copy object file names from out.txt into
robomongo\cmake\mongodb\*.objects
files accordingly. - For next step, if Robo build fails, make sure there is no other file types than *.o. in
robomongo\cmake\mongodb\*.objects
files. - Remove "build/opt/mongo/shell/dbshell.o" from \cmake\mongodb<macosx or ubuntu>-release.objects in case of error:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
More:
https://github.com/Studio3T/robomongo/blob/master/cmake/mongodb/README.md
d) Build robomongo
See: https://github.com/Studio3T/robomongo/wiki
Important: Check robo-shell build output "*.lib"s (-lxx for Linux) to solve robomongo link errors
e) Connect to localhost If crashes during connection are seen, make sure Robo do the same as "mongo.exe" initializes mongo shell.
f) Connect to Mongo Atlas to test SSL and Replica Set
- Make sure robo-shell SSL patches are applied
g) Connect to remote server with SSH
h) Check run, install and pack commands are working
open x64 Native Tools Command Prompt for VS 2017
cl /EHsc obj_file_parser.cpp
obj_file_parser.exe mac_rel.txt // for macOS release build output
Check if out.txt file consists of *.o
relative paths
// obj_file_parser.cpp
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
/*
This command line program parses macOS & Ubuntu robo-shell build output files
(e.g. mac_rel.txt) and extracts relative paths of objects into "output.txt" to
update (robomongo\cmake\mongodb\*.objects) files
*/
int main(int argc, char* argv[])
{
if(argc < 2) {
cerr << "Error: Please pass the input file as argument" << endl;
return 1;
}
std::ifstream inFile(argv[1]); // clean build output file of robo-shell
ofstream outFile("out.txt"); // Copy content of this file into Robo repo *.objects file
std::string line;
std::string const gcc("gcc -o"), gpp("g++ -o");
auto gccLine = [&] { return line.compare(0, gcc.length(), gcc) == 0; };
auto gppLine = [&] { return line.compare(0, gpp.length(), gpp) == 0; };
while (std::getline(inFile, line))
{
if (gccLine() || gppLine() && line.find(".o") != std::string::npos)
{
// Cut 7 chars ("gcc -o " or "g++ -o ") from line start
auto const objStr = line.substr(7, line.find(".o") - 5);
if (objStr.find(' ') == std::string::npos) { // Process only if it has no space
outFile << objStr << ' ';
// cout << objStr << endl; // for debugging
}
// Old logic - for debugging
// cout << line.substr(7, line.find(".o") - 5) << endl;
}
}
cout << "Info: See \"out.txt\" file for object strings" << endl;
outFile.close();
}