The following error is encountered when building cmake in an i386 poudriere jail running on amd64, an i386 chroot running on amd64, and on an i386 machine booted an i386 kernel. All three "machines" are running recent 14-CURRENT. Only i386 poudriere output shown. =======================<phase: package >============================ ===> Building package for cmake-3.21.0 pkg-static: archive_write_open_filename(/wrkdirs/usr/ports/devel/cmake/work/pkg/cmake-3.21.0.pkg): Cannot allocate memory *** Error code 1 Stop. make: stopped in /usr/ports/devel/cmake
=======================<phase: package >============================ ===> Building package for python27-2.7.18_1 pkg-static: archive_write_open_filename(/wrkdirs/usr/ports/lang/python27/work/pkg/python27-2.7.18_1.pkg): Cannot allocate memory *** Error code 1 Stop. make: stopped in /usr/ports/lang/python27 =>> Cleaning up wrkdir
=======================<phase: package >============================ ===> Building package for terminfo-db-20210816 pkg-static: archive_write_open_filename(/wrkdirs/usr/ports/misc/terminfo-db/work/pkg/terminfo-db-20210816.pkg): Cannot allocate memory *** Error code 1 Stop. make: stopped in /usr/ports/misc/terminfo-db =>> Cleaning up wrkdir
how much memory is used available for your build jails?
Default: none. No limit. The machine has 8 GB physical RAM. 250 MB swap was used. PARALLEL_JOBS is default. There are 4 cores in the machine. Note that this machine is running AMD64 but building i386 packages. I have an identical machine, also running AMD64, building amd64 packages instead which does not experience this problem.
Also note: This problem is reproducible in an i386 chroot (not jail, chroot) when building by hand. It is also reproducible when booting and running under an i386 kernel on the same machine (booted from an i386 partition on the same machine). This is not a poudriere problem. Nor is it a jail problem. All testing was performed on a recent 14-CURRENT. All running the same level of 14-CURRENT kernel.
This is not a pkg problem. The work around: disable ELF32 ASLR: kern.elf32.aslr.enable=0 kern.elf32.aslr.pie_enable=0
The implementation of ASLR in FreeBSD often exhausts the available address space on 32-bit ABIs for memory intensive processes. In fact, when I last tested this, armv7 and i386 couldn't even build world, not just ports. This is not a problem on 64-bit - everything should work fine there. But for now the only workaround on 32-bit (including 32-bit compatibility layer on 64-bit architectures) is disabling the ASLR entirely. I haven't tested architectures other than i386 and armv7 but I'm pretty sure that this applies to 32-bit PPC and MIPS too.
(In reply to Dawid Gorecki from comment #7) Should we close this PR? I'm ok with that, unless you feel it's worth the effort. I test on i386 and amd64. Multiple slices/partitions are relatively easy to maintain, though, 32-bit is well past its best before date.
(In reply to Cy Schubert from comment #8) Yeah, I personally don't think that it is worth the effort to try and debug the problem for 32-bit platforms. I'm also ok with closing this PR. The usefulness of ASLR on 32 bits is limited anyway. We also don't build the system on 32-bit architectures with PIE enabled by default for this reason.
32-bit platforms do not have the memory to properly support ASLR. Users are advised not to enable ASLR or PIE on 32-bit platforms such as i386.