* [Buildroot] [RFC PATCH 0/3] package/llvm-project: drop debug info from the binary
@ 2025-06-26 11:16 Alex Bennée
2025-06-26 11:16 ` [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs Alex Bennée
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Alex Bennée @ 2025-06-26 11:16 UTC (permalink / raw)
To: buildroot
The llvm build directory is massive despite being a Release build.
This is caused by leakage from the default CMAKE flags. Clean up the
recipe to modernise it before finally reducing the build size by
overriding CXX_FLAGS and C_FLAGS for the CMake build.
Alex.
Alex Bennée (3):
package/llvm-project: use ninja to build llvm libs
package/llvm-project: drop unused TERMINFO config flags
package/llvm-project: reduce the build size of llvm
package/llvm-project/llvm/llvm.mk | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 14+ messages in thread* [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs 2025-06-26 11:16 [Buildroot] [RFC PATCH 0/3] package/llvm-project: drop debug info from the binary Alex Bennée @ 2025-06-26 11:16 ` Alex Bennée 2025-07-02 21:40 ` Romain Naour via buildroot 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 2/3] package/llvm-project: drop unused TERMINFO config flags Alex Bennée 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm Alex Bennée 2 siblings, 1 reply; 14+ messages in thread From: Alex Bennée @ 2025-06-26 11:16 UTC (permalink / raw) To: buildroot; +Cc: Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Using ninja is recommended as it is faster than the default GNU make build method. Make the switch. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- package/llvm-project/llvm/llvm.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk index 7552e3590c..8fe7d10fe0 100644 --- a/package/llvm-project/llvm/llvm.mk +++ b/package/llvm-project/llvm/llvm.mk @@ -13,8 +13,10 @@ LLVM_CPE_ID_VENDOR = llvm LLVM_SUPPORTS_IN_SOURCE_BUILD = NO LLVM_INSTALL_STAGING = YES -HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake -LLVM_DEPENDENCIES = host-llvm +HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake host-ninja +LLVM_DEPENDENCIES = host-llvm host-ninja + +LLVM_CMAKE_BACKEND = ninja # Path to cmake modules from host-llvm-cmake HOST_LLVM_CONF_OPTS += -DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm @@ -166,8 +168,8 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" # Default is Debug build, which requires considerably more disk space and # build time. Release build is selected for host and target because the linker # can run out of memory in Debug mode. -HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release +HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja +LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja # Compile llvm with the C++14 (ISO C++ 2014 standard). HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 -- 2.47.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs Alex Bennée @ 2025-07-02 21:40 ` Romain Naour via buildroot 2026-02-04 16:11 ` Thomas Devoogdt 0 siblings, 1 reply; 14+ messages in thread From: Romain Naour via buildroot @ 2025-07-02 21:40 UTC (permalink / raw) To: Alex Bennée, buildroot Cc: Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Hello Alex, All, Le 26/06/2025 à 13:16, Alex Bennée a écrit : > Using ninja is recommended as it is faster than the default GNU make > build method. Make the switch. Ninja is usually faster for incremental builds (for llvm developers [1]) but since we usually use Buildroot for building target images from sources ninja may not really faster than Make. Since we add host-ninja in the dependencies, is really faster in the end? Note: on some build machine with a recent enough cmake tool, the host-cmake is not used. [1] https://llvm.org/docs/GettingStarted.html > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > package/llvm-project/llvm/llvm.mk | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk > index 7552e3590c..8fe7d10fe0 100644 > --- a/package/llvm-project/llvm/llvm.mk > +++ b/package/llvm-project/llvm/llvm.mk > @@ -13,8 +13,10 @@ LLVM_CPE_ID_VENDOR = llvm > LLVM_SUPPORTS_IN_SOURCE_BUILD = NO > LLVM_INSTALL_STAGING = YES > > -HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake > -LLVM_DEPENDENCIES = host-llvm > +HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake host-ninja > +LLVM_DEPENDENCIES = host-llvm host-ninja > + > +LLVM_CMAKE_BACKEND = ninja What about other llvm-project related package such Clang? Best regards, Romain > > # Path to cmake modules from host-llvm-cmake > HOST_LLVM_CONF_OPTS += -DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm > @@ -166,8 +168,8 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" > # Default is Debug build, which requires considerably more disk space and > # build time. Release build is selected for host and target because the linker > # can run out of memory in Debug mode. > -HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release > -LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release > +HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja > +LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja > > # Compile llvm with the C++14 (ISO C++ 2014 standard). > HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs 2025-07-02 21:40 ` Romain Naour via buildroot @ 2026-02-04 16:11 ` Thomas Devoogdt 2026-02-04 16:35 ` Romain Naour via buildroot 0 siblings, 1 reply; 14+ messages in thread From: Thomas Devoogdt @ 2026-02-04 16:11 UTC (permalink / raw) To: buildroot Hello Alex, Romain, All, On 7/2/25 23:40, Romain Naour via buildroot wrote: > Hello Alex, All, > > Le 26/06/2025 à 13:16, Alex Bennée a écrit : >> Using ninja is recommended as it is faster than the default GNU make >> build method. Make the switch. > Ninja is usually faster for incremental builds (for llvm developers [1]) but > since we usually use Buildroot for building target images from sources ninja may > not really faster than Make. > > Since we add host-ninja in the dependencies, is really faster in the end? > Note: on some build machine with a recent enough cmake tool, the host-cmake is > not used. > > [1] https://llvm.org/docs/GettingStarted.html > >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >> --- >> package/llvm-project/llvm/llvm.mk | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk >> index 7552e3590c..8fe7d10fe0 100644 >> --- a/package/llvm-project/llvm/llvm.mk >> +++ b/package/llvm-project/llvm/llvm.mk >> @@ -13,8 +13,10 @@ LLVM_CPE_ID_VENDOR = llvm >> LLVM_SUPPORTS_IN_SOURCE_BUILD = NO >> LLVM_INSTALL_STAGING = YES >> >> -HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake >> -LLVM_DEPENDENCIES = host-llvm >> +HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake host-ninja >> +LLVM_DEPENDENCIES = host-llvm host-ninja Why selecting host-ninja? This is handled by the package/pkg-cmake.mk infrastructure when setting the _CMAKE_BACKEND to ninja. >> + >> +LLVM_CMAKE_BACKEND = ninja > What about other llvm-project related package such Clang? > > Best regards, > Romain > > >> >> # Path to cmake modules from host-llvm-cmake >> HOST_LLVM_CONF_OPTS += -DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm >> @@ -166,8 +168,8 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" >> # Default is Debug build, which requires considerably more disk space and >> # build time. Release build is selected for host and target because the linker >> # can run out of memory in Debug mode. >> -HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release >> -LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release >> +HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >> +LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja Why would it be needed to add -GNinja, this should be handled by the package/pkg-cmake.mk infrastructure. >> >> # Compile llvm with the C++14 (ISO C++ 2014 standard). >> HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 Kr, Thomas Devoogdt _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs 2026-02-04 16:11 ` Thomas Devoogdt @ 2026-02-04 16:35 ` Romain Naour via buildroot 0 siblings, 0 replies; 14+ messages in thread From: Romain Naour via buildroot @ 2026-02-04 16:35 UTC (permalink / raw) To: Thomas Devoogdt, buildroot Hello Thomas, Alex, All, Le 04/02/2026 à 17:11, Thomas Devoogdt a écrit : > Hello Alex, Romain, All, > > > On 7/2/25 23:40, Romain Naour via buildroot wrote: >> Hello Alex, All, >> >> Le 26/06/2025 à 13:16, Alex Bennée a écrit : >>> Using ninja is recommended as it is faster than the default GNU make >>> build method. Make the switch. >> Ninja is usually faster for incremental builds (for llvm developers [1]) but >> since we usually use Buildroot for building target images from sources ninja may >> not really faster than Make. >> >> Since we add host-ninja in the dependencies, is really faster in the end? >> Note: on some build machine with a recent enough cmake tool, the host-cmake is >> not used. >> >> [1] https://llvm.org/docs/GettingStarted.html >> >>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >>> --- >>> package/llvm-project/llvm/llvm.mk | 10 ++++++---- >>> 1 file changed, 6 insertions(+), 4 deletions(-) >>> >>> diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/ >>> llvm.mk >>> index 7552e3590c..8fe7d10fe0 100644 >>> --- a/package/llvm-project/llvm/llvm.mk >>> +++ b/package/llvm-project/llvm/llvm.mk >>> @@ -13,8 +13,10 @@ LLVM_CPE_ID_VENDOR = llvm >>> LLVM_SUPPORTS_IN_SOURCE_BUILD = NO >>> LLVM_INSTALL_STAGING = YES >>> -HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake >>> -LLVM_DEPENDENCIES = host-llvm >>> +HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake host-ninja >>> +LLVM_DEPENDENCIES = host-llvm host-ninja > > > Why selecting host-ninja? This is handled by the package/pkg-cmake.mk > infrastructure when setting the _CMAKE_BACKEND to ninja. > > >>> + >>> +LLVM_CMAKE_BACKEND = ninja >> What about other llvm-project related package such Clang? >> >> Best regards, >> Romain >> >> >>> # Path to cmake modules from host-llvm-cmake >>> HOST_LLVM_CONF_OPTS += -DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm >>> @@ -166,8 +168,8 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" >>> # Default is Debug build, which requires considerably more disk space and >>> # build time. Release build is selected for host and target because the linker >>> # can run out of memory in Debug mode. >>> -HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release >>> -LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release >>> +HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >>> +LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja > > > Why would it be needed to add -GNinja, this should be handled by the package/ > pkg-cmake.mk infrastructure. I'll mark this patch as "Changes requested". Alex, maybe you can try to set 'HOST_LLVM_CMAKE_BACKEND = ninja' instead ? Best regards, Romain > > >>> # Compile llvm with the C++14 (ISO C++ 2014 standard). >>> HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 > > > Kr, > > > Thomas Devoogdt > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 2/3] package/llvm-project: drop unused TERMINFO config flags 2025-06-26 11:16 [Buildroot] [RFC PATCH 0/3] package/llvm-project: drop debug info from the binary Alex Bennée 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs Alex Bennée @ 2025-06-26 11:16 ` Alex Bennée 2025-07-02 21:42 ` Romain Naour via buildroot 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm Alex Bennée 2 siblings, 1 reply; 14+ messages in thread From: Alex Bennée @ 2025-06-26 11:16 UTC (permalink / raw) To: buildroot; +Cc: Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit The build complains about these being unused so drop them. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- package/llvm-project/llvm/llvm.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk index 8fe7d10fe0..78aa6fe467 100644 --- a/package/llvm-project/llvm/llvm.mk +++ b/package/llvm-project/llvm/llvm.mk @@ -133,10 +133,6 @@ LLVM_CONF_OPTS += -DENABLE_CRASH_OVERRIDES=ON HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_FFI=OFF LLVM_CONF_OPTS += -DLLVM_ENABLE_FFI=OFF -# Disable terminfo database (needs ncurses libtinfo.so) -HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_TERMINFO=OFF -LLVM_CONF_OPTS += -DLLVM_ENABLE_TERMINFO=OFF - # Enable thread support HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_THREADS=ON LLVM_CONF_OPTS += -DLLVM_ENABLE_THREADS=ON -- 2.47.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 2/3] package/llvm-project: drop unused TERMINFO config flags 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 2/3] package/llvm-project: drop unused TERMINFO config flags Alex Bennée @ 2025-07-02 21:42 ` Romain Naour via buildroot 0 siblings, 0 replies; 14+ messages in thread From: Romain Naour via buildroot @ 2025-07-02 21:42 UTC (permalink / raw) To: Alex Bennée, buildroot Cc: Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Hello Alex, All, Le 26/06/2025 à 13:16, Alex Bennée a écrit : > The build complains about these being unused so drop them. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Applied to master, thanks. Best regards, Romain > --- > package/llvm-project/llvm/llvm.mk | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk > index 8fe7d10fe0..78aa6fe467 100644 > --- a/package/llvm-project/llvm/llvm.mk > +++ b/package/llvm-project/llvm/llvm.mk > @@ -133,10 +133,6 @@ LLVM_CONF_OPTS += -DENABLE_CRASH_OVERRIDES=ON > HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_FFI=OFF > LLVM_CONF_OPTS += -DLLVM_ENABLE_FFI=OFF > > -# Disable terminfo database (needs ncurses libtinfo.so) > -HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_TERMINFO=OFF > -LLVM_CONF_OPTS += -DLLVM_ENABLE_TERMINFO=OFF > - > # Enable thread support > HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_THREADS=ON > LLVM_CONF_OPTS += -DLLVM_ENABLE_THREADS=ON _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm 2025-06-26 11:16 [Buildroot] [RFC PATCH 0/3] package/llvm-project: drop debug info from the binary Alex Bennée 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs Alex Bennée 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 2/3] package/llvm-project: drop unused TERMINFO config flags Alex Bennée @ 2025-06-26 11:16 ` Alex Bennée 2025-07-02 22:37 ` Romain Naour via buildroot 2 siblings, 1 reply; 14+ messages in thread From: Alex Bennée @ 2025-06-26 11:16 UTC (permalink / raw) To: buildroot; +Cc: Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Although we request a Release build the default CMAKE flags in toolchain.cmake include -Og -g3 which enables debug symbols for the build inflating the overall size of things. For now just copy those defaults into the project mk file and drop the -Og and -g3 lines. This drops the size of the llvm build directory on my arm64 build from 17Gb to a more reasonable 4.4Gb. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- package/llvm-project/llvm/llvm.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk index 78aa6fe467..03684084c4 100644 --- a/package/llvm-project/llvm/llvm.mk +++ b/package/llvm-project/llvm/llvm.mk @@ -167,6 +167,16 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja +# Reduce the opportunity for default [C|CXX]_FLAGS to fatten the build +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF +LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF + +HOST_LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" +LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" + +HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" +LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" + # Compile llvm with the C++14 (ISO C++ 2014 standard). HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 -- 2.47.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm Alex Bennée @ 2025-07-02 22:37 ` Romain Naour via buildroot 2025-07-03 6:29 ` Alex Bennée 2025-07-03 6:44 ` Alex Bennée 0 siblings, 2 replies; 14+ messages in thread From: Romain Naour via buildroot @ 2025-07-02 22:37 UTC (permalink / raw) To: Alex Bennée, buildroot Cc: Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Hello Alex, All, Le 26/06/2025 à 13:16, Alex Bennée a écrit : > Although we request a Release build the default CMAKE flags in > toolchain.cmake include -Og -g3 which enables debug symbols for the > build inflating the overall size of things. By default, -O2 -g0 is used by Buildroot. If you have -Og -g3 in toolchain.cmake generated by Buildroot, it means that BR2_ENABLE_DEBUG, BR2_DEBUG_3 and BR2_OPTIMIZE_G have been selected in the Buildroot configuration (by the user). > > For now just copy those defaults into the project mk file and drop the > -Og and -g3 lines. This drops the size of the llvm build directory on > my arm64 build from 17Gb to a more reasonable 4.4Gb. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > package/llvm-project/llvm/llvm.mk | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk > index 78aa6fe467..03684084c4 100644 > --- a/package/llvm-project/llvm/llvm.mk > +++ b/package/llvm-project/llvm/llvm.mk > @@ -167,6 +167,16 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" > HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja > LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja > > +# Reduce the opportunity for default [C|CXX]_FLAGS to fatten the build > +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF > +LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF > LLVM_ENABLE_ASSERTIONS is OFF by default exept for debug builds. + > +HOST_LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" > +LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" > + > +HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" > +LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" I'm not sure about this change, since it also change for other BR2_OPTIMIZE_x options and when BR2_ENABLE_DEBUG is disabled. We want to keep the optimization level selected by the user. What about something like kexec package [1] to force the optimization level to a minimum? I remember (back in 2018) llvm crashing with Debug build type, that's why it's forced to Release type but the default build options were used (-O2 -g0). [1] https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/kexec/kexec.mk?ref_type=heads#L23 Best regards, Romain > + > # Compile llvm with the C++14 (ISO C++ 2014 standard). > HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 > LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm 2025-07-02 22:37 ` Romain Naour via buildroot @ 2025-07-03 6:29 ` Alex Bennée 2025-07-03 6:44 ` Alex Bennée 1 sibling, 0 replies; 14+ messages in thread From: Alex Bennée @ 2025-07-03 6:29 UTC (permalink / raw) To: Romain Naour Cc: buildroot, Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Romain Naour <romain.naour@smile.fr> writes: > Hello Alex, All, > > Le 26/06/2025 à 13:16, Alex Bennée a écrit : >> Although we request a Release build the default CMAKE flags in >> toolchain.cmake include -Og -g3 which enables debug symbols for the >> build inflating the overall size of things. > > By default, -O2 -g0 is used by Buildroot. If you have -Og -g3 in toolchain.cmake > generated by Buildroot, it means that BR2_ENABLE_DEBUG, BR2_DEBUG_3 and > BR2_OPTIMIZE_G have been selected in the Buildroot configuration (by > the user). Ahh yes - I didn't realise there was a global debug setting that was on in my config. I'll re-test without the patches and check the build size. > >> >> For now just copy those defaults into the project mk file and drop the >> -Og and -g3 lines. This drops the size of the llvm build directory on >> my arm64 build from 17Gb to a more reasonable 4.4Gb. >> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >> --- >> package/llvm-project/llvm/llvm.mk | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk >> index 78aa6fe467..03684084c4 100644 >> --- a/package/llvm-project/llvm/llvm.mk >> +++ b/package/llvm-project/llvm/llvm.mk >> @@ -167,6 +167,16 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" >> HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >> LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >> >> +# Reduce the opportunity for default [C|CXX]_FLAGS to fatten the build >> +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >> +LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >> > LLVM_ENABLE_ASSERTIONS is OFF by default exept for debug builds. > > + >> +HOST_LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >> +LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >> + >> +HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >> +LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" > > I'm not sure about this change, since it also change for other BR2_OPTIMIZE_x > options and when BR2_ENABLE_DEBUG is disabled. We want to keep the optimization > level selected by the user. > > What about something like kexec package [1] to force the optimization level to a > minimum? > > I remember (back in 2018) llvm crashing with Debug build type, that's why it's > forced to Release type but the default build options were used (-O2 -g0). > > [1] > https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/kexec/kexec.mk?ref_type=heads#L23 > > Best regards, > Romain > > >> + >> # Compile llvm with the C++14 (ISO C++ 2014 standard). >> HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 >> LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 -- Alex Bennée Virtualisation Tech Lead @ Linaro _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm 2025-07-02 22:37 ` Romain Naour via buildroot 2025-07-03 6:29 ` Alex Bennée @ 2025-07-03 6:44 ` Alex Bennée 2025-07-03 11:09 ` Romain Naour via buildroot 1 sibling, 1 reply; 14+ messages in thread From: Alex Bennée @ 2025-07-03 6:44 UTC (permalink / raw) To: Romain Naour Cc: buildroot, Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Romain Naour <romain.naour@smile.fr> writes: > Hello Alex, All, > > Le 26/06/2025 à 13:16, Alex Bennée a écrit : >> Although we request a Release build the default CMAKE flags in >> toolchain.cmake include -Og -g3 which enables debug symbols for the >> build inflating the overall size of things. > > By default, -O2 -g0 is used by Buildroot. If you have -Og -g3 in toolchain.cmake > generated by Buildroot, it means that BR2_ENABLE_DEBUG, BR2_DEBUG_3 and > BR2_OPTIMIZE_G have been selected in the Buildroot configuration (by > the user). Where is the logic that sets this? Because: ➜ ag DEBUG .config 179:BR2_TOOLCHAIN_HAS_THREADS_DEBUG=y 306:# BR2_ENABLE_DEBUG is not set 307:# BR2_ENABLE_RUNTIME_DEBUG is not set 4146:# BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL is not set But: ➜ ag "Buildroot CFLAGS" ./host/share/buildroot/toolchainfile.cmake 57: set(CMAKE_C_FLAGS "-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Og -g3 -D_FORTIFY_SOURCE=1" CACHE STRING "Buildroot CFLAGS") > >> >> For now just copy those defaults into the project mk file and drop the >> -Og and -g3 lines. This drops the size of the llvm build directory on >> my arm64 build from 17Gb to a more reasonable 4.4Gb. >> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >> --- >> package/llvm-project/llvm/llvm.mk | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk >> index 78aa6fe467..03684084c4 100644 >> --- a/package/llvm-project/llvm/llvm.mk >> +++ b/package/llvm-project/llvm/llvm.mk >> @@ -167,6 +167,16 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" >> HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >> LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >> >> +# Reduce the opportunity for default [C|CXX]_FLAGS to fatten the build >> +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >> +LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >> > LLVM_ENABLE_ASSERTIONS is OFF by default exept for debug builds. > > + >> +HOST_LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >> +LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >> + >> +HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >> +LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" > > I'm not sure about this change, since it also change for other BR2_OPTIMIZE_x > options and when BR2_ENABLE_DEBUG is disabled. We want to keep the optimization > level selected by the user. > > What about something like kexec package [1] to force the optimization level to a > minimum? > > I remember (back in 2018) llvm crashing with Debug build type, that's why it's > forced to Release type but the default build options were used (-O2 -g0). > > [1] > https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/kexec/kexec.mk?ref_type=heads#L23 > > Best regards, > Romain > > >> + >> # Compile llvm with the C++14 (ISO C++ 2014 standard). >> HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 >> LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 -- Alex Bennée Virtualisation Tech Lead @ Linaro _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm 2025-07-03 6:44 ` Alex Bennée @ 2025-07-03 11:09 ` Romain Naour via buildroot 2025-07-03 11:16 ` Romain Naour via buildroot 0 siblings, 1 reply; 14+ messages in thread From: Romain Naour via buildroot @ 2025-07-03 11:09 UTC (permalink / raw) To: Alex Bennée Cc: buildroot, Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Le 03/07/2025 à 08:44, Alex Bennée a écrit : > Romain Naour <romain.naour@smile.fr> writes: > >> Hello Alex, All, >> >> Le 26/06/2025 à 13:16, Alex Bennée a écrit : >>> Although we request a Release build the default CMAKE flags in >>> toolchain.cmake include -Og -g3 which enables debug symbols for the >>> build inflating the overall size of things. >> >> By default, -O2 -g0 is used by Buildroot. If you have -Og -g3 in toolchain.cmake >> generated by Buildroot, it means that BR2_ENABLE_DEBUG, BR2_DEBUG_3 and >> BR2_OPTIMIZE_G have been selected in the Buildroot configuration (by >> the user). > > Where is the logic that sets this? Because: > > ➜ ag DEBUG .config > 179:BR2_TOOLCHAIN_HAS_THREADS_DEBUG=y > 306:# BR2_ENABLE_DEBUG is not set > 307:# BR2_ENABLE_RUNTIME_DEBUG is not set > 4146:# BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL is not set > > But: > > ➜ ag "Buildroot CFLAGS" ./host/share/buildroot/toolchainfile.cmake > 57: set(CMAKE_C_FLAGS "-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Og -g3 -D_FORTIFY_SOURCE=1" CACHE STRING "Buildroot CFLAGS") It's weird indeed. I had to use BR2_ENABLE_DEBUG, BR2_DEBUG_3 and BR2_OPTIMIZE_G to get the same optimization level than you. Otherwise -O2 -g0 is used. Can you share a Buildroot defconfig able to reproduce this issue? Best regards, Romain > >> >>> >>> For now just copy those defaults into the project mk file and drop the >>> -Og and -g3 lines. This drops the size of the llvm build directory on >>> my arm64 build from 17Gb to a more reasonable 4.4Gb. >>> >>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >>> --- >>> package/llvm-project/llvm/llvm.mk | 10 ++++++++++ >>> 1 file changed, 10 insertions(+) >>> >>> diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk >>> index 78aa6fe467..03684084c4 100644 >>> --- a/package/llvm-project/llvm/llvm.mk >>> +++ b/package/llvm-project/llvm/llvm.mk >>> @@ -167,6 +167,16 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" >>> HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >>> LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >>> >>> +# Reduce the opportunity for default [C|CXX]_FLAGS to fatten the build >>> +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >>> +LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >>> >> LLVM_ENABLE_ASSERTIONS is OFF by default exept for debug builds. >> >> + >>> +HOST_LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >>> +LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >>> + >>> +HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >>> +LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >> >> I'm not sure about this change, since it also change for other BR2_OPTIMIZE_x >> options and when BR2_ENABLE_DEBUG is disabled. We want to keep the optimization >> level selected by the user. >> >> What about something like kexec package [1] to force the optimization level to a >> minimum? >> >> I remember (back in 2018) llvm crashing with Debug build type, that's why it's >> forced to Release type but the default build options were used (-O2 -g0). >> >> [1] >> https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/kexec/kexec.mk?ref_type=heads#L23 >> >> Best regards, >> Romain >> >> >>> + >>> # Compile llvm with the C++14 (ISO C++ 2014 standard). >>> HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 >>> LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 > _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm 2025-07-03 11:09 ` Romain Naour via buildroot @ 2025-07-03 11:16 ` Romain Naour via buildroot 2025-07-04 11:37 ` Alex Bennée 0 siblings, 1 reply; 14+ messages in thread From: Romain Naour via buildroot @ 2025-07-03 11:16 UTC (permalink / raw) To: Alex Bennée Cc: buildroot, Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Le 03/07/2025 à 13:09, Romain Naour a écrit : > Le 03/07/2025 à 08:44, Alex Bennée a écrit : >> Romain Naour <romain.naour@smile.fr> writes: >> >>> Hello Alex, All, >>> >>> Le 26/06/2025 à 13:16, Alex Bennée a écrit : >>>> Although we request a Release build the default CMAKE flags in >>>> toolchain.cmake include -Og -g3 which enables debug symbols for the >>>> build inflating the overall size of things. >>> >>> By default, -O2 -g0 is used by Buildroot. If you have -Og -g3 in toolchain.cmake >>> generated by Buildroot, it means that BR2_ENABLE_DEBUG, BR2_DEBUG_3 and >>> BR2_OPTIMIZE_G have been selected in the Buildroot configuration (by >>> the user). >> >> Where is the logic that sets this? Because: >> >> ➜ ag DEBUG .config >> 179:BR2_TOOLCHAIN_HAS_THREADS_DEBUG=y >> 306:# BR2_ENABLE_DEBUG is not set >> 307:# BR2_ENABLE_RUNTIME_DEBUG is not set >> 4146:# BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL is not set >> >> But: >> >> ➜ ag "Buildroot CFLAGS" ./host/share/buildroot/toolchainfile.cmake >> 57: set(CMAKE_C_FLAGS "-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Og -g3 -D_FORTIFY_SOURCE=1" CACHE STRING "Buildroot CFLAGS") > > It's weird indeed. I had to use BR2_ENABLE_DEBUG, BR2_DEBUG_3 and BR2_OPTIMIZE_G > to get the same optimization level than you. Otherwise -O2 -g0 is used. > > Can you share a Buildroot defconfig able to reproduce this issue? Note: ./host/share/buildroot/toolchainfile.cmake is generated by the toolchain package as post install staging hook: see: TOOLCHAIN_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_CMAKE_INSTALL_FILES If the toolchainfile.cmake file was generated with BR2_ENABLE_DEBUG, BR2_DEBUG_3 and BR2_OPTIMIZE_G set but this setting was updated after, it means you have to do a new build. Buildroot doesn't detect such change and a new build from scratch is needed. Best regards, Romain > > Best regards, > Romain > > >> >>> >>>> >>>> For now just copy those defaults into the project mk file and drop the >>>> -Og and -g3 lines. This drops the size of the llvm build directory on >>>> my arm64 build from 17Gb to a more reasonable 4.4Gb. >>>> >>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >>>> --- >>>> package/llvm-project/llvm/llvm.mk | 10 ++++++++++ >>>> 1 file changed, 10 insertions(+) >>>> >>>> diff --git a/package/llvm-project/llvm/llvm.mk b/package/llvm-project/llvm/llvm.mk >>>> index 78aa6fe467..03684084c4 100644 >>>> --- a/package/llvm-project/llvm/llvm.mk >>>> +++ b/package/llvm-project/llvm/llvm.mk >>>> @@ -167,6 +167,16 @@ LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE="" >>>> HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >>>> LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release -G Ninja >>>> >>>> +# Reduce the opportunity for default [C|CXX]_FLAGS to fatten the build >>>> +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >>>> +LLVM_CONF_OPTS += -DLLVM_ENABLE_ASSERTIONS=OFF >>>> >>> LLVM_ENABLE_ASSERTIONS is OFF by default exept for debug builds. >>> >>> + >>>> +HOST_LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >>>> +LLVM_CONF_OPTS += -DCMAKE_C_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >>>> + >>>> +HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >>>> +LLVM_CONF_OPTS += -DCMAKE_CXX_FLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=1" >>> >>> I'm not sure about this change, since it also change for other BR2_OPTIMIZE_x >>> options and when BR2_ENABLE_DEBUG is disabled. We want to keep the optimization >>> level selected by the user. >>> >>> What about something like kexec package [1] to force the optimization level to a >>> minimum? >>> >>> I remember (back in 2018) llvm crashing with Debug build type, that's why it's >>> forced to Release type but the default build options were used (-O2 -g0). >>> >>> [1] >>> https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/kexec/kexec.mk?ref_type=heads#L23 >>> >>> Best regards, >>> Romain >>> >>> >>>> + >>>> # Compile llvm with the C++14 (ISO C++ 2014 standard). >>>> HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 >>>> LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14 >> > _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm 2025-07-03 11:16 ` Romain Naour via buildroot @ 2025-07-04 11:37 ` Alex Bennée 0 siblings, 0 replies; 14+ messages in thread From: Alex Bennée @ 2025-07-04 11:37 UTC (permalink / raw) To: Romain Naour Cc: buildroot, Joseph Kogut, Romain Naour, Daniel Lang, Valentin Korenblit Romain Naour <romain.naour@smile.fr> writes: > Le 03/07/2025 à 13:09, Romain Naour a écrit : >> Le 03/07/2025 à 08:44, Alex Bennée a écrit : >>> Romain Naour <romain.naour@smile.fr> writes: >>> >>>> Hello Alex, All, >>>> >>>> Le 26/06/2025 à 13:16, Alex Bennée a écrit : >>>>> Although we request a Release build the default CMAKE flags in >>>>> toolchain.cmake include -Og -g3 which enables debug symbols for the >>>>> build inflating the overall size of things. >>>> >>>> By default, -O2 -g0 is used by Buildroot. If you have -Og -g3 in toolchain.cmake >>>> generated by Buildroot, it means that BR2_ENABLE_DEBUG, BR2_DEBUG_3 and >>>> BR2_OPTIMIZE_G have been selected in the Buildroot configuration (by >>>> the user). >>> >>> Where is the logic that sets this? Because: >>> >>> ➜ ag DEBUG .config >>> 179:BR2_TOOLCHAIN_HAS_THREADS_DEBUG=y >>> 306:# BR2_ENABLE_DEBUG is not set >>> 307:# BR2_ENABLE_RUNTIME_DEBUG is not set >>> 4146:# BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL is not set >>> >>> But: >>> >>> ➜ ag "Buildroot CFLAGS" ./host/share/buildroot/toolchainfile.cmake >>> 57: set(CMAKE_C_FLAGS "-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Og -g3 -D_FORTIFY_SOURCE=1" CACHE STRING "Buildroot CFLAGS") >> >> It's weird indeed. I had to use BR2_ENABLE_DEBUG, BR2_DEBUG_3 and BR2_OPTIMIZE_G >> to get the same optimization level than you. Otherwise -O2 -g0 is used. >> >> Can you share a Buildroot defconfig able to reproduce this issue? > > Note: > ./host/share/buildroot/toolchainfile.cmake is generated by the toolchain package > as post install staging hook: > > see: > TOOLCHAIN_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_CMAKE_INSTALL_FILES > > If the toolchainfile.cmake file was generated with BR2_ENABLE_DEBUG, BR2_DEBUG_3 > and BR2_OPTIMIZE_G set but this setting was updated after, it means you have to > do a new build. Buildroot doesn't detect such change and a new build from > scratch is needed. Ahh that was indeed it. I can drop these patches. Sorry for the noise. -- Alex Bennée Virtualisation Tech Lead @ Linaro _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-02-04 16:35 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-06-26 11:16 [Buildroot] [RFC PATCH 0/3] package/llvm-project: drop debug info from the binary Alex Bennée 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 1/3] package/llvm-project: use ninja to build llvm libs Alex Bennée 2025-07-02 21:40 ` Romain Naour via buildroot 2026-02-04 16:11 ` Thomas Devoogdt 2026-02-04 16:35 ` Romain Naour via buildroot 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 2/3] package/llvm-project: drop unused TERMINFO config flags Alex Bennée 2025-07-02 21:42 ` Romain Naour via buildroot 2025-06-26 11:16 ` [Buildroot] [RFC PATCH 3/3] package/llvm-project: reduce the build size of llvm Alex Bennée 2025-07-02 22:37 ` Romain Naour via buildroot 2025-07-03 6:29 ` Alex Bennée 2025-07-03 6:44 ` Alex Bennée 2025-07-03 11:09 ` Romain Naour via buildroot 2025-07-03 11:16 ` Romain Naour via buildroot 2025-07-04 11:37 ` Alex Bennée
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.