Skip to contentSkip to conversation

package/gnuradio: backport patch to fix INTERFACE_INCLUDE_DIRECTORIES

PATCH New Gwenhael Goavec-Merou 3 participants 3 messages Aug 27, 2020 – Aug 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gnuradio: backport patch to fix INTERFACE_INCLUDE_DIRECTORIES

From: Gwenhael Goavec-Merou <[email protected]>

gnuradio-runtimeTargets.cmake and gnuradio-pmtTargets.cmake are filled using CMAKE_INSTALL_PREFIX for INSTALL_INTERFACE.

Since CMAKE_INSTALL_PREFIX, in buildroot, is set to /usr, these files contains path to host system.

With BR2_COMPILER_PARANOID_UNSAFE_PATH package using gnuradio fails with:
arm-linux-gnueabihf-g++: ERROR: unsafe header/library path used in cross-compilation: '-isystem' '/usr/include'

By simply providing 'include', produced .cmake contains:
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" instead of
INTERFACE_INCLUDE_DIRECTORIES "/usr/include"

[Upstream status: https://github.com/gnuradio/gnuradio/pull/3737]

Fix (many) gr-osmosdr build failure:
- http://autobuild.buildroot.net/results/66b76c07f15bb3e6db697c47796ae3dd15ecf4b9/

---
 ...rdcode-INTERFACE_INCLUDE_DIRECTORIES.patch | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 package/gnuradio/0003-gnuradio-runtime_pmt-dont-hardcode-INTERFACE_INCLUDE_DIRECTORIES.patch
package/gnuradio/0003-gnuradio-runtime_pmt-dont-hardcode-INTERFACE_INCLUDE_DIRECTORIES.patch new file +57 -0
new file mode 100644
index 0000000000..6b8987fa5f
@@ -0,0 +1,57 @@
+From 84dea8284c521f08508bb2dcbc99db3b5d3438fd Mon Sep 17 00:00:00 2001
+From: Gwenhael Goavec-Merou <[email protected]>
+Date: Thu, 27 Aug 2020 17:32:09 +0200
+Subject: [PATCH] gnuradio-runtime_pmt: dont hardcode
+ INTERFACE_INCLUDE_DIRECTORIES
+
+gnuradio-runtimeTargets.cmake and gnuradio-pmtTargets.cmake are filled
+using CMAKE_INSTALL_PREFIX for INSTALL_INTERFACE.
+
+Since CMAKE_INSTALL_PREFIX, in buildroot, is set to /usr, these files contains
+path to host system.
+
+With BR2_COMPILER_PARANOID_UNSAFE_PATH package using gnuradio fails with:
+arm-linux-gnueabihf-g++: ERROR: unsafe header/library path used in cross-compilation: '-isystem' '/usr/include'
+
+By simply providing 'include', produced .cmake contains:
+INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+instead of
+INTERFACE_INCLUDE_DIRECTORIES "/usr/include"
+
+[Upstream status: https://github.com/gnuradio/gnuradio/pull/3737]
+
+Signed-off-by: Gwenhael Goavec-Merou <[email protected]>
+---
+ gnuradio-runtime/lib/CMakeLists.txt     | 2 +-
+ gnuradio-runtime/lib/pmt/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
+index 5aa90a5e1..fc32f473b 100644
+--- a/gnuradio-runtime/lib/CMakeLists.txt
++++ b/gnuradio-runtime/lib/CMakeLists.txt
+@@ -214,7 +214,7 @@ target_link_libraries(gnuradio-runtime PUBLIC
+ 
+ target_include_directories(gnuradio-runtime
+   PUBLIC
+-    $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
++    $<INSTALL_INTERFACE:include>
+     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+     $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
+   PRIVATE
+diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt
+index 9fb98d0fc..6dfcd945c 100644
+--- a/gnuradio-runtime/lib/pmt/CMakeLists.txt
++++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt
+@@ -33,7 +33,7 @@ target_link_libraries(gnuradio-pmt
+ 
+ target_include_directories(gnuradio-pmt
+   PUBLIC
+-  $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
++  $<INSTALL_INTERFACE:include>
+   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
+   PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/
+   )
+-- 
+2.26.2
+
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 package/gnuradio: backport patch to fix INTERFACE_INCLUDE_DIRECTORIES

Hello,

Quoted 16 lines · On Thu, 27 Aug 2020 17:49:03 +0200 Gwenhael Goavec-Merou…

From: Gwenhael Goavec-Merou <[email protected]>

gnuradio-runtimeTargets.cmake and gnuradio-pmtTargets.cmake are filled using CMAKE_INSTALL_PREFIX for INSTALL_INTERFACE.

Since CMAKE_INSTALL_PREFIX, in buildroot, is set to /usr, these files contains path to host system.

With BR2_COMPILER_PARANOID_UNSAFE_PATH package using gnuradio fails with:
arm-linux-gnueabihf-g++: ERROR: unsafe header/library path used in cross-compilation: '-isystem' '/usr/include'

By simply providing 'include', produced .cmake contains:
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" instead of
INTERFACE_INCLUDE_DIRECTORIES "/usr/include"

Quoted 6 lines

[Upstream status: https://github.com/gnuradio/gnuradio/pull/3737]

Fix (many) gr-osmosdr build failure:
- http://autobuild.buildroot.net/results/66b76c07f15bb3e6db697c47796ae3dd15ecf4b9/

I've applied to master, but I have a comment below.

Quoted 10 lines
package/gnuradio/0003-gnuradio-runtime_pmt-dont-hardcode-INTERFACE_INCLUDE_DIRECTORIES.patch new file +4 -0
new file mode 100644
index 0000000000..6b8987fa5f
@@ -0,0 +1,57 @@
+From 84dea8284c521f08508bb2dcbc99db3b5d3438fd Mon Sep 17 00:00:00 2001
+From: Gwenhael Goavec-Merou <[email protected]>
+Date: Thu, 27 Aug 2020 17:32:09 +0200
+Subject: [PATCH] gnuradio-runtime_pmt: dont hardcode

package/gnuradio/0003-gnuradio-runtime_pmt-dont-hardcode-INTERFACE_INCLUDE_DIRECTORIES.patch line 14

Quoted 10 lines
package/gnuradio/0003-gnuradio-runtime_pmt-dont-hardcode-INTERFACE_INCLUDE_DIRECTORIES.patch new file +10 -0
+ INTERFACE_INCLUDE_DIRECTORIES
+
+gnuradio-runtimeTargets.cmake and gnuradio-pmtTargets.cmake are filled
+using CMAKE_INSTALL_PREFIX for INSTALL_INTERFACE.
+
+Since CMAKE_INSTALL_PREFIX, in buildroot, is set to /usr, these files contains
+path to host system.
+
+With BR2_COMPILER_PARANOID_UNSAFE_PATH package using gnuradio fails with:
+arm-linux-gnueabihf-g++: ERROR: unsafe header/library path used in cross-compilation: '-isystem' '/usr/include'

When you submit patches upstream, I recommend you to not mention Buildroot or Buildroot-specific things in the commit logs. This often makes upstream maintainers think that Buildroot is special, while here the problem is general.

A better phrasing would have been something along those lines:

"""
When cross-compiling, it is normal to set CMAKE_INSTALL_PREFIX to /usr, since gnuradio will be installed and executed from /usr on the target.

However, due to INSTALL_INTERFACE using CMAKE_INSTALL_PREFIX, an -isystem /usr/include option is added by CMake when building gnuradio, which is incorrect as at build time, the /usr/include headers are the ones of the build machine, not the one of the target platform we're cross-compiling for.
"""

This says the same thing, but without being Buildroot specific: it's a general cross-compilation issue.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/gnuradio: backport patch to fix INTERFACE_INCLUDE_DIRECTORIES

In reply to Gwenhael Goavec-Merou
Quoted 18 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gwenhael" == Gwenhael Goavec-Merou <[email protected]> writes:

From: Gwenhael Goavec-Merou <[email protected]> gnuradio-runtimeTargets.cmake and gnuradio-pmtTargets.cmake are filled using CMAKE_INSTALL_PREFIX for INSTALL_INTERFACE.

Since CMAKE_INSTALL_PREFIX, in buildroot, is set to /usr, these files contains path to host system.

With BR2_COMPILER_PARANOID_UNSAFE_PATH package using gnuradio fails with:
arm-linux-gnueabihf-g++: ERROR: unsafe header/library path used in
cross-compilation: '-isystem' '/usr/include'

By simply providing 'include', produced .cmake contains:
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" instead of
INTERFACE_INCLUDE_DIRECTORIES "/usr/include"

Quoted 6 lines

[Upstream status: https://github.com/gnuradio/gnuradio/pull/3737]

Fix (many) gr-osmosdr build failure:
- http://autobuild.buildroot.net/results/66b76c07f15bb3e6db697c47796ae3dd15ecf4b9/

Committed to 2020.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard