Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gdal] x64-linux build failure (terminated with signal 9 [Killed]) RESOLVED: not enough RAM #19705

Closed
timmeh87 opened this issue Aug 23, 2021 · 4 comments

Comments

@timmeh87
Copy link
Contributor

Host Environment

  • OS: ubuntu 18 LTS via windows Hyperv "quick create"
  • Compiler: gcc

To Reproduce
Steps to reproduce the behavior:
BRAND NEW VM on hyperv via quick create (note, I do install a lot of extra packages here but this always my standard build environment)

sudo apt update
sudo apt -y install build-essential gcc-multilib g++-multilib automake premake4 cmake autoconf libtool dos2unix curl zip unzip pkg-config nasm
sudo apt -y install libglu1-mesa-dev libgl1-mesa-dev flex libbison-dev libgtk-3-dev gfortran libwebkitgtk-3.0-dev libsoup2.4 
git clone https://www.github.com/microsoft/vcpkg
cd vcpkg
./bootstrap_vcpkg.sh
./vcpkg install gdal

Failure logs
Building package gdal[core]:x64-linux...
-- Downloading http://download.osgeo.org/gdal/3.2.2/gdal322.zip -> gdal322.zip...
-- Cleaning sources at /home/tim/vcpkg/buildtrees/gdal/src/gdal322-72f0ed28fc.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/tim/vcpkg/downloads/gdal322.zip
-- Applying patch 0001-Fix-debug-crt-flags.patch
-- Applying patch 0002-Fix-build.patch
-- Applying patch 0004-Fix-cfitsio.patch
-- Applying patch 0005-Fix-configure.patch
-- Applying patch 0003-Fix-static-build.patch
-- Using source at /home/tim/vcpkg/buildtrees/gdal/src/gdal322-72f0ed28fc.clean
-- Getting CMake variables for x64-linux-dbg
-- Getting CMake variables for x64-linux-rel
-- Generating configure for x64-linux
-- Finished generating configure for x64-linux
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:155 (message):
Command failed: /usr/bin/make V=1 -j 21 -f GNUmakefile all
Working Directory: /home/tim/vcpkg/buildtrees/gdal/x64-linux-dbg
See logs for more information:
/home/tim/vcpkg/buildtrees/gdal/build-x64-linux-dbg-out.log
/home/tim/vcpkg/buildtrees/gdal/build-x64-linux-dbg-err.log

Call Stack (most recent call first):
scripts/cmake/vcpkg_build_make.cmake:190 (vcpkg_execute_build_process)
scripts/cmake/vcpkg_install_make.cmake:26 (vcpkg_build_make)
ports/gdal/portfile.cmake:343 (vcpkg_install_make)
scripts/ports.cmake:140 (include)

Error: Building package gdal:x64-linux failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with ./vcpkg update, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: gdal:x64-linux
Vcpkg version: 2021-08-12-unknownhash

Additional context
I made a brand new fresh machine just to test this before making an issue. I did do a quick search and found out that GDAL has a ton of previous issues that were fixed (#9068) but nothing that looks like it would help me. Usually I can fix a pacakge if it is just missing another package or something but in this case I do not see any meaningful error message other than it has failed.

:108: recipe for target 'gdal_contour' failed
GNUmakefile:102: recipe for target 'gdaladdo' failed
GNUmakefile:93: recipe for target 'gdalmdiminfo' failed
GNUmakefile:96: recipe for target 'gdalmdimtranslate' failed
make[1]: Leaving directory '/home/tim/vcpkg/buildtrees/gdal/x64-linux-dbg/apps'
GNUmakefile:120: recipe for target 'apps-target' failed

ar: creating /home/tim/vcpkg/buildtrees/gdal/x64-linux-dbg/libgdal.a
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[1]: *** [gdal_contour] Error 1
make[1]: *** Waiting for unfinished jobs....
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[1]: *** [gdaladdo] Error 1
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[1]: *** [gdalmdiminfo] Error 1
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[1]: *** [gdalmdimtranslate] Error 1
make: *** [apps-target] Error 2

dbg-log.txt
dbg-err.txt
full gdal logs.zip

I hesitate to tag random people for my own trivial issues but since #9068 was so very recently worked on by @dg0yt I'm wondering if you have any insights specifically?

One last tidbit... I swear I built GDAL successfully on a lubuntu 18 machine about 3 weeks ago. Not sure how that would help me now though

@dg0yt
Copy link
Contributor

dg0yt commented Aug 23, 2021

collect2: fatal error: ld terminated with signal 9 [Killed]

Maybe the build was running out of memory? I see four such lines, which I would interpret as four parallel jobs. Now vcpkg supports only static linkage on Linux, and the resulting binaries are huge, in particular for the debug builds.

@timmeh87
Copy link
Contributor Author

Thank you for your quick reply. I think you are right. I turned off the VM, changed the hardware like this:

old:
20 cores (its a xeon machine Im not being stupid, this is actually the default from "quick create")
8gb ram

new:
2 cores
20 gm ram

And guess what, gdal builds fine now. It was definitely doing a 21-core parallel build before (21??? yeah idk, gdal default I assume)
I ran "free -m" while it is running and it is using about 14gb

              total        used        free      shared  buff/cache   available
Mem:          19643       14738        2307          28        2597        4555
Swap:             0           0           0

So I guess its not really a problem with gdal. Depending on how you look at it. Is there some way we can warn people better? Just a thought. I think the windows ubuntu VM by default has no swap file which further compounds the issue. Maybe we could just put a warning that comes from the portfile and says "warning: gdal on linux uses a ton of ram and multicore systems with less than 16gb of ram might experience strange failures"

OR

we could patch (?) gdal to only use 1 or 2 cores instead of trying to use for example 21 cores and maybe that will ease issues

OR

close this issue now and let people search this page with the error message and figure it out on their own

@dg0yt
Copy link
Contributor

dg0yt commented Aug 23, 2021

Most of the time, you do want strong concurrency. But you can retry a failed port with a limited number of parallel jobs by setting VCPKG_MAX_CONCURRENCY.

For gdal, we have an open PR which makes building the tools optional, and even disables the debug variant: #19243. However, review stalled over a particular combination of features although there is no regression.

@timmeh87
Copy link
Contributor Author

All is not lost, it looks like #19243 has some new activity just 2 hours after it was mentioned here. :). I will close this issue because after reading these GDAL threads It looks like several main contributors already have a good handle on the complex issues facing GDAL. Also a possible fix is in the pipeline (build with no tools)

@timmeh87 timmeh87 changed the title [gdal] x64-linux build failure [gdal] x64-linux build failure (terminated with signal 9 [Killed]) RESOLVED: not enough RAM Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants