-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Cross-compiling for ARMv5 #331
Comments
Each release is tested on bare metal ARMv6 and ARMv7 servers, but only using Qemu emulation on ARMv5. I unfortunately don't have the hardware to test it on a real ARMv5 CPU. All the tests are properly passing on emulated ARMv5; however, and unlike real hardware, Qemu may not trigger exceptions on unaligned accesses, no matter what the Can you compile the library with symbols and provide a backtrace in order to see where this happens? I highly suspect this is due to alignment issues. |
Hi ! Error signal 11: Cheers ! |
Unfortunately, there is not much I can do without being able to test and without more information. Can you provide a backtrace? Also make sure that you are using a recent version of the GNU tools for ARM. Some versions have been known to generate code with incorrect alignment. |
Hi ! The GNU tools for ARM that I am using are working perfect for applications and several other 3:rd-party libraries (such as for example libao, libserial) so I don't think it's the culprit. )It's the version supplied by the factory of the ARMv5 system I am using.) |
The fact that Can you run gdb on the device? Then type:
And you'll get a backtrace. |
Nope, no gdb. The target device has a rather stripped down version of Linux. I'll try your suggestion later this weekend and post back here as soon as I got some kind of results. |
Right, I finally managed to make it run on my ARMv5 target by doing the following, many thanks for pointing me to the ARM toolchain that contained the nosys.spec & libnosys.a files :
Note: This is for making a static Example below assuming home folder =
Folder gcc-arm-none-eabi-4_9-can be deleted at this point.
Key discoveries for me :
Cheers ! |
I've spent the last few days trying to import and compile libsodium for an NXP Kinetis MCU in Keil. I was able to get it to compile but at runtime when running the "combined mode" example for public key signature (https://download.libsodium.org/doc/public-key_cryptography/public-key_signatures.html) it always fails the verification. Am I missing something here? Is there anything special that needs to be done to build libsodium for an ARM M4 in Keil? I've tried including the LDFLAGS listed above but it made no difference (from what I could tell). |
Hi manafeh, And thanks for reporting this. How did you compile it exactly? What exact tests are failing? Can you post their output and log? |
Thanks for the prompt response. I've tried compiling both as a separate library and including the source code with my application code. In both cases I am using ARM's Keil MDK IDE and compiler. The example that fails is listed below - it always reports an Incorrect signature. I even tried the following:
Let me know if you need me to provide any additional info. #define MESSAGE (const unsigned char *) "test"
#define MESSAGE_LEN 4
unsigned char pk[crypto_sign_PUBLICKEYBYTES];
unsigned char sk[crypto_sign_SECRETKEYBYTES];
crypto_sign_keypair(pk, sk);
unsigned char signed_message[crypto_sign_BYTES + MESSAGE_LEN];
unsigned long long signed_message_len;
crypto_sign(signed_message, &signed_message_len,
MESSAGE, MESSAGE_LEN, sk);
unsigned char unsigned_message[MESSAGE_LEN];
unsigned long long unsigned_message_len;
if (crypto_sign_open(unsigned_message, &unsigned_message_len,
signed_message, signed_message_len, pk) != 0) {
/* Incorrect signature! */
} |
Can you post the |
The build process is a bit more hidden from the user in Keil (and I'm pretty sure it's not using a GNU build system), so not sure how to obtain a config.log file. However, I was able to get a build log file - if that helps. |
What libsodium version does that come from? Some files such as Can you run the regular |
Hi !
I have been able to use libsodium in Ubuntu, but when cross-compiling it for ARMv5 I can execute sodium:init() with no problem nut then anything fails with a segmentation fault.
I have cross-compiled other applications and libraries for the same target with no issues.
Config :
./configure --host=armv5tejl-unknown-linux-gnueabihf --enable-static LDFLAGS=-static --prefix=/home/user/ARM
Make :
make v=1 DESTDIR=/home/user(ARM
Code:
Compiled with:
I have tried to follow the official instruction for ARM Cross-compiling at https://download.libsodium.org/doc/installation/index.html with no luck.
I have no nosys.specs file.
I also added a
printf("Inside\n");
line as the first statement in the crypto_box_keypair() function and it never prints anything, thus the address of crypto_box_keypair seems to be wrong (at least it's notNULL
).Does anyone have a clue what I am doing wrong here ?
Cheers & TIA !
/T
The text was updated successfully, but these errors were encountered: