cmake: forward HOST_{C, LD}FLAGS as cmake flags
PATCH 1/1 cmake: forward HOST_{C, LD}FLAGS as cmake flags
During the CMake bootstrap phase, the {C,LD}FLAGS set in the bootstrap environment are not forwarded/converted as CMake flags.
The CMake build contains a bootstrap phase building a minimal CMake program using a standard Makfile, then reconfigures itself with this minimal program.
On system with no ncurses installed, and because the prefix option points to $(HOST_DIR)/usr, if host-cmake was built after host-ncurses, then ncurses libraries and headers are correctly find (in the host tree) during the second configuration (because of the prefix). However, it fails at building ccmake (the curses interface) because the CMAKE_C_FLAGS, CMAKE_CXX_FLAGS and CMAKE_EXE_LINKER_FLAGS do not point to the host tree.
Because these flags are needed when running the bootstrap script, this patch makes sure the same flags are set when running the second configuration.
--- package/cmake/cmake.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
package/cmake/cmake.mk +3 -1
@@ -14,7 +14,9 @@ define HOST_CMAKE_CONFIGURE_CMDS (cd $(@D); \ LDFLAGS="$(HOST_LDFLAGS)" \ CFLAGS="$(HOST_CFLAGS)" \ - ./bootstrap --prefix=$(HOST_DIR)/usr --parallel=$(PARALLEL_JOBS) \ + ./bootstrap --prefix=$(HOST_DIR)/usr --parallel=$(PARALLEL_JOBS) -- \ + -DCMAKE_C_FLAGS="$(HOST_CFLAGS)" -DCMAKE_CXX_FLAGS="$(HOST_CFLAGS)" \ + -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \ ) endef
Signature · 1 line
1.9.2
PATCH 1/1 cmake: forward HOST_{C, LD}FLAGS as cmake flags
Quoted 32 lines · Samuel Martin
During the CMake bootstrap phase, the {C,LD}FLAGS set in the bootstrap environment are not forwarded/converted as CMake flags.
The CMake build contains a bootstrap phase building a minimal CMake program using a standard Makfile, then reconfigures itself with this minimal program.
On system with no ncurses installed, and because the prefix option points to $(HOST_DIR)/usr, if host-cmake was built after host-ncurses, then ncurses libraries and headers are correctly find (in the host tree) during the second configuration (because of the prefix). However, it fails at building ccmake (the curses interface) because the
CMAKE_C_FLAGS,CMAKE_CXX_FLAGSandCMAKE_EXE_LINKER_FLAGSdo not point to the host tree.Because these flags are needed when running the bootstrap script, this patch makes sure the same flags are set when running the second configuration.
Reported-by Fabio Porcedda <[email protected]>Signed-off-by Samuel Martin <[email protected]>Cc Fabio Porcedda <[email protected]>Cc Luca Ceresoli <[email protected]>--- package/cmake/cmake.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)package/cmake/cmake.mk +0
-0
package/cmake/cmake.mk define HOST_CMAKE_CONFIGURE_CMDS · line 18
Quoted 6 lines
package/cmake/cmake.mk +2
-1@@ -14,7 +14,9 @@ define HOST_CMAKE_CONFIGURE_CMDS (cd $(@D); \ LDFLAGS="$(HOST_LDFLAGS)" \ CFLAGS="$(HOST_CFLAGS)" \ - ./bootstrap --prefix=$(HOST_DIR)/usr --parallel=$(PARALLEL_JOBS) \ + ./bootstrap --prefix=$(HOST_DIR)/usr --parallel=$(PARALLEL_JOBS) -- \ + -DCMAKE_C_FLAGS="$(HOST_CFLAGS)" -DCMAKE_CXX_FLAGS="$(HOST_CFLAGS)" \
I think HOST_CXXFLAGS must be used:
- -DCMAKE_C_FLAGS="$(HOST_CFLAGS)"
-DCMAKE_CXX_FLAGS="$(HOST_CFLAGS)" \
+ -DCMAKE_C_FLAGS="$(HOST_CFLAGS)"
-DCMAKE_CXX_FLAGS="$(HOST_CXXFLAGS)" \
Quoted 7 lines
package/cmake/cmake.mk +1
-1+ -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \ ) endef --1.9.2
Regards
Signature · 1 line
Fabio Porcedda
PATCH 1/1 cmake: forward HOST_{C, LD}FLAGS as cmake flags
Quoted 43 lines · Fabio Porcedda
Quoted 32 lines · Samuel Martin
During the CMake bootstrap phase, the {C,LD}FLAGS set in the bootstrap environment are not forwarded/converted as CMake flags.
The CMake build contains a bootstrap phase building a minimal CMake program using a standard Makfile, then reconfigures itself with this minimal program.
On system with no ncurses installed, and because the prefix option points to $(HOST_DIR)/usr, if host-cmake was built after host-ncurses, then ncurses libraries and headers are correctly find (in the host tree) during the second configuration (because of the prefix). However, it fails at building ccmake (the curses interface) because the
CMAKE_C_FLAGS,CMAKE_CXX_FLAGSandCMAKE_EXE_LINKER_FLAGSdo not point to the host tree.Because these flags are needed when running the bootstrap script, this patch makes sure the same flags are set when running the second configuration.
Reported-by Fabio Porcedda <[email protected]>Signed-off-by Samuel Martin <[email protected]>Cc Fabio Porcedda <[email protected]>Cc Luca Ceresoli <[email protected]>--- package/cmake/cmake.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)package/cmake/cmake.mk +0
-0package/cmake/cmake.mk define HOST_CMAKE_CONFIGURE_CMDS · line 18
Quoted 6 lines
package/cmake/cmake.mk +2
-1@@ -14,7 +14,9 @@ define HOST_CMAKE_CONFIGURE_CMDS (cd $(@D); \ LDFLAGS="$(HOST_LDFLAGS)" \ CFLAGS="$(HOST_CFLAGS)" \ - ./bootstrap --prefix=$(HOST_DIR)/usr --parallel=$(PARALLEL_JOBS) \ + ./bootstrap --prefix=$(HOST_DIR)/usr --parallel=$(PARALLEL_JOBS) -- \ + -DCMAKE_C_FLAGS="$(HOST_CFLAGS)" -DCMAKE_CXX_FLAGS="$(HOST_CFLAGS)" \I think
HOST_CXXFLAGSmust be used:- -DCMAKE_C_FLAGS="$(HOST_CFLAGS)"
Review
Quoted 3 lines
(quoted diff) +1
-2-DCMAKE_CXX_FLAGS="$(HOST_CFLAGS)" \ + -DCMAKE_C_FLAGS="$(HOST_CFLAGS)" -DCMAKE_CXX_FLAGS="$(HOST_CXXFLAGS)" \
Indeed, even if HOST_CXXFLAGS = $(HOST_CFLAGS) in buildroot ;-) Will do.
Quoted 5 lines
Quoted 5 lines
package/cmake/cmake.mk +1
-0+ -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \ ) endef
Quoted 7 lines
Quoted 3 lines
--
1.9.2Regards
--
Fabio Porcedda
Regards,
Signature · 1 line
Samuel
PATCH 1/1 cmake: forward HOST_{C, LD}FLAGS as cmake flags
In reply to Samuel MartinHi Samuel,
Quoted 10 lines · Samuel Martin
During the CMake bootstrap phase, the {C,LD}FLAGS set in the bootstrap environment are not forwarded/converted as CMake flags.
The CMake build contains a bootstrap phase building a minimal CMake program using a standard Makfile, then reconfigures itself with this minimal program.
On system with no ncurses installed, and because the prefix option points to $(HOST_DIR)/usr, if host-cmake was built after host-ncurses, then ncurses libraries and headers are correctly find (in the host tree)
s/find/found/.
Quoted 5 lines
during the second configuration (because of the prefix). However, it fails at building ccmake (the curses interface) because the
CMAKE_C_FLAGS,CMAKE_CXX_FLAGSandCMAKE_EXE_LINKER_FLAGSdo not point to the host tree.
Quoted 8 lines
Because these flags are needed when running the bootstrap script, this patch makes sure the same flags are set when running the second configuration.
Reported-by Fabio Porcedda <[email protected]>Signed-off-by Samuel Martin <[email protected]>Cc Fabio Porcedda <[email protected]>Cc Luca Ceresoli <[email protected]>
In general I'm OK with this fix once it is, well... fixed according to Fabio's comment.
But I still think disabling ccmake and other host tools that Buildroot does not use would be a good idea. I agree with Thomas when he says building host-cmake takes really long, although I am not sure we can save a lot of time.
So I'd proceed quickly with this fix, and later disable unneeded tools and see how much time we can save.
Signature · 1 line
Luca
PATCH 1/1 cmake: forward HOST_{C, LD}FLAGS as cmake flags
Quoted 38 lines · Luca Ceresoli
Hi Samuel,
Quoted 11 lines · Samuel Martin
During the CMake bootstrap phase, the {C,LD}FLAGS set in the bootstrap environment are not forwarded/converted as CMake flags.
The CMake build contains a bootstrap phase building a minimal CMake program using a standard Makfile, then reconfigures itself with this minimal program.
On system with no ncurses installed, and because the prefix option points to $(HOST_DIR)/usr, if host-cmake was built after host-ncurses, then ncurses libraries and headers are correctly find (in the host tree)
s/find/found/.
Quoted 5 lines
during the second configuration (because of the prefix). However, it fails at building ccmake (the curses interface) because the
CMAKE_C_FLAGS,CMAKE_CXX_FLAGSandCMAKE_EXE_LINKER_FLAGSdo not point to the host tree.Quoted 8 lines
Because these flags are needed when running the bootstrap script, this patch makes sure the same flags are set when running the second configuration.
Reported-by Fabio Porcedda <[email protected]>Signed-off-by Samuel Martin <[email protected]>Cc Fabio Porcedda <[email protected]>Cc Luca Ceresoli <[email protected]>In general I'm OK with this fix once it is, well... fixed according to Fabio's comment.
Quoted 7 lines
But I still think disabling ccmake and other host tools that Buildroot does not use would be a good idea. I agree with Thomas when he says building host-cmake takes really long, although I am not sure we can save a lot of time.
So I'd proceed quickly with this fix, and later disable unneeded tools and see how much time we can save.
I think the same so after the revision of this patch is sent i will sent a revision of my patch rebased on this one.
That is also useful to remove a optionally unspecified dependency for the sake of reproducible builds.
Samuel could you also break lines longer than 80 characters?
Thanks
Signature · 1 line
Fabio Porcedda
PATCH 1/1 cmake: forward HOST_{C, LD}FLAGS as cmake flags
Quoted 13 lines · Fabio Porcedda
Quoted 12 lines · Luca Ceresoli
Hi Samuel,
Quoted 8 lines · Samuel Martin
During the CMake bootstrap phase, the {C,LD}FLAGS set in the bootstrap environment are not forwarded/converted as CMake flags.
The CMake build contains a bootstrap phase building a minimal CMake program using a standard Makfile, then reconfigures itself with this minimal program.
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
On system with no ncurses installed, and because the prefix option points to $(HOST_DIR)/usr, if host-cmake was built after host-ncurses, then ncurses libraries and headers are correctly find (in the host tree)
s/find/found/.
good catch!
Quoted 25 lines
Quoted 25 lines
Quoted 7 lines
during the second configuration (because of the prefix). However, it fails at building ccmake (the curses interface) because the
CMAKE_C_FLAGS,CMAKE_CXX_FLAGSandCMAKE_EXE_LINKER_FLAGSdo not point to the host tree.Quoted 8 lines
Because these flags are needed when running the bootstrap script, this patch makes sure the same flags are set when running the second configuration.
Reported-by Fabio Porcedda <[email protected]>Signed-off-by Samuel Martin <[email protected]>Cc Fabio Porcedda <[email protected]>Cc Luca Ceresoli <[email protected]>In general I'm OK with this fix once it is, well... fixed according to Fabio's comment.
But I still think disabling ccmake and other host tools that Buildroot does not use would be a good idea. I agree with Thomas when he says building host-cmake takes really long, although I am not sure we can save a lot of time.
Quoted 8 lines
Quoted 2 lines
So I'd proceed quickly with this fix, and later disable unneeded tools and see how much time we can save.
I think the same so after the revision of this patch is sent i will sent a revision of my patch rebased on this one.
That is also useful to remove a optionally unspecified dependency for the sake of reproducible builds.
Sure, do it! :-)
Quoted 1 line
Samuel could you also break lines longer than 80 characters?
Will do.
Quoted 4 lines
Thanks
--
Fabio Porcedda
Regards,
Signature · 1 line
Samuel