Skip to contentSkip to conversation

error in cmake.bbclass exposed when meta-darwin included

DISCUSSION Woodyatt, James 1 participant 1 message Dec 31, 2013

lore
Share & tools
lore
#0 lore raw

Everyone—

I didn’t quite get it right in my previous patch. The main problem is that the expansion of CMAKE_SYSTEM_NAME needs to match one of the .cmake files in the Modules/Platform directory of the CMake source tree. There is a whole slew of Linux-$foo.cmake files in there, but the one that works for me is Linux.cmake. Alas, the bitbake.conf file in Poky defines TARGET_OS="linux${LIBCEXTENSION}${ABIEXTENSION}" which doesn’t work.

The following patch is simpler and probably better:

meta/classes/cmake.bbclass +0 -0
index e64c30c..4ef9fca 100644
@@ -35,7 +35,7 @@ cmake_do_generate_toolchain_file() {
        cat > ${WORKDIR}/toolchain.cmake <<EOF

# CMake system name must be something like "Linux". # This is important for cross-compiling.
-set( CMAKE_SYSTEM_NAME echo ${SDK_OS} | sed 's/^./\u&/' ) +set( CMAKE_SYSTEM_NAME "Linux" )
set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} )
set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )

—
james woodyatt <[email protected]>
Software Architect, New Devices Group

Quoted 42 lines · James

Everyone‹

Please review the following patch for Poky, which I believe is necessary for properly supporting builds where meta-darwin (also probably meta-mingw) is included in the Bitbake layer path list.

Explanation: the meta-darwin layer overrides the value of the SDK_OS variable with the value of HOST_OS, which is ³darwin² for most builds, and this makes everything that uses CMake fail to build properly. The case where I found this is when OpenCV is included from the OpenEmbedded meta-oe layer. The patch below seems to correct an error in the usage of the SDK_OS variable within the cmake.bbclass file.

meta/classes/cmake.bbclass +1 -1
index e64c30c..4ef9fca 100644
@@ -35,7 +35,7 @@ cmake_do_generate_toolchain_file() {
       cat > ${WORKDIR}/toolchain.cmake <<EOF
 # CMake system name must be something like "Linux".
 # This is important for cross-compiling.
-set( CMAKE_SYSTEM_NAME `echo ${SDK_OS} | sed 's/^./\u&/'` )
+set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed 's/^./\u&/'` )
 set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} )
 set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
 set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )

I tested this with a local build, and I believe this diff should be appended to the oecore.patch file in the meta-darwin layer source tree, and it should be applied in the appropriate branches of the Poky source tree.

Signature · 8 lines
james woodyatt <[email protected]>

Software Architect, New Devices Group

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto