Build mongo current on OpenBSD : find egcc, ssl.h

The --dbg flag enables additional runtime checks within the server build, usually those deemed too expensive to be retained in a production build. It also enables the debugallocation subsystem of gperftools if you are building with the builtin version of that (which you are, by default), which catches some classes of memory use errors. One some platforms it may opt you into a debugging enabled C++ runtime. A build made with --dbg on is definitely not suitable for production use.

The --dbg flag does not, as is often and incorrectly assumed, have anything to do with whether we build with debugging symbols (e.g. the -g switch to GCC). We always build with debug symbols, and there is no switch to disable it. As a result, the binaries can be quite large. If you would like the binaries to be “production” sized like what you would get from our prebuilt packages, you can retain the debugging information as separated files by building with the --separate-debug flag. On non-windows paltforms, adding that flag will enable new installation and archiving targets with a -debug suffix which will install and archive just the debug symbols, respectively.

scons ... --separate-debug archive-servers{,-debug}

will get you two tgz files: one of debuginfo stripped server binaries, and another of the separated debug info for those binaries. Note that on windows, debug information is always separated into PDB files, so you don’t need to use the flag or the extra package name.

1 Like

Oh, one more fun fact about the --dbg flag: when specified, it changes the build system default so as to disable compiler optimization in the interest of providing a better experience under debuggers. So if you are using the --dbg flag and you still want compiler optimization enabled, you need to explicitly opt in with --opt.

Basically, don’t use --dbg unless you are doing server development.

1 Like

Thanks for the tips. I’m making glacial progress :slight_smile:

It is becoming obvious that if I wish to continue to pursue this, I’m going to have to allocate a more powerful machine.

1 Like

Hi @Jack_Woehr,

Have a look at this thread Build from source error in MongoDB v4.4 - #3 by Zikker

I had a similar problem before


Thank you very much for the insight @Andrew_Morrow ! I was dealing with missing user stacks while doing off-CPU analysis on mongodb, I’ll see if the dbg flag will help me with that

1 Like

You maybe would also look into this post:

MongoDB 6.0 is already compiling for FreeBSD, but it is segfaulting, maybe this will be also related to OpenBSD.
Maybe have a look here how mongodb 6.0 is build for FreeBSD:
https://cgit.freebsd.org/ports/tree/databases/mongodb60