Compiling your own C, C++ and Fortran code in Eugo
Audience: people who compile their own native code inside the Eugo container, by hand, through
make/cmake/meson, or indirectly through a Python package that builds an extension at install time.The one thing to take away: if a compile stops with
clang: error: invalid argument '-fwhole-program-vtables' only allowed with '-flto', something added-fno-lto. Add-fno-whole-program-vtablesnext to it and the compile runs (sections 2 and 3).Applies to: the Eugo image, November 2026.
1. The compilers in the image
Section titled “1. The compilers in the image”clang, clang++ and flang are in the image, and a bare compile just works:
$ clang -O2 -c hello.c # rc 0$ clang -O2 hello.c # rc 0To see exactly what your driver is really running, ask it:
$ clang -### -O2 -c hello.c # prints the full command line it runsIf you see invalid argument '-std=gnu++23' not allowed with 'C', a tool ran clang++ on C input: compile C
with clang.
Meson older than 1.3 does this when it checks the C compiler, so use Meson 1.3 or newer.
2. The error you see when -fno-lto is added
Section titled “2. The error you see when -fno-lto is added”If a compile stops at once with this error, something added -fno-lto:
$ clang -O2 -fno-lto -c hello.cclang: error: invalid argument '-fwhole-program-vtables' only allowed with '-flto'The driver stops before compiling anything. The fix is to add -fno-whole-program-vtables next to -fno-lto
(section 3). This is the whole failure. It is not a broken image, a missing header, or your code.
2.1. You may never have typed -fno-lto yourself
Section titled “2.1. You may never have typed -fno-lto yourself”This is the part that costs people an afternoon. Build systems add -fno-lto on your behalf, and then the
error surfaces from somewhere you were not looking:
- CMake and Autoconf probes that compile a throwaway snippet with
-fno-lto: the probe fails, and the build system silently concludes your compiler is broken, or that some unrelated feature is unavailable. - Rust's
cccrate (cc-rs) compiling C helper files for a crate you depend on. - Any upstream
Makefileormeson.buildthat hard-codes-fno-ltofor one target.
If you see the error above and you did not write -fno-lto, search the generated build files and the configure log
for it before suspecting anything else.
3. The fix: never write a bare -fno-lto, always pair it
Section titled “3. The fix: never write a bare -fno-lto, always pair it”Whenever you pass -fno-lto to clang or clang++, pass -fno-whole-program-vtables with it. Appending both to
your flags works:
export CFLAGS+=" -fno-lto -fno-whole-program-vtables"export CXXFLAGS+=" -fno-lto -fno-whole-program-vtables"Or on a single command line:
$ clang -O2 -fno-lto -fno-whole-program-vtables -c hello.c # rc 03.1. Fortran is the exception and needs only one flag
Section titled “3.1. Fortran is the exception and needs only one flag”If flang stops with this error and produces no object file, -fno-whole-program-vtables reached it:
$ flang -fno-whole-program-vtables ...flang-24: error: unknown argument: '-fno-whole-program-vtables'flang does not accept that flag at all, so remove it from FFLAGS. Fortran needs only the one flag:
export FFLAGS+=" -fno-lto"3.2. Use the pair on the whole project, never on one file
Section titled “3.2. Use the pair on the whole project, never on one file”If you add -fno-lto, add it (with its pair) to every file in that project, not to one file: mixing the two
can build and link with no error or warning and then misbehave at run time. So: whole project, both flags, or
neither.
4. Quick reference
Section titled “4. Quick reference”| If you see | Do this |
|---|---|
clang: error: invalid argument '-fwhole-program-vtables' only allowed with '-flto' |
something added -fno-lto; add -fno-whole-program-vtables next to it, for C and C++ |
flang-24: error: unknown argument: '-fno-whole-program-vtables' |
remove that flag from FFLAGS; for Fortran, -fno-lto alone is enough |
invalid argument '-std=gnu++23' not allowed with 'C' |
compile C with clang, not clang++ (Meson 1.3 or newer) |
5. Status
Section titled “5. Status”Pairing the two flags is the supported fix, not a temporary workaround. A bare -fno-lto keeps giving the
error in section 2.
6. GMP and MPFR: ours is the default, and gnutls's FIPS mode refuses it
Section titled “6. GMP and MPFR: ours is the default, and gnutls's FIPS mode refuses it”Eugo's images ship their own GMP and MPFR, and those copies are the ones every program in the image loads, Fedora's
own programs included (gawk, coreutils' factor, gnutls, ...). They are also the ones every build finds by default:
the headers (gmp.h, mpfr.h) sit in /usr/local/include, which the compiler searches by itself, and the
libraries in /usr/local/lib64, which the linker searches. So naming the libraries is enough, and pkg-config works
too:
clang app.c -lmpfr -lgmp # MPFR (it needs GMP as well)clang app.c -lgmp # GMP onlyclang app.c $(pkg-config --cflags --libs mpfr) # the same through pkg-configclang rsa.c $(pkg-config --cflags --libs hogweed nettle) # nettle's RSA/ECDSA code, which calls GMP tooYour program needs no run path: the system loader finds Eugo's copies before Fedora's. This works wherever the compilers, headers and pkg-config files are installed; a program you build there also runs in images without them.
Six MPFR functions are missing. Eugo's MPFR has no mpfr_get_decimal64, mpfr_set_decimal64,
mpfr_get_decimal128, mpfr_set_decimal128, mpfr_get_float128 or mpfr_set_float128, which Fedora's MPFR has:
they need decimal floating-point types and _Float128, which clang does not provide on this processor. Nothing in
the image calls them. But a program built elsewhere against Fedora's MPFR that calls one of them fails in these
images with symbol lookup error: ... undefined symbol: mpfr_set_float128 (or the function it called): at the first
call when it was linked the usual way, at start-up when it was linked with -Wl,-z,now.
FIPS mode. gnutls, in FIPS mode, checks the fingerprint of the GMP library it has loaded against Fedora's, and
Eugo's GMP does not match. So in FIPS mode every program that uses gnutls stops with Error while performing self checks (for example dirmngr: Fatal: gnutls_global_init failed). gnutls turns FIPS mode on by itself when the
host's kernel was booted with fips=1, and when GNUTLS_FORCE_FIPS_MODE=1 is set. This is a known limitation of
Eugo's images, accepted on purpose; nothing in the image works around it. If you need gnutls's FIPS mode, do not use
these images on a FIPS host.
7. valgrind cannot run programs in our images for SVE processors: use the sanitizers instead
Section titled “7. valgrind cannot run programs in our images for SVE processors: use the sanitizers instead”Our images do not include valgrind. There is no valgrind command and no valgrind/memcheck.h header.
If you install valgrind yourself, it cannot run anything on our images for Arm processors with SVE (Arm's wide
vector instructions). Every program, even /bin/true, is stopped with SIGILL ("illegal instruction") before its
main runs. The programs and libraries in those images use SVE instructions, and valgrind's translator for Arm
processors does not know them (neither version 3.27.1, the one tried, nor valgrind's current development code), so it
stops the program at the first one it meets, which comes before main even in a plain C program. This was measured
on one such image; the others were not tried, and their processors also have SVE.
- Emptying
/etc/ld.so.preload(that file makes every program load our C++ library, which uses SVE), in a throwaway container used only for the valgrind run, lets programs that do not use our C++ library run under valgrind. Python and Ray link that library themselves, so they still stop. - torch's
Timer.collect_callgrind()and Ray's valgrind switches such asRAY_RAYLET_VALGRINDdo not work in our images either.
On a Graviton2-based image the processor has no SVE, and valgrind did run /bin/true and python3 -c pass. A
second limit shows up there: valgrind stops with Max number of guard pages is too low when a program starts many
threads. A small C program with 64 threads stopped, and so did one with 256; with 16 threads it ran. This happens on
Linux 6.13 and later. Raise the limit on valgrind's own command line:
valgrind --max-guard-pages=1000000 ./myprogPutting --max-guard-pages in the VALGRIND_OPTS environment variable does not help: valgrind accepts it there but
reads it too late. The kernel that AWS Fargate tasks run on was not checked.
Use the sanitizers instead. They are part of Eugo's compilers, so they are available wherever the compilers are,
need nothing installed, and work without any change to your other flags. AddressSanitizer
(-fsanitize=address) catches memory errors such as writing past the end of a buffer or using memory after it was
freed. UndefinedBehaviorSanitizer (-fsanitize=undefined) catches mistakes such as a signed integer overflowing.
$ clang++ -g -O1 -fsanitize=address heap_overflow.cpp -o heap_overflow # rc 0, with warnings (below)$ ./heap_overflow==179==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xfbd8355e0020 at pc 0xab277a2a0714 bp 0xffffe1194530 sp 0xffffe1194528WRITE of size 4 at 0xfbd8355e0020 thread T0 #0 0xab277a2a0710 in main /tmp/work/heap_overflow.cpp:6:20...SUMMARY: AddressSanitizer: heap-buffer-overflow /tmp/work/heap_overflow.cpp:6:20 in main...==179==ABORTING # exit code 1
$ clang -g -O1 -fsanitize=undefined signed_overflow.c -o signed_overflow # rc 0, with warnings (below)$ ./signed_overflowsigned_overflow.c:5:11: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior signed_overflow.c:5:11-2147483648 # exit code 0: it reports and carries onThree things worth knowing:
- UndefinedBehaviorSanitizer reports and lets the program continue. Add
-fno-sanitize-recover=undefinedto make it stop at the first error with exit code 1. - If the link prints about twenty lines that begin
--lto-validate-all-vtables-have-type-infos: RTTI missing for vtable _ZTVN11__sanitizer…, do nothing: they come from the sanitizer's own runtime. The build still succeeds and the checks work. - If a tiny test program reports nothing, check that the optimizer did not remove the bad access. A C test that
wrote one element past a
malloc'd buffer and read it straight back reported nothing at-O1(the optimizer worked out the answer and deleted the access), and reported the overflow at-O0. When the bad index came from input the compiler could not see, as it does in real code, the overflow was caught at-O1and at-O2.
8. The static analyzers: name clang when you call scan-build or intercept-build
Section titled “8. The static analyzers: name clang when you call scan-build or intercept-build”The images that ship the compilers also ship clang's analyzers: clang-tidy, clangd (the language server editors and JupyterLab use),
clang-include-cleaner, scan-build (the clang static analyzer run over a whole build) and intercept-build (which
writes the compile_commands.json that clang-tidy and clangd read). Our images have no cc or c++ command,
and two of these tools fall back to exactly those names unless you tell them otherwise. A bash shell in the image
sets CC=clang and CXX=clang++ for you, so make itself finds clang there; the tools' own fallbacks ignore that.
scan-build: always pass the compilers:
scan-build --use-cc=clang --use-c++=clang++ make # rc 0 and "scan-build: 1 bug found." on a planted null dereferenceWithout --use-cc/--use-c++ the build itself fails (make: *** [...] Error 255) and scan-build reports
No bugs found., because its compiler wrapper tried to run cc. Add --status-bugs to get exit code 1 when it
finds a bug. On an older image that does not yet include Eugo's own Perl (/usr/local/bin/perl),
scan-build stops at once with Can't locate FindBin.pm in @INC: three Perl modules it needs are missing from the
system Perl. Install them with dnf install -y perl-FindBin perl-Hash-Util perl-Sys-Hostname (measured: with the
three installed, the planted bug is reported).
intercept-build: name clang twice, for the tool and for the build:
intercept-build --use-cc clang --use-c++ clang++ make CC=clang CXX=clang++sed -i -e 's/"command": "cc /"command": "clang /' -e 's/"command": "c++ /"command": "clang++ /' compile_commands.jsonclang-tidy -p . -checks='clang-analyzer-*' my_file.cpp--use-cc clang --use-c++ clang++is for intercept-build itself: it builds a small interception library with that compiler, and with the defaultccthat build fails and nothing is recorded.make CC=clang CXX=clang++is for the build: make's own default iscctoo. In a bash shell it already hasCC=clang, but naming it makes the command work everywhere. Measured withCC/CXXremoved: both together record the build;make CC=clangalone records nothing;--use-cc clangalone stops withmake: cc: No such file or directory.- The
sedline is needed because intercept-build writes every command ascc …orc++ …, whatever compiler ran. clang-tidy and clangd then pick their settings by that name and cannot find the C++ standard library headers ('memory' file not found). With the names rewritten toclang/clang++, clang-tidy reads the database and reports as it should. - Name the checks you want. With no
-checksoption and no.clang-tidyfile, clang-tidy stops withError: no checks enabled.(exit code 1). Pass them on the command line, as above, or putChecks: "clang-analyzer-*"in a.clang-tidyfile in your project (measured: both report the planted null dereference). - A CMake project needs none of this: configure it with
-DCMAKE_EXPORT_COMPILE_COMMANDS=ONand CMake writes the database with the real compiler names.
scan-build-py (the Python version of scan-build, also shipped) does not work in our images yet: it stops with
scan-build-py: Internal error. Use the Perl scan-build above.
See also
Section titled “See also”- The guide to installing Python packages, in this Guides section: a
pip installthat builds a native extension goes through these same compilers, so the-fno-ltoerror in section 2 can surface from pip.
© 2026 Eugo Inc. · Third-party licenses · LinkedIn (opens in new tab) · YouTube (opens in new tab) · GitHub (opens in new tab)

