# poudriere, mongodb36-3.6.23_1 build errors



## nerozero (Jun 11, 2022)

Hello, 

Cannot build mongodb36-3.6.23_1 (dependency from unifi6) . this is probably my 6-th try ...


```
build/opt/mongo/base/error_codes.h:922:11: warning: inline variables are a C++17 extension [-Wc++17-extensions]
constexpr inline bool isNamedCode<ErrorCodes::NotMasterNoSlaveOk> = true;
          ^
build/opt/mongo/base/error_codes.h:924:11: warning: inline variables are a C++17 extension [-Wc++17-extensions]
constexpr inline bool isNamedCode<ErrorCodes::NotMasterOrSecondary> = true;
          ^
build/opt/mongo/base/error_codes.h:926:11: warning: inline variables are a C++17 extension [-Wc++17-extensions]
constexpr inline bool isNamedCode<ErrorCodes::OutOfDiskSpace> = true;
          ^
build/opt/mongo/base/error_codes.h:928:11: warning: inline variables are a C++17 extension [-Wc++17-extensions]
constexpr inline bool isNamedCode<ErrorCodes::KeyTooLong> = true;
          ^
257 warnings generated.
257 warnings generated.
257 warnings generated.
scons: building terminated because of errors.
build/opt/mongo/mongod failed: Error 254
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mongodb36
=>> Cleaning up wrkdir
===>  Cleaning for mongodb36-3.6.23_1
build of databases/mongodb36 | mongodb36-3.6.23_1 ended at Sat Jun 11 13:05:03 +04 2022
build time: 01:00:43
!!! build failure encountered !!!
```

Thanks in advance for any hint


----------



## zirias@ (Jun 11, 2022)

This log excerpt doesn't show the reason for a failing build, warnings won't cause this. Search the log for the string `error:`.

Edit: For reproducing the problem, one would also need some meta info from the top of the build log: the make.conf used, the port options and the jail's FreeBSD version.


----------



## nerozero (Jun 11, 2022)

Zirias,

After greping logs, here what I found:


```
./bulk/freebsd_13_0_amd64_nox-HEAD/latest/logs/errors/mongodb36-3.6.23_1.log:LLVM ERROR: out of memory
./bulk/freebsd_13_0_amd64_nox-HEAD/latest/logs/errors/mongodb36-3.6.23_1.log:LLVM ERROR: out of memory
./bulk/freebsd_13_0_amd64_nox-HEAD/latest/logs/errors/mongodb36-3.6.23_1.log:c++: error: unable to execute command: Abort trap (core dumped)
./bulk/freebsd_13_0_amd64_nox-HEAD/latest/logs/errors/mongodb36-3.6.23_1.log:c++: error: linker command failed due to signal (use -v to see invocation)
```

this is 8GB ram +64GB swap. (dedicated entire SSD drive)
Nothing is running on this machine, cli interface <400MB usage wile not compiling .


----------



## zirias@ (Jun 11, 2022)

No amount of swap would ever help if a single process needs more RAM than what the OS can serve from physical RAM... of course, just a hypothesis here. As it's happening in the linker step (which requires to load all the object files into RAM at once), this _might_ be the culprit here.

A simple workaround could be to use ports-mgmt/poudriere-devel and enable package fetching, _if_ you don't have any local config (in make.conf or port options) affecting mongodb. Then, you could just use the binary package created on the official builders.

Another option might be to analyze whether LTO (link-time optimizations) are used in this port. If possible, deactivate it, because it greatly increases the amount of RAM needed for linking.


----------



## zirias@ (Jun 11, 2022)

What _might_ work as well (but chances are limited): Build with just `PARALLEL_JOBS=1` and also forbid make jobs at least for this port – just to avoid any other processes needlessly occupying RAM when the linker is executed.

But in general, 8GB are just too little nowadays for a package builder…


----------



## nerozero (Jun 12, 2022)

Zirias, Thank for suggesting, but ... I have tried all I could, but unfortunately - failed to built/prefetch montodb.

Regarding ports-mgmt/poudriere-devel.
I have modified the poudriere.conf and added there:


```
PACKAGE_FETCH_BRANCH=latest
PACKAGE_FETCH_URL=pkg+http://pkg.FreeBSD.org/\${ABI}
PACKAGE_FETCH_BLACKLIST=""
PACKAGE_FETCH_WHITELIST="gcc* rust llvm* mongodb*"
```

But poudriere still tries to build mongodb. I have default mongodb config (SASL=ON, SSL=ON)


----------



## zirias@ (Jun 12, 2022)

Does it fetch _other_ packages? IOW, does package fetching work _at all_?

If so, do you have anything in make.conf that could influence mongodb, e.g. some `DEFAULT_VERSIONS` settings?


----------



## nerozero (Jun 12, 2022)

Here is my poudriere make.conf:

```
WITH_CCACHE_BUILD=yes

# Disable sendmail!
NO_SENDMAIL=true

OPTIONS_SET+=MAKE_JOBS

# Fresh OpenSSL from Ports
DEFAULT_VERSIONS+=ssl=openssl

# Headless server options
OPTIONS_SET+=ICONV
OPTIONS_UNSET=CUPS DEBUG DOCS FONTCONFIG X11

#WITHOUT_X11=yes
WITH="" WITHOUT="X11"


# GSS-Api
OPTIONS_UNSET+= GSSAPI_BASE
OPTIONS_SET+=   GSSAPI_MIT

# vim
OPTIONS_SET+=   CONSOLE
OPTIONS_SET+=   MAKE_JOBS

# doxygen, disable graphics
OPTIONS_UNSET+=GRAPHVIZ
OPTIONS_UNSET+=LATEX

# cairo, disable opengl support
OPTIONS_UNSET += OPENGL
```


----------



## zirias@ (Jun 12, 2022)

nerozero said:


> ```
> # Fresh OpenSSL from Ports
> DEFAULT_VERSIONS+=ssl=openssl
> ```


With that, fetching isn't an option. SSL is enabled in the official package, but it links the OpenSSL version from base. Poudriere detects that difference, because the package you're attempting to build would have a lib dependency on OpenSSL from ports, which isn't present in the official package.

If you don't want to drop that (and my other suggestions don't help), maybe it's time to go buy some RAM


----------



## nerozero (Jun 12, 2022)

Zirias, Thanks, looks like that was the case. Its fetching mongodb !


----------



## zirias@ (Jun 12, 2022)

Just a side note on the remainder of your make.conf: If you want to set/unset options for specific packages, use the variables for them. Each package has an "options name", which is for example listed on freshports. You could do e.g. this:

```
# vim
editors_vim_SET+=   CONSOLE MAKE_JOBS
```
Note this is just taking the options you already have, although editors/vim doesn't know either of them, just to demonstrate the syntax. In this specific case, you can just delete that part....

I personally love this way of specifying port options a lot, it's IMHO much more maintainable than setting specific port options with poudriere-options(8). Here's my make.conf for reference (probably containing some outdated stuff, gotta do a cleanup again...):

```
DEFAULT_VERSIONS+= ssl=libressl samba=4.13

OPTIONS_UNSET+= GSSAPI_BASE GSSAPI_NONE HEIMDAL ALSA JACK PULSE PULSEAUDIO
OPTIONS_SET+= GSSAPI_MIT SNDIO PORTAUDIO

devel_android-tools-adb_UNSET+= MDNSRESPONDER
devel_e2fsprogs-libss_SET+= KRBSUPP_MIT
devel_e2fsprogs-libss_UNSET+= KRBSUPP_BASE
devel_electron7_SET+= ALSA
editors_libreoffice_SET+= JAVA KDE5 SYSTRAY WEBDAV
editors_libreoffice_UNSET+= GTK2 GTK3
emulators_i386-wine_SET+= GECKO MONO CUPS LIBXSLT MPG123
emulators_wine_SET+= GECKO MONO CUPS LIBXSLT MPG123
ftp_curl_UNSET+= TLS_SRP
games_eduke32_SET+= HRP OFFENSIVE FULL
graphics_darktable_UNSET+= FLICKR GEO LUA
graphics_gimp-app_SET+= GHOSTSCRIPT
graphics_gtkam_SET+= GIMP
graphics_gtkam_UNSET+= GNOME
graphics_sane-backends_UNSET+= AVAHI GPHOTO
irc_bitlbee_SET+= LIBPURPLE OTR
irc_bitlbee_UNSET+= SKYPE MSN TWITTER JABBER OSCAR
irc_irssi_SET+= OTR PROXY
java_openjdk8_SET+= ALSA
mail_exim_UNSET+= CONTENT_SCAN DKIM DNSSEC EMBEDDED_PERL AUTH_CRAM_MD5 AUTH_PLAINTEXT AUTH_SPA PASSWD MAILDIR MAILSTORE MBX
multimedia_audacious-plugins_SET+= AMIDI LAME MODPLUG OPENGL SID
multimedia_mplayer_SET+= BLURAY XVMC
multimedia_qt5-multimedia_SET+= ALSA
net-im_pidgin_SET+= SASL
net_freeradius3_SET+= WINBIND MITKRB_PORT
#net_freerdp_SET+= BROKENFOCUS FAAC FAAD FFMPEG GSM OPENH264
net_freerdp_SET+= FAAC FAAD FFMPEG GSM OPENH264
net_samba413_SET+= CUPS BIND916
net_samba413_UNSET+= GSSAPI_BUILTIN DEBUG
news_tin_SET+= SLRNFACE
print_cups-filters_UNSET+= AVAHI
print_cups_UNSET+= AVAHI
security_i2pd_SET+= AESNI
#security_openssh-portable_SET+= KERB_GSSAPI MIT
security_stunnel_SET+= LIBRESSL_PATCH
security_sudo_UNSET+= GSSAPI_MIT
security_uacme_UNSET+= DOCS EXAMPLES UALPN
sysutils_apcupsd_SET+= CGI
sysutils_apcupsd_UNSET+= APCDUMB_DRV APCSMART_DRV PCNET_DRV SNMP_DRV
www_elinks_SET+= ICONV IDN
www_firefox_UNSET+= ALSA JACK
www_nginx_UNSET+= PCRE_ONE
www_nginx_SET+= PCRE_TWO
x11-servers_xorg-server_UNSET+= SUID
x11-wm_fvwm3_SET+= GO ICONS SVG
x11-wm_lxqt-panel_SET+= ALSA
x11_xscreensaver_UNSET+= SETUID

DISABLE_VULNERABILITIES=yes
LICENSES_ACCEPTED+= MAKEMKV commercial

ICA_CERTS=Sectigo_RSA_Domain_Validation_Secure_Server_CA.pem
KRB5_VERSION= 119

.if ${.CURDIR:M*/www/node*}
OPTIONS_SET+= BUNDLED_SSL
.endif

.if ${.CURDIR:M*/devel/valgrind}
CFLAGS+= -DELF_NOTE_GNU=\\\"GNU\\\"
.endif
```


----------



## nerozero (Jun 12, 2022)

Zirias, I was looking exactly that kind of things. Thank you so much for sample!


----------



## Alain De Vos (Jun 13, 2022)

mongodb50 compiles fine.


----------



## nerozero (Jun 13, 2022)

Alain De Vos, could you please share your RAM/swap size ?


----------

