Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation errors on MIPS-based embedded system #463

Closed
stwirth opened this issue Jul 22, 2022 · 4 comments
Closed

Compilation errors on MIPS-based embedded system #463

stwirth opened this issue Jul 22, 2022 · 4 comments
Labels
bug This issue is a bug. closed-for-staleness response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days.

Comments

@stwirth
Copy link

stwirth commented Jul 22, 2022

Describe the bug

I'm trying to cross-compile aws-iot-device-sdk-cpp-v2 v1.18.5 for a MIPS-based CPU using buildroot and I'm running into build problems.

Expected Behavior

No failures.

Current Behavior

First compilation problem:

CMake Error at _deps/aws-iot-device-sdk-cpp-v2-src/crt/aws-crt-cpp/crt/aws-lc/CMakeLists.txt:629 (message):
  Unknown processor:mipsel


-- Configuring incomplete, errors occurred!

My workaround:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 101b9b0ed..14eaacc5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -620,7 +620,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64.*|ARM64|aarch64")
   set(ARCH "aarch64")
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*")
   set(ARCH "arm")
-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips*")
   # Just to avoid the “unknown processor” error.
   set(ARCH "generic")
 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")

Next compilation problem is

In file included from /home/stwirth/project/out/product/myboard/obj/buildroot-intermediate/build/mypackage/_deps/aws-iot-device-sdk-cpp-v2-src/crt/aws-crt-cpp/crt/s2n/pq-crypto/sike_r3/sikep434r3.c:7:0:
/home/stwirth/project/out/product/myboard/obj/buildroot-intermediate/build/mypackage/_deps/aws-iot-device-sdk-cpp-v2-src/crt/aws-crt-cpp/crt/s2n/pq-crypto/sike_r3/sikep434r3.h:53:6: error: #error -- "Unsupported ARCHITECTURE"
     #error -- "Unsupported ARCHITECTURE"
      ^~~~~
In file included from /home/stwirth/project/out/product/myboard/obj/buildroot-intermediate/build/mypackage/_deps/aws-iot-device-sdk-cpp-v2-src/crt/aws-crt-cpp/crt/s2n/pq-crypto/sike_r3/sikep434r3.c:7:0:
/home/stwirth/project/out/product/myboard/obj/buildroot-intermediate/build/mypackage/_deps/aws-iot-device-sdk-cpp-v2-src/crt/aws-crt-cpp/crt/s2n/pq-crypto/sike_r3/sikep434r3.h:20:39: error: unknown type name 's2n_sike_p434_r3_digit_t'
 #define S2N_SIKE_P434_R3_NAMESPACE(s) s2n_sike_p434_r3_##s
....

My workaround:

diff --git a/pq-crypto/sike_r3/sikep434r3.h b/pq-crypto/sike_r3/sikep434r3.h
index 5b797b1d..5ea0b0cf 100644
--- a/pq-crypto/sike_r3/sikep434r3.h
+++ b/pq-crypto/sike_r3/sikep434r3.h
@@ -41,7 +41,7 @@ uint64_t bswap64(uint64_t x);
     #define S2N_SIKE_P434_R3_BSWAP_DIGIT(i)  bswap64((i))
     typedef uint64_t digit_t;
     typedef uint32_t hdigit_t;
-#elif defined(_X86_) || defined(_ARM_) || defined(__arm__) || defined(__i386__)
+#elif defined(_X86_) || defined(_ARM_) || defined(__arm__) || defined(__i386__) || defined(__mips__)
     #define S2N_SIKE_P434_R3_NWORDS_FIELD    14 /* Number of words of a 434-bit field element */
     #define S2N_SIKE_P434_R3_ZERO_WORDS      6  /* Number of "0" digits in the least significant part of p434 + 1 */
     #define S2N_SIKE_P434_R3_RADIX           32

With that I get the framework and the samples to compile.

Reproduction Steps

Add this repo as package to buildroot and build with a mips toolchain.

Possible Solution

See workarounds above. With those it seems to work fine.

Additional Information/Context

No response

SDK version used

v1.18.5

Environment details (OS name and version, etc.)

Ubuntu 20.04, cross-compiling for mips (32 bit)

@stwirth stwirth added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 22, 2022
@stwirth
Copy link
Author

stwirth commented Jul 26, 2022

The issue in pq-crypto is solved by updating the version of s2n, see aws/s2n-tls#1592.

@jmklix
Copy link
Member

jmklix commented Jul 26, 2022

Thanks for figuring out a workaround for these issues. Will fixing this resolve the aws-lc error that you are getting?

@jmklix jmklix added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 26, 2022
@jmklix
Copy link
Member

jmklix commented Jul 27, 2022

We are looking into updating the version of the dependencies to resolve this issue, but I'm not sure how long that will take. I just want to make sure that you are not blocked by this, and that the workarounds you listed above currently work for your use case?

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days. label Jul 27, 2022
@jmklix jmklix added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days. label Jul 28, 2022
@github-actions
Copy link

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 5 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 5 days unless further comments are made. labels Jul 29, 2022
@github-actions github-actions bot closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days.
Projects
None yet
Development

No branches or pull requests

2 participants