Skip to contentSkip to conversation

optee-test: Fix build with musl

PATCH Applied Khem Raj 2 participants 2 messages May 31, 2020 – Jun 1, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 optee-test: Fix build with musl

---
 ...Adjust-order-of-including-compiler.h.patch | 64 +++++++++++++++++++
 .../recipes-security/optee/optee-test_git.bb  |  4 +-
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch
meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch new file +64 -0
new file mode 100644
index 0000000..3066b66
@@ -0,0 +1,64 @@
+From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 30 May 2020 17:52:18 -0700
+Subject: [PATCH] host/xtest: Adjust order of including compiler.h
+
+compiler.h defines some defines which violate libc namespace e.g.
+__unused, this works ok with glibc but fails in awkward ways with musl
+the reason is musl uses __unused in its internal structures and this
+define in compiler.h conflicts with system headers causing errors like
+
+recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2];
+                   ^
+including compiler.h afer sys/stat.h fixes the problem.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ host/xtest/install_ta.c | 2 +-
+ host/xtest/stats.c      | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c
+index 09a4c6d..6f7bb5c 100644
+--- a/host/xtest/install_ta.c
++++ b/host/xtest/install_ta.c
+@@ -4,7 +4,6 @@
+  * SPDX-License-Identifier: BSD-2-Clause
+  */
+ 
+-#include <compiler.h>
+ #include <dirent.h>
+ #include <err.h>
+ #include <errno.h>
+@@ -20,6 +19,7 @@
+ #include <sys/types.h>
+ #include <tee_client_api.h>
+ #include <unistd.h>
++#include <compiler.h>
+ 
+ #include "install_ta.h"
+ #include "xtest_helpers.h"
+diff --git a/host/xtest/stats.c b/host/xtest/stats.c
+index 96b0b5f..db9bf25 100644
+--- a/host/xtest/stats.c
++++ b/host/xtest/stats.c
+@@ -3,7 +3,6 @@
+  * Copyright (c) 2019, Linaro Limited
+  */
+ 
+-#include <compiler.h>
+ #include <dirent.h>
+ #include <err.h>
+ #include <errno.h>
+@@ -18,6 +17,7 @@
+ #include <sys/types.h>
+ #include <tee_client_api.h>
+ #include <unistd.h>
++#include <compiler.h>
+ #include "xtest_test.h"
+ #include "stats.h"
+ 
+-- 
+2.26.2
+
meta-arm/recipes-security/optee/optee-test_git.bb +3 -1
index f699972..957286c 100644
@@ -13,7 +13,9 @@ DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
 PV = "3.8.0+git${SRCPV}"
 
 SRCREV = "30481e381cb4285706e7516853495a7699c93b2c"
-SRC_URI = "git://github.com/OP-TEE/optee_test.git"
+SRC_URI = "git://github.com/OP-TEE/optee_test.git \
+           file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \
+          "
 
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
Signature · 1 line
2.26.2
Applied
#1 lore raw
Quoted 1 line · Khem Raj

Applied to the master branch.

Thanks,
Jon

Quoted 96 lines
---
 ...Adjust-order-of-including-compiler.h.patch | 64 +++++++++++++++++++
 .../recipes-security/optee/optee-test_git.bb  |  4 +-
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch
meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch new file +64 -0
new file mode 100644
index 0000000..3066b66
@@ -0,0 +1,64 @@
+From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 30 May 2020 17:52:18 -0700
+Subject: [PATCH] host/xtest: Adjust order of including compiler.h
+
+compiler.h defines some defines which violate libc namespace e.g.
+__unused, this works ok with glibc but fails in awkward ways with musl
+the reason is musl uses __unused in its internal structures and this
+define in compiler.h conflicts with system headers causing errors like
+
+recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2];
+                   ^
+including compiler.h afer sys/stat.h fixes the problem.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ host/xtest/install_ta.c | 2 +-
+ host/xtest/stats.c      | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c
+index 09a4c6d..6f7bb5c 100644
+--- a/host/xtest/install_ta.c
++++ b/host/xtest/install_ta.c
+@@ -4,7 +4,6 @@
+  * SPDX-License-Identifier: BSD-2-Clause
+  */
+ 
+-#include <compiler.h>
+ #include <dirent.h>
+ #include <err.h>
+ #include <errno.h>
+@@ -20,6 +19,7 @@
+ #include <sys/types.h>
+ #include <tee_client_api.h>
+ #include <unistd.h>
++#include <compiler.h>
+ 
+ #include "install_ta.h"
+ #include "xtest_helpers.h"
+diff --git a/host/xtest/stats.c b/host/xtest/stats.c
+index 96b0b5f..db9bf25 100644
+--- a/host/xtest/stats.c
++++ b/host/xtest/stats.c
+@@ -3,7 +3,6 @@
+  * Copyright (c) 2019, Linaro Limited
+  */
+ 
+-#include <compiler.h>
+ #include <dirent.h>
+ #include <err.h>
+ #include <errno.h>
+@@ -18,6 +17,7 @@
+ #include <sys/types.h>
+ #include <tee_client_api.h>
+ #include <unistd.h>
++#include <compiler.h>
+ #include "xtest_test.h"
+ #include "stats.h"
+ 
+-- 
+2.26.2
+
meta-arm/recipes-security/optee/optee-test_git.bb +3 -1
index f699972..957286c 100644
@@ -13,7 +13,9 @@ DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
 PV = "3.8.0+git${SRCPV}"
 
 SRCREV = "30481e381cb4285706e7516853495a7699c93b2c"
-SRC_URI = "git://github.com/OP-TEE/optee_test.git"
+SRC_URI = "git://github.com/OP-TEE/optee_test.git \
+           file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \
+          "
 
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
Signature · 1 line
2.26.2