0

Is it possible to disable the automatic CPU-specific tuning in NaCl?

I would like to compile the reference .c ignoring any x86 .s (from qhasm) etc. where applicable.

Setting -march and -mtune or -mcpu appears not to be sufficient.

OJFord
  • 10,522
  • 8
  • 64
  • 98
  • Depending on what your actual goals are (e.g. producing code that runs on any x86 CPU), you might want to use to use LibSodium instead of NaCl. – CodesInChaos Jul 02 '14 at 17:10
  • @CodesInChaos Actually they goal is for code that runs on a non-x86 CPU. I'm cross-compiling but it's still trying to compile the x86 too. – OJFord Jul 02 '14 at 17:15
  • In that case I'd recommend LibSodium. If cross compiling doesn't work, you can open an issue on their github. LibSodium has active developers whereas NaCl is pretty much a codedrop without support. – CodesInChaos Jul 02 '14 at 17:22

2 Answers2

1

libsodium supports cross-compiling.

Use the standard --host=... switch when running the configure script.

Every release is verified to cross-compile (and pass all the tests on the actual platform or emulator) at least to iOS, linux/mips, linux/mipsel and linux/arm, as well as to javascript.

And indeed, feel free to open an issue if you have difficulties cross-compiling it to another target.

Frank Denis
  • 1,475
  • 9
  • 12
0

All the relevant build logic in nacl is in the bourne shell script ./do

To compile portable implementations and only those:

sed -i.original '
# use reference implementations only
/implementationdir=`dirname \$doth`/a\
  case "$implementationdir" in\
  */ref|*/portable) ;;\
  *) echo "SKIPPING $implementationdir"; continue ;;\
  esac
' ./do

(Authored at aetey.se, this piece of code above is hereby put in the public domain)

To be able to cross-compile you would have to remove the parts which compile and run ./try and ./measure (in sed/ex-like notation, given ./do as of nacl-20110221, something similar to: 352,358d; 347d; 275,326d;).

To avoid running the tests:

/for bintype in commandline tests/s/tests//

.