Thanks, you were right:
Using 'make distclean' fixes it. As you guessed, I was building for several archs and did just 'make clean' between builds.
I removed --disable-assembler and it compiled for x86. Although the assembler was not picked up. It turns out it is due to the host (from configure output):
... checking host system type... x86-unknown-none ...
This host type is not covered in configure.ac:
asm_path= if test "x$enable_assembler" = xyes ; then case "$host_cpu" in [i?86* | k[5-8]* | pentium* | athlon]) asm_path=x86 ;;
Adding x86-* fixed it:
asm_path= if test "x$enable_assembler" = xyes ; then case "$host_cpu" in [i?86* | k[5-8]* | pentium* | athlon | x86]) asm_path=x86 ;;
After this change nettle compiles fine with clang targeting x86 for Android, with asm.
On 04/01/2018 15:55, Martin Storsjö wrote:
On Thu, 4 Jan 2018, blargh wrote:
Hi,
I've been building nettle with Clang from a generated toolchain with the latest Android NDK (16b).
Form architecture with available assembler code (x86 in particular), compilation fails because the generated asm is not compatible with clang. So I use --disable-assembler, thinking it would fix the problem. But it still fails (see log below):
The workaround has been to entirely disable (comment) the asm rule in Makefile.in:
#.asm.$(OBJEXT): $(srcdir)/asm.m4 machine.m4 config.m4 # $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$*.s # $(COMPILE) -c $*.s # @echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d
For some reason, this rule generates asm files even when --disable-assembler is specified and it gets in the way later in the build.
The proper fix would be to make sure this rule never kicks in with --disable-assembler. And also maybe force --disable-assembler when clang is the compiler, or update the asm generation macro (asm.m4) to produce .s files compatible with clang.
The error messages you quoted below show an attempt of assembling arm assembly when targeting i686. This sounds like a case of not running "make distclean" in the nettle source repo before reconfiguring for a different target.
Once you've cleaned the build tree properly, you could maybe retry even without the hacks and without --disable-assembler to see if it works even without that.
// Martin
On 04/01/2018 15:55, Martin Storsjö wrote:
On Thu, 4 Jan 2018, blargh wrote:
Hi,
I've been building nettle with Clang from a generated toolchain with the latest Android NDK (16b).
Form architecture with available assembler code (x86 in particular), compilation fails because the generated asm is not compatible with clang. So I use --disable-assembler, thinking it would fix the problem. But it still fails (see log below):
The workaround has been to entirely disable (comment) the asm rule in Makefile.in:
#.asm.$(OBJEXT): $(srcdir)/asm.m4 machine.m4 config.m4 # $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$*.s # $(COMPILE) -c $*.s # @echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d
For some reason, this rule generates asm files even when --disable-assembler is specified and it gets in the way later in the build.
The proper fix would be to make sure this rule never kicks in with --disable-assembler. And also maybe force --disable-assembler when clang is the compiler, or update the asm generation macro (asm.m4) to produce .s files compatible with clang.
The error messages you quoted below show an attempt of assembling arm assembly when targeting i686. This sounds like a case of not running "make distclean" in the nettle source repo before reconfiguring for a different target.
Once you've cleaned the build tree properly, you could maybe retry even without the hacks and without --disable-assembler to see if it works even without that.
// Martin