Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make errors #1

Closed
elvisimprsntr opened this issue Nov 5, 2014 · 11 comments
Closed

Make errors #1

elvisimprsntr opened this issue Nov 5, 2014 · 11 comments

Comments

@elvisimprsntr
Copy link

Total NOOB here. I am trying to get your code running on a Raspberry Pi.

I have already performed the following:

  • apt-get install libavahi-compat-libdnssd-dev openssl clang -y
  • git clone https://github.com/etwmc/PersonalHomeKit.git
  • cd PersonalHomeKit
  • make

Get the following error message:

root@raspberrypi:/PersonalHomeKit# make
clang -Ofast -w -o chacha20.o -c Chacha20/chacha20_simple.c
error: invalid integral value 'fast' in '-Ofast'
error: invalid integral value 'fast' in '-Ofast'
makefile:23: recipe for target 'chacha20.o' failed
make: *** [chacha20.o] Error 1
root@raspberrypi:
/PersonalHomeKit#

UPDATE: I got a little further on Ubuntu 14 VM

root@ubuntu-Server-14:/PersonalHomeKit# make
clang -Ofast -w -o chacha20.o -c Chacha20/chacha20_simple.c
clang -Ofast -w -o curve25519.o -c curve25519/curve25519-donna.c
clang -Ofast -w -o ed25519.o -c ed25519-donna/ed25519.c
clang -Ofast -w -o poly1305.o -c poly1305-opt-master/poly1305.c
clang -Ofast -w -c rfc6234-master/hkdf.c -o rfc6234-master/hkdf.o
clang -Ofast -w -c rfc6234-master/hmac.c -o rfc6234-master/hmac.o
clang -Ofast -w -c rfc6234-master/sha.c -o rfc6234-master/sha.o
clang++ -Ofast -w -c main.cpp
clang++ -Ofast -w -c PHKAccessory.cpp
clang++ -Ofast -w -c PHKControllerRecord.cpp
PHKControllerRecord.cpp:29:37: error: expected expression
fs.open(controllerRecordsAddress, std::ifstream::in);
^ # caret pointing to ,
PHKControllerRecord.cpp:61:41: error: expected expression
fs.open(controllerRecordsAddress, std::ofstream::trunc);
^ # caret pointing to ,
2 errors generated.
make: *** [PHKControllerRecord.o] Error 1
root@ubuntu-Server-14:
/PersonalHomeKit#

UPDATE2: Noticed LLVM 3.0 on RPi, 3.4 on Ubuntu 14. Changed makefile CFLAG from -Ofast to -O0 on RPi, but now get this:

clang++ -O0 -w -c PHKAccessory.cpp
PHKAccessory.cpp:129:19: error: use of undeclared identifier 'INT32_MIN'
if (minVal != INT32_MIN)
^
PHKAccessory.cpp:133:19: error: use of undeclared identifier 'INT32_MAX'
if (maxVal != INT32_MAX)
^
PHKAccessory.cpp:183:19: error: use of undeclared identifier 'INT32_MIN'
if (minVal != INT32_MIN)
^
PHKAccessory.cpp:187:19: error: use of undeclared identifier 'INT32_MAX'
if (maxVal != INT32_MAX)
^
4 errors generated.
makefile:35: recipe for target 'PHKAccessory.o' failed
make: *** [PHKAccessory.o] Error 1
root@raspberrypi:~/PersonalHomeKit#

@elvisimprsntr elvisimprsntr changed the title Make error Make errors Nov 5, 2014
@etwmc
Copy link
Owner

etwmc commented Nov 5, 2014

  1. You need to setup the Configuration.h first. (Instruction has been added to Readme.md)
  2. The makefile has changed from -Ofast back to -O3, so please clone it again.
  3. the problem in update 2 has been addressed. Please clone it again to see if there is any problem.

@elvisimprsntr
Copy link
Author

Thanks for the prompt reply. My first step is just to see if I can compile and run your code before modification.

Cloned and make messages. (Same on both RPi and VM)

clang -c -o PHKArduinoLightInterface.o PHKArduinoLightInterface.c
PHKArduinoLightInterface.c:59:5: warning: implicit declaration of function 'write' is invalid in C99
[-Wimplicit-function-declaration]
write(serialPort, temp, len);
^
1 warning generated.

@etwmc
Copy link
Owner

etwmc commented Nov 5, 2014

That line is actually kinda like a placeholder, and it won't do anything at all. (That's only work on the configuration I use. )
I have removed the code, so if you want to remove the warning, just clone again. (But I don't think there will be any problem in usage with the old version)

@elvisimprsntr
Copy link
Author

Complies cleanly on VM, but get this message when running ./PHK

root@ubuntu-Server-14:~/PersonalHomeKit# ./PHK
*** WARNING *** The program 'PHK' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=PHK
bonjour

On RPi, I now get the following:

clang++ -O3 -o PHK chacha20.o curve25519.o ed25519.o poly1305.o rfc6234-master/hkdf.o rfc6234-master/hmac.o rfc6234-master/sha.o main.o PHKAccessory.o PHKControllerRecord.o PHKNetworkIP.o PHKArduinoLightInterface.o srp/srp.o srp/cstr.o srp/t_math.o srp/srp6_server.o srp/t_conf.o srp/t_conv.o srp/t_pw.o srp/t_misc.o srp/t_truerand.o srp/t_read.o -lssl -lcrypto -ldl -pthread -ldns_sd
PHKAccessory.o: In function announce()': PHKAccessory.cpp:(.text+0x1c): undefined reference tooperator new[](unsigned long)'
PHKAccessory.o: In function handleAccessory(char const*, unsigned int, char**, unsigned int*)': PHKAccessory.cpp:(.text+0x1f0): undefined reference tooperator new[](unsigned long)'
PHKAccessory.cpp:(.text+0x3bc): undefined reference to operator new[](unsigned long)' PHKAccessory.cpp:(.text+0x57c): undefined reference tooperator new[](unsigned long)'
PHKAccessory.cpp:(.text+0x8e0): undefined reference to operator new[](unsigned long)' PHKAccessory.o:PHKAccessory.cpp:(.text+0xc3c): more undefined references tooperator new[](unsigned long)' follow
PHKAccessory.o: In function dictionaryWrap(std::string*, std::string*, unsigned short)': PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0x30): undefined reference tostd::string::append(char const_, unsigned long)'
PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0xc8): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0x104): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[Z14dictionaryWrapPSsS_t]+0x29c): undefined reference tostd::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)' PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0x320): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.o: In functionarrayWrap(std::string_, unsigned short)': PHKAccessory.cpp:(.text._Z9arrayWrapPSst[_Z9arrayWrapPSst]+0x40): undefined reference to std::string::append(char const
, unsigned long)'
PHKAccessory.cpp:(.text._Z9arrayWrapPSst[_Z9arrayWrapPSst]+0x90): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.cpp:(.text._Z9arrayWrapPSst[_Z9arrayWrapPSst]+0x108): undefined reference tostd::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&, unsigned long, unsigned long)'
PHKAccessory.cpp:(.text._Z9arrayWrapPSst[Z9arrayWrapPSst]+0x194): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.o: In functionwrap(char const)':
PHKAccessory.cpp:(.text._Z4wrapPKc[_Z4wrapPKc]+0x44): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z4wrapPKc[_Z4wrapPKc]+0x60): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.o: In functionAccessory::describe()': PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0x38): undefined reference to std::string::assign(char const*, unsigned long)'
PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0x64): undefined reference tostd::string::assign(char const_, unsigned long)' PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0xa4): undefined reference to operator new[](unsigned long)'
PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0x1b4): undefined reference tostd::string::assign(char const_, unsigned long)' PHKAccessory.o: In function Service::describe()':
PHKAccessory.cpp:(.text._ZN7Service8describeEv[ZN7Service8describeEv]+0x8c): undefined reference tostd::string::assign(char const_, unsigned long)' PHKAccessory.cpp:(.text._ZN7Service8describeEv[_ZN7Service8describeEv]+0xbc): undefined reference to std::string::assign(char const, unsigned long)'
PHKAccessory.cpp:(.text._ZN7Service8describeEv[_ZN7Service8describeEv]+0xfc): undefined reference to operator new[](unsigned long)' PHKAccessory.o: In functionattribute(unsigned short, unsigned short, int, std::string, unsigned short)':
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x50): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x220): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x248): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x32c): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x35c): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x460): more undefined references to std::string::append(char const, unsigned long)' follow
PHKAccessory.o: In function attribute(unsigned short, unsigned short, int, std::string, unsigned short)': PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x658): undefined reference tostd::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&, unsigned long, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x6d8): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x6e8): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x724): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x8f4): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x930): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x958): more undefined references to std::string::append(char const, unsigned long)' follow
PHKAccessory.o: In function std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': PHKAccessory.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6_]+0x44): undefined reference to std::string::reserve(unsigned long)'
PHKAccessory.cpp:(.text.ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6[ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6]+0x54): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.o: In function attribute(unsigned short, unsigned short, int, int, int, int, int, unit)':
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x64): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x8c): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[Z9attributettiiiii4unit]+0x1e0): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x224): undefined reference to std::string::append(char const, unsigned long)'
PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x24c): more undefined references to std::string::append(char const*, unsigned long)' follow PHKAccessory.o: In functionattribute(unsigned short, unsigned short, int, int, int, int, int, unit)':
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[Z9attributettiiiii4unit]+0xc8c): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xd0c): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xd1c): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xd58): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[Z9attributettiiiii4unit]+0xf28): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xf64): undefined reference to std::string::append(char const, unsigned long)'
PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xf8c): more undefined references to std::string::append(char const*, unsigned long)' follow PHKAccessory.o: In functionattribute(unsigned short, unsigned short, int, bool)':
PHKAccessory.cpp:(.text._Z9attributettib[Z9attributettib]+0x594): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x614): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x624): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x660): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettib[Z9attributettib]+0x830): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x86c): undefined reference to std::string::append(char const, unsigned long)'
PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x894): more undefined references to std::string::append(char const*, unsigned long)' follow PHKControllerRecord.o: In functionstd::vector<PHKKeyRecord, std::allocator >::_M_insert_aux(gnu_cxx::normal_iterator<PHKKeyRecord*, std::vector<PHKKeyRecord, std::allocator > >, PHKKeyRecord const&)':
PHKControllerRecord.cpp:(.text.ZNSt6vectorI12PHKKeyRecordSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0[ZNSt6vectorI12PHKKeyRecordSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0]+0x790): undefined reference to operator new(unsigned long)' PHKNetworkIP.o: In functionconnectionLoop(void
)':
PHKNetworkIP.cpp:(.text+0x4f8): undefined reference to operator new[](unsigned long)' PHKNetworkIP.o: In functionhandlePairSeup(int, char
)':
PHKNetworkIP.cpp:(.text+0x5e4): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x8b0): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x8dc): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x930): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o:PHKNetworkIP.cpp:(.text+0x994): more undefined references to operator new[](unsigned long)' follow PHKNetworkIP.o: In functionhandlePairSeup(int, char
)':
PHKNetworkIP.cpp:(.text+0x111c): undefined reference to operator new(unsigned long)' PHKNetworkIP.cpp:(.text+0x1378): undefined reference tooperator new(unsigned long)'
PHKNetworkIP.cpp:(.text+0x142c): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x147c): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x14fc): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x1598): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x15c8): undefined reference to operator new[](unsigned long)' PHKNetworkIP.o:PHKNetworkIP.cpp:(.text+0x1618): more undefined references tooperator new[](unsigned long)' follow
PHKNetworkIP.o: In function handlePairVerify(int, char_)': PHKNetworkIP.cpp:(.text+0x250c): undefined reference to operator new(unsigned long)'
PHKNetworkIP.cpp:(.text+0x2558): undefined reference tooperator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x2608): undefined reference to operator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x27f8): undefined reference tooperator new[](unsigned long)' PHKNetworkIP.o: In function PHKNetworkMessageData::addRecord(PHKNetworkMessageDataRecord&)':
PHKNetworkIP.cpp:(.text+0x2afc): undefined reference tooperator new[](unsigned long)' PHKNetworkIP.o: In function PHKNetworkMessageData::rawData(char const**, unsigned short*)':
PHKNetworkIP.cpp:(.text+0x2c40): undefined reference tostd::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const_, unsigned long, std::allocator<char> const&)' PHKNetworkIP.cpp:(.text+0x2c6c): undefined reference to std::string::reserve(unsigned long)'
PHKNetworkIP.cpp:(.text+0x2c7c): undefined reference tostd::string::append(unsigned long, char)' PHKNetworkIP.cpp:(.text+0x2ca8): undefined reference to std::string::reserve(unsigned long)'
PHKNetworkIP.cpp:(.text+0x2cb8): undefined reference tostd::string::append(unsigned long, char)' PHKNetworkIP.cpp:(.text+0x2e00): undefined reference to operator new[](unsigned long)'
PHKNetworkIP.o: In functionPHKNetworkResponse::getBinaryPtr(char__, int_)': PHKNetworkIP.cpp:(.text+0x3064): undefined reference to std::string::append(char const*, unsigned long)'
PHKNetworkIP.cpp:(.text+0x30a4): undefined reference tostd::string::append(char const_, unsigned long)' PHKNetworkIP.cpp:(.text+0x30b4): undefined reference to std::string::append(char const
, unsigned long)'
PHKNetworkIP.cpp:(.text+0x30c8): undefined reference to operator new[](unsigned long)' PHKNetworkIP.o: In functionPHKNetworkMessageData::operator=(PHKNetworkMessageData const&)':
PHKNetworkIP.cpp:(.text+0x3440): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x345c): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o: In function PHKNetworkMessage::getBinaryPtr(char**, int*)': PHKNetworkIP.cpp:(.text+0x34b4): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o: In function PHKNetworkMessageDataRecord::operator=(PHKNetworkMessageDataRecord const&)': PHKNetworkIP.cpp:(.text+0x357c): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o:PHKNetworkIP.cpp:(.text+0x36d4): more undefined references to `operator new[](unsigned long)' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)
makefile:21: recipe for target 'PHK' failed
make: *** [PHK] Error 1

Also I have been getting these types of compiler messages on RPi only

/tmp/curve25519-donna-v2kutt.s:4999: rdhi, rdlo and rm must all be different
/tmp/curve25519-donna-v2kutt.s:5183: Rd and Rm should be different in mla
/tmp/curve25519-donna-v2kutt.s:5265: rdhi, rdlo and rm must all be different
/tmp/curve25519-donna-v2kutt.s:5274: rdhi, rdlo and rm must all be different

/tmp/ed25519-MgSeEu.s:5521: Rd and Rm should be different in mul
/tmp/ed25519-MgSeEu.s:5523: rdhi, rdlo and rm must all be different
/tmp/ed25519-MgSeEu.s:5530: Rd and Rm should be different in mul
/tmp/ed25519-MgSeEu.s:5542: rdhi, rdlo and rm must all be different
/tmp/ed25519-MgSeEu.s:5552: rdhi, rdlo and rm must all be different
/tmp/ed25519-MgSeEu.s:5579: rdhi, rdlo and rm must all be different
/tmp/ed25519-MgSeEu.s:5592: Rd and Rm should be different in mul
/tmp/ed25519-MgSeEu.s:5599: rdhi, rdlo and rm must all be different
/tmp/ed25519-MgSeEu.s:5658: rdhi, rdlo and rm must all be different
/tmp/ed25519-MgSeEu.s:5661: rdhi, rdlo and rm must all be different

/tmp/poly1305-8SBgae.s: Assembler messages:
/tmp/poly1305-8SBgae.s:333: Rd and Rm should be different in mla
/tmp/poly1305-8SBgae.s:336: Rd and Rm should be different in mla

@etwmc
Copy link
Owner

etwmc commented Nov 5, 2014

Ubuntu: Avahi has this message, just ignore it and everything will be OK.
RPI: try to do a "make clean", it seems that there is something wrong on the C++ library.

@elvisimprsntr
Copy link
Author

RPi: Same issue after make clean and make. Also tried cloning again.

@etwmc
Copy link
Owner

etwmc commented Nov 5, 2014

Try run this directly
"clang++ -O3 -o PHK chacha20.o curve25519.o ed25519.o poly1305.o rfc6234-master/hkdf.o rfc6234-master/hmac.o rfc6234-master/sha.o main.o PHKAccessory.o PHKControllerRecord.o PHKNetworkIP.o PHKArduinoLightInterface.o srp/srp.o srp/cstr.o srp/t_math.o srp/srp6_server.o srp/t_conf.o srp/t_conv.o srp/t_pw.o srp/t_misc.o srp/t_truerand.o srp/t_read.o -lssl -lcrypto -ldl -pthread -ldns_sd -lstdc++"

@elvisimprsntr
Copy link
Author

RPi: Same result. I also tried reinstalling LLVM:

  • apt-get purge clang
  • apt-get autoremove
  • apt-get install clang

root@raspberrypi:~/PersonalHomeKit# clang++ -O3 -o PHK chacha20.o curve25519.o ed25519.o poly1305.o rfc6234-master/hkdf.o rfc6234-master/hmac.o rfc6234-master/sha.o main.o PHKAccessory.o PHKControllerRecord.o PHKNetworkIP.o PHKArduinoLightInterface.o srp/srp.o srp/cstr.o srp/t_math.o srp/srp6_server.o srp/t_conf.o srp/t_conv.o srp/t_pw.o srp/t_misc.o srp/t_truerand.o srp/t_read.o -lssl -lcrypto -ldl -pthread -ldns_sd -lstdc++
PHKAccessory.o: In function announce()': PHKAccessory.cpp:(.text+0x1c): undefined reference tooperator new[](unsigned long)'
PHKAccessory.o: In function handleAccessory(char const*, unsigned int, char**, unsigned int*)': PHKAccessory.cpp:(.text+0x1f0): undefined reference tooperator new[](unsigned long)'
PHKAccessory.cpp:(.text+0x3bc): undefined reference to operator new[](unsigned long)' PHKAccessory.cpp:(.text+0x57c): undefined reference tooperator new[](unsigned long)'
PHKAccessory.cpp:(.text+0x8e0): undefined reference to operator new[](unsigned long)' PHKAccessory.o:PHKAccessory.cpp:(.text+0xc3c): more undefined references tooperator new[](unsigned long)' follow
PHKAccessory.o: In function dictionaryWrap(std::string*, std::string*, unsigned short)': PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0x30): undefined reference tostd::string::append(char const_, unsigned long)'
PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0xc8): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0x104): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[Z14dictionaryWrapPSsS_t]+0x29c): undefined reference tostd::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)' PHKAccessory.cpp:(.text._Z14dictionaryWrapPSsS_t[_Z14dictionaryWrapPSsS_t]+0x320): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.o: In functionarrayWrap(std::string_, unsigned short)': PHKAccessory.cpp:(.text._Z9arrayWrapPSst[_Z9arrayWrapPSst]+0x40): undefined reference to std::string::append(char const
, unsigned long)'
PHKAccessory.cpp:(.text._Z9arrayWrapPSst[_Z9arrayWrapPSst]+0x90): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.cpp:(.text._Z9arrayWrapPSst[_Z9arrayWrapPSst]+0x108): undefined reference tostd::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&, unsigned long, unsigned long)'
PHKAccessory.cpp:(.text._Z9arrayWrapPSst[Z9arrayWrapPSst]+0x194): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.o: In functionwrap(char const)':
PHKAccessory.cpp:(.text._Z4wrapPKc[_Z4wrapPKc]+0x44): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z4wrapPKc[_Z4wrapPKc]+0x60): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.o: In functionAccessory::describe()': PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0x38): undefined reference to std::string::assign(char const*, unsigned long)'
PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0x64): undefined reference tostd::string::assign(char const_, unsigned long)' PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0xa4): undefined reference to operator new[](unsigned long)'
PHKAccessory.cpp:(.text._ZN9Accessory8describeEv[_ZN9Accessory8describeEv]+0x1b4): undefined reference tostd::string::assign(char const_, unsigned long)' PHKAccessory.o: In function Service::describe()':
PHKAccessory.cpp:(.text._ZN7Service8describeEv[ZN7Service8describeEv]+0x8c): undefined reference tostd::string::assign(char const_, unsigned long)' PHKAccessory.cpp:(.text._ZN7Service8describeEv[_ZN7Service8describeEv]+0xbc): undefined reference to std::string::assign(char const, unsigned long)'
PHKAccessory.cpp:(.text._ZN7Service8describeEv[_ZN7Service8describeEv]+0xfc): undefined reference to operator new[](unsigned long)' PHKAccessory.o: In functionattribute(unsigned short, unsigned short, int, std::string, unsigned short)':
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x50): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x220): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x248): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x32c): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x35c): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x460): more undefined references to std::string::append(char const, unsigned long)' follow
PHKAccessory.o: In function attribute(unsigned short, unsigned short, int, std::string, unsigned short)': PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x658): undefined reference tostd::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&, unsigned long, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x6d8): undefined reference to std::string::append(char const*, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x6e8): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x724): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x8f4): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiSst[Z9attributettiSst]+0x930): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiSst[_Z9attributettiSst]+0x958): more undefined references to std::string::append(char const, unsigned long)' follow
PHKAccessory.o: In function std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': PHKAccessory.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6_]+0x44): undefined reference to std::string::reserve(unsigned long)'
PHKAccessory.cpp:(.text.ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6[ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6]+0x54): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.o: In function attribute(unsigned short, unsigned short, int, int, int, int, int, unit)':
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x64): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x8c): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[Z9attributettiiiii4unit]+0x1e0): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x224): undefined reference to std::string::append(char const, unsigned long)'
PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0x24c): more undefined references to std::string::append(char const*, unsigned long)' follow PHKAccessory.o: In functionattribute(unsigned short, unsigned short, int, int, int, int, int, unit)':
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[Z9attributettiiiii4unit]+0xc8c): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xd0c): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xd1c): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xd58): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[Z9attributettiiiii4unit]+0xf28): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xf64): undefined reference to std::string::append(char const, unsigned long)'
PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettiiiii4unit[_Z9attributettiiiii4unit]+0xf8c): more undefined references to std::string::append(char const*, unsigned long)' follow PHKAccessory.o: In functionattribute(unsigned short, unsigned short, int, bool)':
PHKAccessory.cpp:(.text._Z9attributettib[Z9attributettib]+0x594): undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&, unsigned long, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x614): undefined reference tostd::string::append(char const, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x624): undefined reference to std::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x660): undefined reference to std::string::append(char const*, unsigned long)'
PHKAccessory.cpp:(.text._Z9attributettib[Z9attributettib]+0x830): undefined reference tostd::string::append(char const_, unsigned long)' PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x86c): undefined reference to std::string::append(char const, unsigned long)'
PHKAccessory.o:PHKAccessory.cpp:(.text._Z9attributettib[_Z9attributettib]+0x894): more undefined references to std::string::append(char const*, unsigned long)' follow PHKControllerRecord.o: In functionstd::vector<PHKKeyRecord, std::allocator >::_M_insert_aux(gnu_cxx::normal_iterator<PHKKeyRecord*, std::vector<PHKKeyRecord, std::allocator > >, PHKKeyRecord const&)':
PHKControllerRecord.cpp:(.text.ZNSt6vectorI12PHKKeyRecordSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0[ZNSt6vectorI12PHKKeyRecordSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0]+0x790): undefined reference to operator new(unsigned long)' PHKNetworkIP.o: In functionconnectionLoop(void
)':
PHKNetworkIP.cpp:(.text+0x4f8): undefined reference to operator new[](unsigned long)' PHKNetworkIP.o: In functionhandlePairSeup(int, char
)':
PHKNetworkIP.cpp:(.text+0x5e4): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x8b0): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x8dc): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x930): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o:PHKNetworkIP.cpp:(.text+0x994): more undefined references to operator new[](unsigned long)' follow PHKNetworkIP.o: In functionhandlePairSeup(int, char
)':
PHKNetworkIP.cpp:(.text+0x111c): undefined reference to operator new(unsigned long)' PHKNetworkIP.cpp:(.text+0x1378): undefined reference tooperator new(unsigned long)'
PHKNetworkIP.cpp:(.text+0x142c): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x147c): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x14fc): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x1598): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x15c8): undefined reference to operator new[](unsigned long)' PHKNetworkIP.o:PHKNetworkIP.cpp:(.text+0x1618): more undefined references tooperator new[](unsigned long)' follow
PHKNetworkIP.o: In function handlePairVerify(int, char_)': PHKNetworkIP.cpp:(.text+0x250c): undefined reference to operator new(unsigned long)'
PHKNetworkIP.cpp:(.text+0x2558): undefined reference tooperator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x2608): undefined reference to operator new[](unsigned long)'
PHKNetworkIP.cpp:(.text+0x27f8): undefined reference tooperator new[](unsigned long)' PHKNetworkIP.o: In function PHKNetworkMessageData::addRecord(PHKNetworkMessageDataRecord&)':
PHKNetworkIP.cpp:(.text+0x2afc): undefined reference tooperator new[](unsigned long)' PHKNetworkIP.o: In function PHKNetworkMessageData::rawData(char const**, unsigned short*)':
PHKNetworkIP.cpp:(.text+0x2c40): undefined reference tostd::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const_, unsigned long, std::allocator<char> const&)' PHKNetworkIP.cpp:(.text+0x2c6c): undefined reference to std::string::reserve(unsigned long)'
PHKNetworkIP.cpp:(.text+0x2c7c): undefined reference tostd::string::append(unsigned long, char)' PHKNetworkIP.cpp:(.text+0x2ca8): undefined reference to std::string::reserve(unsigned long)'
PHKNetworkIP.cpp:(.text+0x2cb8): undefined reference tostd::string::append(unsigned long, char)' PHKNetworkIP.cpp:(.text+0x2e00): undefined reference to operator new[](unsigned long)'
PHKNetworkIP.o: In functionPHKNetworkResponse::getBinaryPtr(char__, int_)': PHKNetworkIP.cpp:(.text+0x3064): undefined reference to std::string::append(char const*, unsigned long)'
PHKNetworkIP.cpp:(.text+0x30a4): undefined reference tostd::string::append(char const_, unsigned long)' PHKNetworkIP.cpp:(.text+0x30b4): undefined reference to std::string::append(char const
, unsigned long)'
PHKNetworkIP.cpp:(.text+0x30c8): undefined reference to operator new[](unsigned long)' PHKNetworkIP.o: In functionPHKNetworkMessageData::operator=(PHKNetworkMessageData const&)':
PHKNetworkIP.cpp:(.text+0x3440): undefined reference to operator new[](unsigned long)' PHKNetworkIP.cpp:(.text+0x345c): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o: In function PHKNetworkMessage::getBinaryPtr(char**, int*)': PHKNetworkIP.cpp:(.text+0x34b4): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o: In function PHKNetworkMessageDataRecord::operator=(PHKNetworkMessageDataRecord const&)': PHKNetworkIP.cpp:(.text+0x357c): undefined reference tooperator new[](unsigned long)'
PHKNetworkIP.o:PHKNetworkIP.cpp:(.text+0x36d4): more undefined references to `operator new[](unsigned long)' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@etwmc
Copy link
Owner

etwmc commented Nov 5, 2014

Try changing the line2-4 of makefile to this
CFLAG = -O0
CC = gcc
CPP = g++

I don't have a RPi yet, so I can't actually test it.

@elvisimprsntr
Copy link
Author

Tried compiling with the default gcc/g++ 4.6.3

root@raspberrypi:/PersonalHomeKit# make
gcc -O0 -w -o chacha20.o -c Chacha20/chacha20_simple.c
gcc -O0 -w -o curve25519.o -c curve25519/curve25519-donna.c
gcc -O0 -w -o ed25519.o -c ed25519-donna/ed25519.c
gcc -O0 -w -o poly1305.o -c poly1305-opt-master/poly1305.c
gcc -O0 -w -c rfc6234-master/hkdf.c -o rfc6234-master/hkdf.o
gcc -O0 -w -c rfc6234-master/hmac.c -o rfc6234-master/hmac.o
gcc -O0 -w -c rfc6234-master/sha.c -o rfc6234-master/sha.o
g++ -O0 -w -c main.cpp
In file included from main.cpp:11:0:
PHKNetworkIP.h:38:27: error: ISO C++ forbids initialization of member ‘index’ [-fpermissive]
PHKNetworkIP.h:38:27: error: making ‘index’ static [-fpermissive]
PHKNetworkIP.h:38:27: error: ISO C++ forbids in-class initialization of non-const static member ‘index’
PHKNetworkIP.h:39:18: error: ISO C++ forbids initialization of member ‘data’ [-fpermissive]
PHKNetworkIP.h:39:18: error: making ‘data’ static [-fpermissive]
PHKNetworkIP.h:39:18: error: invalid in-class initialization of static data member of non-integral type ‘char_’
PHKNetworkIP.h:40:27: error: ISO C++ forbids initialization of member ‘length’ [-fpermissive]
PHKNetworkIP.h:40:27: error: making ‘length’ static [-fpermissive]
PHKNetworkIP.h:40:27: error: ISO C++ forbids in-class initialization of non-const static member ‘length’
PHKNetworkIP.h:41:21: error: ISO C++ forbids initialization of member ‘activate’ [-fpermissive]
PHKNetworkIP.h:41:21: error: making ‘activate’ static [-fpermissive]
PHKNetworkIP.h:41:21: error: ISO C++ forbids in-class initialization of non-const static member ‘activate’
PHKNetworkIP.h:48:27: error: ISO C++ forbids initialization of member ‘count’ [-fpermissive]
PHKNetworkIP.h:48:27: error: making ‘count’ static [-fpermissive]
PHKNetworkIP.h:48:27: error: ISO C++ forbids in-class initialization of non-const static member ‘count’
makefile:35: recipe for target 'main.o' failed
make: *_* [main.o] Error 1
root@raspberrypi:
/PersonalHomeKit# gcc --version
gcc (Debian 4.6.3-14+rpi1) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Manually upgraded to gcc/g++ 4.8.2 and recomplied

  • apt-get install gcc-4.8 g++-4.8
  • update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
  • update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
  • gcc --version
  • g++ --version
  • make clean
  • make

Success. Woohoo!

Although I noticed Avahi is not advertising the IPv6 MAC address for some reason. Looks like the RPi LAN interface does not support IPv6. Not sure if that is critical for HomeKit.

bonjour

GCC vs. LLVM

I came across an article which showed complied code using GCC is significantly faster than LLVM on ARM. Not sure if that is why gcc/g++ backports are more current for RPi ARMv6

@etwmc
Copy link
Owner

etwmc commented Nov 6, 2014

IPv4 is not that important (iOS Bonjour use any address it could get to connect. Unless Apple is making HomeKit available for remote access, and you have a IPv6 address from ISP. )
It seems that Clang does not support C++ library on RPi for some reason, so I will change the compiler to GCC in the next push. (It was develop using Grand Central Dispatch and blocks, so Clang is used before. )

@etwmc etwmc closed this as completed Nov 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants