0

I'm trying to compile nexe files with nacplorts lib libtomcrypt. Building nexe it returns error of bunch of "undefined". I have tried building with different flag but nothing. Maybe someone can point out what I'm doing wrong or what I'm missing in current setup.

  • 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
  • ~/nacl/pepper_35/
  • ~/nacl/naclports

Result. Errors.

$ make
  LINK newlib/Release/myproj_unstripped_x86_32.nexe
/home/ME/nacl/pepper_35/toolchain/linux_x86_newlib/i686-nacl/usr/lib/libtomcrypt.a(aes.o): In function `rijndael_test':
aes.c:(.text+0x1271): undefined reference to `__stack_chk_fail'
/home/ME/nacl/pepper_35/toolchain/linux_x86_newlib/i686-nacl/usr/lib/libtomcrypt.a(crypt_argchk.o): In function `crypt_argchk':
crypt_argchk.c:(.text+0x1c): undefined reference to `stderr'
crypt_argchk.c:(.text+0x34): undefined reference to `__fprintf_chk'
collect2: ld returned 1 exit status
make: *** [newlib/Release/myproj_unstripped_x86_32.nexe] Error 1

Makefile

VALID_TOOLCHAINS := newlib glibc pnacl linux

NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..)

include $(NACL_SDK_ROOT)/tools/common.mk

TARGET = myproj
LIBS = ppapi_cpp ppapi pthread tomcrypt 

CFLAGS = -Wall
SOURCES = myproj.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),))

myproj.cc

Code contains only one line, that triggers all errors. Maybe i didn't add something more. I'm new to tomcrypt and not very good with C code but willing to learn. And if this code shouldn't compile can you give me example of simple "minimum-lines" code that uses tomcrypt but doesn't do anything complex? To be sure i can go further.

#include <tomcrypt.h>
//...

virtual void HandleMessage(const pp::Var& var) {

    register_cipher(&aes_desc); // <----------- without this line build is successful

    //...
}

//...
sowbug
  • 4,644
  • 22
  • 29
briiC
  • 2,134
  • 17
  • 28
  • Possibly related: ssp in http://stackoverflow.com/questions/4492799/undefined-reference-to-stack-chk-fail – sowbug Aug 26 '14 at 03:42

1 Answers1

1

It looks like the libtomcrypt build in naclports was never working correctly. Bug and fix in review here: https://code.google.com/p/naclports/issues/detail?id=134

sbc
  • 206
  • 1
  • 2
  • Cool! Thanks! It was it. I cleaned ports and made reinstall. Some problems with arm, but that is not important for now. Thanks for pointing out this. – briiC Aug 26 '14 at 11:48