Posts: 350
Threads: 18
Joined: Oct 2014
Thanks: 26
Given 54 thank(s) in 47 post(s)
How did you guys get PolarSSL to compile correctly on the Raspberry Pi? I'm attempting to get it to compile on an Odroid XU3 (A beast of an ARM board) but I always end up with the error:
bignum.c:1123:1: error: r7 cannot be used in asm here
I already tried to set compiler flags such as -O2 and -fomit-frame-pointer but nothing works.
Posts: 783
Threads: 12
Joined: Jan 2014
Thanks: 2
Given 73 thank(s) in 61 post(s)
01-26-2015, 09:19 AM
(This post was last modified: 01-26-2015, 09:26 AM by worktycho.)
Not a long term fix. But as a hot fix, try commenting out the line "#define POLARSSL_HAVE_ASM" in lib/polarssl/include/polarssl/bn_mul.h
Also what is the output of gcc -dM -E - < /dev/null ?
Also how did you set -fomit-frame-pointer? we may overwrite the CFLAGS in cmake.
Posts: 783
Threads: 12
Joined: Jan 2014
Thanks: 2
Given 73 thank(s) in 61 post(s)
I think I've found the difference between a pi and an Odroid XU3. The pi's use a ARM1176JZF-S processor that supports Thumb but not Thumb2. The Odroid however has a mixture of Cortex A series cores which support Thumb and Thumb2. PolarSSL has a special case asm for processors that support Thumb but not Thumb2. Which means the inline assembly is different on the Odroid. However why this should cause a build failure on the Odroid but not the pi is strange as the thumb special case code clobbers all the registers the thumb2/non-thumb one does and more. The only thing I can think of is that gcc on the pi handling the clobber and storing the frame pointer somewhere else temporally. So it would be useful to know the exact compiler version you are using.
Posts: 783
Threads: 12
Joined: Jan 2014
Thanks: 2
Given 73 thank(s) in 61 post(s)
The easiest way to add flags is to use the add_flags_cxx macro in SetFlags.cmake. The error that you get when commenting out the line is weird and suggests you've managed to break the makefiles.
The main problem we have with using precompiled libs is finding them on the platforms we support, particularly windows. So we haven't put in the development effort needed as the current system mostly works and finding precompiled files is a significant amount of work. However if anyone is willing to make the patch we'd accept it.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
What were your changes? Perhaps we can integrate them into the main repo somehow?
The main reason for not having ARMv7 binaries is, in my opinion, that none of us have a device to test them on, so even if we managed to build something, there's no way to tell.
I was planning on getting an Odroid U3, but I made it into a christmas gift tip and noone seems to have taken notice.
Posts: 783
Threads: 12
Joined: Jan 2014
Thanks: 2
Given 73 thank(s) in 61 post(s)
Xoft. I suspect we might have trouble integrating the changes. The problem is that we need to add the flag to debug builds, but it reduces our ability to debug so we don't want to add it to pi builds. However, as far as I can tell cmake does not have the capability to detect the architecture you're building against. So the best way to handle this would be yet another custom cmake flag.