Problem - Can't build .nexe with libtomcrypt (-ltomcrypt) on 64bit machine
"skipping incompatible" or "not found".
/home/ME/nacl/pepper_35/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/bin/ld: skipping incompatible /home/ME/nacl/pepper_35/toolchain/linux_x86_newlib/i686-nacl/usr/lib/libtomcrypt.a when searching for -ltomcrypt
/home/ME/nacl/pepper_35/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/bin/ld: skipping incompatible /home/ME/nacl/pepper_35/toolchain/linux_x86_newlib/bin/../x86_64-nacl/usr/lib/libtomcrypt.a when searching for -ltomcrypt
/home/ME/nacl/pepper_35/toolchain/linux_x86_newlib/bin/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/bin/ld: cannot find -ltomcrypt
collect2: ld returned 1 exit status
make: *** [newlib/Release/my_module_unstripped_x86_32.nexe] Error 1
Makefile
Copy of existing example in downloaded nacl sdk. Modified with tomcrypt which result in -ltomcrypt flag.
VALID_TOOLCHAINS := newlib glibc pnacl linux
NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..)
include $(NACL_SDK_ROOT)/tools/common.mk
TARGET = my_module
LIBS = ppapi_cpp ppapi pthread tomcrypt
CFLAGS = -Wall
SOURCES = my_module.cc
# Build rules generated by macros from common.mk:
$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
ifeq ($(CONFIG),Release)
$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
else
$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
endif
$(eval $(call NMF_RULE,$(TARGET),))
What I have
- Linux 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
my_module.cc- nacl module code (no more .cc files)#include <tomcrypt.h>
Makefile(above)~/nacl/pepper_35/~/nacl/naclports
I tried to reinstall libtocrypt with naclports, but no progress.
As I understant my tomcrypt lib built as 32bit but I don't know how to point compiler to make it 64bit.
There is no errors if Makefile is without tomcrypt flag.
I'm not Makefile or C++ pro, but I'm digging there slowly, so it's best to give instructions for me as for newbie on this topics :D
It's been actually a different issue. (I understan dit right after I posted question.. And only now was able to test it).
Actually I was able to make 64bit .nexe. Problem was with 32bit .nexe. It failed that i couldn't compile them. Error message "skipping incompatible" was given that i tried to find 32bit file but it was 64bit. When I understand that I found similar issue and solution hint.
Go back to naclports and remove installed libs.
Edit
make_all.shto compile naclports libs with-m32flagsFirst install
g++-multilibto be able to compile 32bit apps. I have ubuntu, soNext define flag variables and move
# i686 NaClsection to end (so given flags don't break another 64bit sections)Make your libs again
Finally make your NaCl module
Using same Makefile that I copied in question.
Success!