package/boost: fixup Optimization flag in boost build
PATCH 1/1 package/boost: fixup Optimization flag in boost build
When building with Boost Build the CXXFLAGS are extended depending on the optimization level set. When not defined explicitly the optimization level depends on the <variant>. For release it's 'speed' and for debug it's set to 'off'
These flags overwrite the -O flag passed in with TARGET_CXXFLAGS as it is appended when calling g++.
This commit sets the Optimization flags generated by Boost Build to the value of TARGET_OPTIMIZATION no matter what level is used.
--- package/boost/boost.mk | 5 +++++ 1 file changed, 5 insertions(+)
package/boost/boost.mk +5 -0
@@ -134,6 +134,11 @@ define BOOST_CONFIGURE_CMDS (cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS)) echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam echo "" >> $(@D)/user-config.jam + echo "import modules ;" >> $(@D)/user-config.jam + echo "modules.poke gcc : flags gcc.compile OPTIONS <optimization>off : $(TARGET_OPTIMIZATION) ;" >> $(@D)/user-config.jam + echo "modules.poke gcc : flags gcc.compile OPTIONS <optimization>speed : $(TARGET_OPTIMIZATION) ;" >> $(@D)/user-config.jam + echo "modules.poke gcc : flags gcc.compile OPTIONS <optimization>space : $(TARGET_OPTIMIZATION) ;" >> $(@D)/user-config.jam + echo "" >> $(@D)/user-config.jam endef define BOOST_BUILD_CMDS
Signature · 1 line
2.25.1
PATCH 1/1 package/boost: fixup Optimization flag in boost build
Michael, All,
On 2020-08-05 14:41 +0200, Michael Nosthoff spake thusly:
Quoted 21 lines
When building with Boost Build the CXXFLAGS are extended depending on the optimization level set. When not defined explicitly the optimization level depends on the <variant>. For release it's 'speed' and for debug it's set to 'off'
These flags overwrite the -O flag passed in with
TARGET_CXXFLAGSas it is appended when calling g++.This commit sets the Optimization flags generated by Boost Build to the value of
TARGET_OPTIMIZATIONno matter what level is used.Signed-off-by Michael Nosthoff <[email protected]>--- package/boost/boost.mk | 5 +++++ 1 file changed, 5 insertions(+)package/boost/boost.mk +0
-0
package/boost/boost.mk define BOOST_CONFIGURE_CMDS · line 140
Quoted 7 lines
package/boost/boost.mk +4
-0@@ -134,6 +134,11 @@ define BOOST_CONFIGURE_CMDS (cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS)) echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam echo "" >> $(@D)/user-config.jam + echo "import modules ;" >> $(@D)/user-config.jam + echo "modules.poke gcc : flags gcc.compile OPTIONS <optimization>off : $(TARGET_OPTIMIZATION) ;" >> $(@D)/user-config.jam + echo "modules.poke gcc : flags gcc.compile OPTIONS <optimization>speed : $(TARGET_OPTIMIZATION) ;" >> $(@D)/user-config.jam + echo "modules.poke gcc : flags gcc.compile OPTIONS <optimization>space : $(TARGET_OPTIMIZATION) ;" >> $(@D)/user-config.jam
Unfortunately, that does not seem to work:
gcc.compile.c++ bin.v2/libs/thread/build/gcc-9.2.1/release/threadapi-pthread/threading-multi/visibility-hidden/pthread/thread.o "/home/ymorin/dev/buildroot/O/host/bin/arm-none-linux-gnueabihf-g++"
-fvisibility-inlines-hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -Os -fPIC -pthread -O3 -finline-functions
-Wno-inline -Wall -fvisibility=hidden -Wextra -Wno-long-long
-Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1
-DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_DONT_USE_CHRONO
-DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2/libs/thread/build/gcc-9.2.1/release/threadapi-pthread/threading-multi/visibility-hidden/pthread/thread.o" "libs/thread/src/pthread/thread.cpp"
(indentation mine)
Regards,
Yann E. MORIN.
Quoted 11 lines
package/boost/boost.mk +1
-0+ echo "" >> $(@D)/user-config.jam endef define BOOST_BUILD_CMDSSignature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 package/boost: fixup Optimization flag in boost build
Hi Yann,
Quoted 4 lines · Yann E. MORIN
Michael, All,
On 2020-08-05 14:41 +0200, Michael Nosthoff spake thusly:
Quoted 1 line
When building with Boost Build the CXXFLAGS are extended depending
...
Quoted 14 lines
Unfortunately, that does not seem to work:
gcc.compile.c++
bin.v2/libs/thread/build/gcc-9.2.1/release/threadapi-pthread/threading-multi/visibility-hidden/pthread/thread.o"/home/ymorin/dev/buildroot/O/host/bin/arm-none-linux-gnueabihf-g++"
-fvisibility-inlines-hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -Os -fPIC -pthread -O3 -finline-functions
-Wno-inline -Wall -fvisibility=hidden -Wextra -Wno-long-long
-Wno-unused-parameter -Wunused-function -pedantic -DBOOST_ALL_NO_LIB=1
-DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_DONT_USE_CHRONO
-DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2/libs/thread/build/gcc-9.2.1/release/threadapi-pthread/threading-multi/visibility-hidden/pthread/thread.o" "libs/thread/src/pthread/thread.cpp"
Unfortunately that is true. I had some changes in my tree that made it appear to work. So it seems i have to fall back to the sed-based approach. I'll send a v2 shortly.
Regards,
Michael
PATCH v2 1/1 package/boost: fixup Optimization flag in boost build
In reply to Michael NosthoffWhen building with Boost Build the CXXFLAGS are extended depending on the optimization level set. When not defined explicitly the optimization level depends on the <variant>. For release it's 'speed' and for debug it's set to 'off'
These flags overwrite the -O flag passed in with TARGET_CXXFLAGS as it is appended when calling g++.
This commit sets the Optimization flags generated by Boost Build to the value of TARGET_OPTIMIZATION no matter what level is used.
As Boost Build offers no nice way to alter those values the gcc toolchain file is altered directly.
---
v1 -> v2:
- use sed to manipulate gcc.jam directly
- remove extending user-config.jam
--- package/boost/boost.mk | 1 + 1 file changed, 1 insertion(+)
package/boost/boost.mk +1 -0
@@ -134,6 +134,7 @@ define BOOST_CONFIGURE_CMDS (cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS)) echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam echo "" >> $(@D)/user-config.jam + sed -i "s/: -O.* ;/: $(TARGET_OPTIMIZATION) ;/" $(@D)/tools/build/src/tools/gcc.jam endef define BOOST_BUILD_CMDS
Signature · 1 line
2.25.1
Yann E. MORIN
AppliedPATCH v2 1/1 package/boost: fixup Optimization flag in boost build
Michael, All,
On 2020-08-07 10:58 +0200, Michael Nosthoff spake thusly:
Quoted 8 lines
When building with Boost Build the CXXFLAGS are extended depending on the optimization level set. When not defined explicitly the optimization level depends on the <variant>. For release it's 'speed' and for debug it's set to 'off'
These flags overwrite the -O flag passed in with
TARGET_CXXFLAGSas it is appended when calling g++.
Quoted 7 lines
This commit sets the Optimization flags generated by Boost Build to the value of
TARGET_OPTIMIZATIONno matter what level is used.As Boost Build offers no nice way to alter those values the gcc toolchain file is altered directly.
Signed-off-by Michael Nosthoff <[email protected]>
Applied to master, thanks.
Ultimately, it would be nice if upstream had a provision to not set the optimisation level.
For example, in addition to the existign three levels, 'off', 'speed', and 'space' (IIRC), maybe suggest they add a new one, maybe 'none', that would not set any -O flag at all, thus using whatever the user would set in their CXXFLAGS, or whatever the compiler defaults to...
Regards,
Yann E. MORIN.
Quoted 29 lines
---
v1 -> v2:
- use sed to manipulate gcc.jam directly
- remove extending user-config.jam--- package/boost/boost.mk | 1 + 1 file changed, 1 insertion(+)package/boost/boost.mk +1
-0@@ -134,6 +134,7 @@ define BOOST_CONFIGURE_CMDS (cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS)) echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam echo "" >> $(@D)/user-config.jam + sed -i "s/: -O.* ;/: $(TARGET_OPTIMIZATION) ;/" $(@D)/tools/build/src/tools/gcc.jam endef define BOOST_BUILD_CMDSSignature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/1 package/boost: fixup Optimization flag in boost build
In reply to Michael NosthoffQuoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Michael" == Michael Nosthoff <[email protected]> writes:
When building with Boost Build the CXXFLAGS are extended depending on the optimization level set. When not defined explicitly the optimization level depends on the <variant>. For release it's 'speed' and for debug it's set to 'off'
These flags overwrite the -O flag passed in with
TARGET_CXXFLAGSas it is appended when calling g++.This commit sets the Optimization flags generated by Boost Build to the value of
TARGET_OPTIMIZATIONno matter what level is used.As Boost Build offers no nice way to alter those values the gcc toolchain file is altered directly.
Quoted 6 lines
Signed-off-by Michael Nosthoff <[email protected]>---
v1 -> v2:
- use sed to manipulate gcc.jam directly
- remove extending user-config.jam
Committed to 2020.02.x and 2020.05.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard