ECDSA IN CONTIKI ERROR - contiki

Im trying to compile this file ecc-sign.c authored by you.
/home/user/Desktop/contiki-2.7/examples/cc2538-common/pka/ecc-sign.c
but what im getting is the errors below,
LD ecc-sign.z1
ecc-sign.co: In function `process_thread_ecdsa_sign_test':
ecc-sign.c:(.text+0x30): undefined reference to `pka_init'
ecc-sign.c:(.text+0x4a): undefined reference to `ecc_dsa_sign'
ecc-sign.c:(.text+0xd6): undefined reference to `ecc_compare'
ecc-sign.c:(.text+0x122): undefined reference to `ecc_compare'
ecc-sign.c:(.text+0x148): undefined reference to `pka_disable'
here is the make file in folder /home/user/Desktop/contiki-2.7/examples/cc2538-common/pka/
CONTIKI_PROJECT = ecc-ecdh ecc-sign ecc-verify
all: $(CONTIKI_PROJECT)
CONTIKI = ../../..
include $(CONTIKI)/Makefile.include

What is the hardware platform you are using?
LD ecc-sign.z1
If it's the Z1, the compilation fails, because this is example is based on the CC2538 chip, which supports hardware acceleration for ECDSA.
The Z1's MSP430 however doesn't and that's why it fails.

Related

How to ignore the errors coming from external library

i am using -Wconditional-uninitialized flag and then i am getting some errrors from the library.
external/com_google_protobuf/src/google/protobuf/arena.cc:398:12: error: variable 'arena' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get()); ^~~~~ external/com_google_protobuf/src/google/protobuf/arena.cc:395:21: note: initialize the variable 'arena' to silence this warning SerialArena* arena; ^ = nullptr 1 error generated.
i want to filter out this error since it is coming from the library and i am using Bazel 5.0 and feature : build --features=external_include_paths but still i am seeing the above error from the library.
Could you please help me on this?

How to fix Unresolved external from FILE2.0?

I have some HDF5 C code that I am trying to port to C++Builder. I am getting this error at build time:
[ilink64 Error] Error: Unresolved external 'H5check_version' referenced from D:\DELPHITOOLS\PASHDF\C\WIN64\DEBUG\FILE2.O
H5check_version is included in H5public.h as a macro.
Why does C++Builder not find this?
H5check_version is included in H5public.h as a macro.
If that were true, you would not be getting a linker error, since macros are handled only during the preprocessor stage.
Somewhere in your project, the compiler is seeing a declaration of H5check_version as a function, and your file2 unit is calling it as a function, but the linker can't find the implementation of that function, hence the error.
Your project needs to contain a reference to the appropriate .lib file that either implements the actual function (static linking) or tells the linker which DLL the function is exported from (dynamic linking).
C/C++ is case sensitive, so H5check_version is different from H5Check_version.
AFAIK pascal is not case sensitive at all.
Regards

Cant compile code with AzureIoTHub library on NodeMcu v3 (ESP8266) in Visual Code with Platformio

I'm working with Visual Studio Code, Platformio extension, Arduino framework. Have NodeMCU v3 board with ESP8266.
I wrote some simple program, which gets data from sensor and blinks some LED. Everythink went fine, code compiled and worked on the nodeMCU.
Great, so as a next step I wanted to connect it to Azure. So as multiple examples were showing, I included some libraries and wrote/copied simple code. After removing some first compilation errors:
missing blob.h -> https://github.com/Azure/azure-iot-arduino/issues/101
error in Arduino.h, round(x) -> https://github.com/Azure/azure-iot-arduino#simple-sample-instructions
MQTT_Protocol' was not declared -> https://github.com/Azure/azure-iot-arduino/issues/108
I've stucked with another error. After cutting code down, you can see a very easy code here:
#include <Arduino.h>
#include "config.h"
#include <ESP8266WiFi.h>
#include <AzureIoTHub.h>
#include <AzureIoTProtocol_MQTT.h>
#include <AzureIoTUtility.h>
#include <ArduinoJson.h>
#include "iothubtransportmqtt.h"
static IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle;
void setup() {
pinMode(PIN_GREEN_LED, OUTPUT);
digitalWrite(PIN_GREEN_LED, LOW);
static IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol = MQTT_Protocol;
iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString("connectionString", protocol);
}
void loop() {
digitalWrite(PIN_GREEN_LED, LOW);
}
Without calling IoTHubClient_LL_CreateFromConnectionString function, which I guess can't be skipped to make connection to Azure IoT Hub, code builds. I had to add iothubtransportmqtt.h, so the MQTT_Protocol is available.
My platformio.ini file (changing the board to esp12e makes no difference):
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps =
DHT
AzureIoTHub
ArduinoJson
This is how the build starts:
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 2.5.1 > NodeMCU 1.0 (ESP-12E Module) [or Espressif ESP8266 ESP-12E for esp12e board]
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif8266 3.20701.0 (2.7.1)
- tool-esptool 1.413.0 (4.13)
- tool-esptoolpy 1.20800.0 (2.8.0)
- toolchain-xtensa 2.40802.200502 (4.8.2)
Dependency:
Dependency Graph
DHT 1.0.0
AzureIoTHub 1.3.8
AzureIoTUtility 1.3.8.1
ESP8266WiFi 1.0
ArduinoJson 6.15.2
AzureIoTProtocol_MQTT 1.3.8
Here the terminal output with dozens of warnings before:
Linking .pio\build\nodemcuv2\firmware.elf
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothub_client_core_ll.c.o):(.text.initialize_iothub_client+0x6c): undefined reference to IoTHubClient_LL_UploadToBlob_Destroy'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothub_client_core_ll.c.o):(.text.initialize_iothub_client+0x78): undefined reference toIoTHubClient_LL_UploadToBlob_Create'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothub_client_core_ll.c.o): in function initialize_iothub_client':
iothub_client_core_ll.c:(.text.initialize_iothub_client+0x1de): undefined reference toIoTHubClient_LL_UploadToBlob_Destroy'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: iothub_client_core_ll.c:(.text.initialize_iothub_client+0x3ea): undefined reference to IoTHubClient_LL_UploadToBlob_Create'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: iothub_client_core_ll.c:(.text.initialize_iothub_client+0x486): undefined reference toIoTHubClient_LL_UploadToBlob_Destroy'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: iothub_client_core_ll.c:(.text.initialize_iothub_client+0x547): undefined reference to IoTHubClient_LL_UploadToBlob_Destroy'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o):(.text.mqtt_operation_complete_callback+0x20): undefined
reference toretry_control_reset'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o): in function mqtt_operation_complete_callback':
iothubtransport_mqtt_common.c:(.text.mqtt_operation_complete_callback+0xd3): undefined reference toretry_control_reset'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o):(.text.free_transport_handle_data+0x0): undefined reference to retry_control_destroy'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o):(.text.free_transport_handle_data+0x1f): undefined reference toretry_control_destroy'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o):(.text.IoTHubTransport_MQTT_Common_SetRetryPolicy+0x8): undefined reference to retry_control_create'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o): in functionIoTHubTransport_MQTT_Common_SetRetryPolicy':
iothubtransport_mqtt_common.c:(.text.IoTHubTransport_MQTT_Common_SetRetryPolicy+0x37): undefined reference to retry_control_create'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: iothubtransport_mqtt_common.c:(.text.IoTHubTransport_MQTT_Common_SetRetryPolicy+0x60): undefined reference toretry_control_destroy'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o): in function IoTHubTransport_MQTT_Common_Create':
iothubtransport_mqtt_common.c:(.text.IoTHubTransport_MQTT_Common_Create+0x1ae): undefined reference toretry_control_create'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o):(.text.IoTHubTransport_MQTT_Common_DoWork+0x64): undefined reference to retry_control_should_retry'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o):(.text.IoTHubTransport_MQTT_Common_DoWork+0xca): undefined reference toretry_control_should_retry'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o):(.text.IoTHubTransport_MQTT_Common_SetOption+0x50): undefined reference to retry_control_set_option'
c:/users/mmielnic/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\nodemcuv2\lib1b2\libAzureIoTHub_ID480.a(iothubtransport_mqtt_common.c.o): in functionIoTHubTransport_MQTT_Common_SetOption':
iothubtransport_mqtt_common.c:(.text.IoTHubTransport_MQTT_Common_SetOption+0x192): undefined reference to `retry_control_set_option'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\nodemcuv2\firmware.elf] Error 1
I've found a reason of that issue. I did not resolve previous problem with lack of blob.h file corectly. The workaround with adding new parameters to platform.txt did not work, So I had to modify file iothub_client_ll_uploadtoblob.c manually by removing:
#include "internal/blob.h" line of code and all it affected there.
The second problem was, that there was file missing: iothub_client_retry_control.c for nodemcuv2 environment. I do not know why it wasn't there, but I used file from esp12e env, so simply copied:
.pio\libdeps\esp12e\AzureIoTHub_ID480\src\iothub_client_retry_control.c
to
.pio\libdeps\nodemcuv2\AzureIoTHub_ID480\src\iothub_client_retry_control.c
After that, code compiled and I was able to connect to wifi and send messages to the Azure ioT Hub.
Hope it helps to someone.

error LNK2019: unresolved external symbol _ Open CV program

I am learning open CV and for the same i was trying few programs.
I am referring to this link.
http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_gender_classification.html
I am using visual studio 10 to run the same, and i think somewhere i have messed up with some configuration.
I am facing the same problem in couple of more programs (picked from same source) ,
The error which i get is as follows:-
1>main.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey#cv##YAHH#Z) referenced in function __catch$_main$0
1>main.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::subspaceReconstruct(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &)" (?subspaceReconstruct#cv##YA?AVMat#1#ABV_InputArray#1#00#Z) referenced in function __catch$_main$0
..... (more such unresolved external symbol error)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::_InputArray::empty(void)const " (?empty#_InputArray#cv##UBE_NXZ)
1>c:\users\isenses\documents\visual studio 2010\Projects\gender_classification\Debug\gender_classification.exe : fatal error LNK1120: 37 unresolved externals
1>
1>Build FAILED.
1>Time Elapsed 00:00:00.36
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My Project Properties are as follows:-
Properties->Configuration Properties ->Debugging->command arguments->C:\Users\isenses\Documents\Visual Studio 2010\Projects\gender_classification\csv.txt
Properties->Configuration Properties ->VC++ directories->Include directories->(added C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
&
C:\openCV_2.4\opencv\build\x86\vc10\lib)
C/C++->general->additional include directories (added include path of openCV ie:-
C:\openCV_2.4\opencv\build
Linker->General---
Enable incremental linking=no
Additional Library directories=C:\Program Files %28x86%29\Microsoft Visual Studio 10.0\VC\lib
C:\openCV_2.4\opencv\build\x86\vc10
linker->System---SubSystem= /SUBSYSTEM:CONSOLE
Linker->Input---
additional dependencies=
wsock32.lib
opencv_contrib2411d.lib
opencv_calib3d2411d.lib
opencv_ml2411d.lib
opencv_objdetect2411d.lib
Thank you.
Thanks to #miki i was able to build the file successfully.
The solution to my problem was:-
adding proper additional Dependencies in properties->linker->input.
Adding libraries path in windows environment variables.
I had not used proper additional dependencies as pointed by #miki and as quoted by him "well you also have to link opencv_coreXXX,opencv_highguiXXX, opencv_imgprocXXX etc... (with trailing "d" if in debug) in your Linker->Input--- additional dependencies"
Thanks again
I want to add an answer to this because I feel the documentation on the opencv site needs to be updated. I followed the tutorial and could not get the library to link. After many permutations I decided to look at the .lib files. My problem was quite simple. The lib files in the opencv tutorial are not complete. Specifically my lib directory includes three more lib files. I added three extra lib files to visual studio linker and the external symbol problem was solved.
I am unsure why this is the case because I was only trying to use functions contained within the core module. Anyway, hopefully this will help someone.
I am using opencv 3 and visual studio 2017.

Compile OpenCV sample convert_cascade.cpp (OpenCV 2.3)

I'm running OpenCV 2.3.1 on Ubuntu 11.10. I can compile various program I've written myself wih no issue.
Now, however, I have a half-done Haar cascade, that I need to assemble into the xml-cascade file. For this purpose I need to use the included sample program convert_cascade.c. It is not compiled by default, so I need to do that.
Running gcc like this fails:
gcc -lopencv_core -lopencv_highgui -lopencv_objdetect -I/usr/local/include/opencv/ -L/usr/local/lib/ convert_cascade.c -o convert_cascade
It gives me the following errors:
/tmp/cc5UddX6.o: In function `cvRound':
convert_cascade.c:(.text+0x19): undefined reference to `lrint'
/tmp/cc5UddX6.o: In function `cvDecRefData':
convert_cascade.c:(.text+0xb3b): undefined reference to `cvFree_'
convert_cascade.c:(.text+0xbac): undefined reference to `cvFree_'
/tmp/cc5UddX6.o: In function `cvGetRow':
convert_cascade.c:(.text+0xca2): undefined reference to `cvGetRows'
/tmp/cc5UddX6.o: In function `cvGetCol':
convert_cascade.c:(.text+0xccd): undefined reference to `cvGetCols'
/tmp/cc5UddX6.o: In function `cvReleaseMatND':
convert_cascade.c:(.text+0xce0): undefined reference to `cvReleaseMat'
/tmp/cc5UddX6.o: In function `cvSubS':
convert_cascade.c:(.text+0xe00): undefined reference to `cvAddS'
/tmp/cc5UddX6.o: In function `cvCloneSeq':
convert_cascade.c:(.text+0xe4e): undefined reference to `cvSeqSlice'
/tmp/cc5UddX6.o: In function `cvSetNew':
convert_cascade.c:(.text+0xead): undefined reference to `cvSetAdd'
/tmp/cc5UddX6.o: In function `cvGetSetElem':
convert_cascade.c:(.text+0xf40): undefined reference to `cvGetSeqElem'
/tmp/cc5UddX6.o: In function `cvEllipseBox':
convert_cascade.c:(.text+0x1040): undefined reference to `cvEllipse'
/tmp/cc5UddX6.o: In function `cvFont':
convert_cascade.c:(.text+0x1090): undefined reference to `cvInitFont'
/tmp/cc5UddX6.o: In function `cvReadIntByName':
convert_cascade.c:(.text+0x111e): undefined reference to `cvGetFileNodeByName'
/tmp/cc5UddX6.o: In function `cvReadRealByName':
convert_cascade.c:(.text+0x11af): undefined reference to `cvGetFileNodeByName'
/tmp/cc5UddX6.o: In function `cvReadStringByName':
convert_cascade.c:(.text+0x1209): undefined reference to `cvGetFileNodeByName'
/tmp/cc5UddX6.o: In function `cvReadByName':
convert_cascade.c:(.text+0x1239): undefined reference to `cvGetFileNodeByName'
convert_cascade.c:(.text+0x124f): undefined reference to `cvRead'
/tmp/cc5UddX6.o: In function `main':
convert_cascade.c:(.text+0x13b6): undefined reference to `cvLoadHaarClassifierCascade'
convert_cascade.c:(.text+0x1495): undefined reference to `cvSave'
collect2: ld returned 1 exit status
It seems that all the missing functions areare old C-style OpenCV functions prototyped in core_c.h. But including that ( #include <opencv2/core/core_c.h> ) makes no difference. I also tried compiling with the -lopencv_legacy flag (basically just a guess that it might have something to do with older functions), to no avail.
What should I do in order to compile it?
There should be a build_all.sh script in the /samples/c/ directory that will build all the examples for you; no CMAKE tweaks required.
Nevermind. It turned out I had to recompile OpenCV anyway in order to enable TBB, so I simply gave CMAKE the BUILD_EXAMPLES=ON command, and now I have it in a compiled version. I'm pretty sure that is not the proper solution though ;-)

Resources