Nim ui (libui) error - nim-lang

I tried to compile "controllgallery2.nim" , but ..
Error: execution of an external compiler program 'gcc.exe -c -w -mno-ms-bitfields -IC:\Users(User name)\Documents\Language\Nim\nim-0.18.0\lib -o G:\Nim \nimcache\win_debug.cpp.obj C:\Users(User name).nimble\pkgs\ui-0.9.2\ui./libui/windows\debug.cpp' failed with exit code: 1 C:\Users\terur.nimble\pkgs\ui-0.9.2\ui./libui/windows\debug.cpp: In function 'void realbug(const char*, const char*, const char*, const char*, con st char*, va_list)': C:\Users(User name).nimble\pkgs\ui-0.9.2\ui./libui/windows\debug.cpp:76:31: error: 'vsprintf_s' was not declared in this scope vsprintf_s(msg, n, format, ap); ^
What I should do to fix that error?

Related

undefined reference to `napi_create_function', compiled using cmake

I'm trying to compile a machine learning code written in c++ and connecting it to NodeJS using n-api, I have written the NAPI function in one of the files, and defined additional dependencies in CMake.
Installed
'node-addon-api': '^3.0.0'
'cmake-js':'^6.1.0'
error
> cmake-js compile
[
'/usr/bin/node',
'/home/nishant/Documents/demo/node_modules/.bin/cmake-js',
'compile'
]
info TOOL Using Unix Makefiles generator.
info CMD BUILD
info RUN cmake --build "/home/nishant/Documents/demo/build" --config Release
Consolidate compiler generated dependencies of target mobilenetknn
[ 60%] Built target mobilenetknn
Consolidate compiler generated dependencies of target program
[ 80%] Linking CXX executable program
CMakeFiles/program.dir/src/program.cpp.o: In function `Init(Napi::Env, Napi::Object)':
program.cpp:(.text+0x6b): undefined reference to `napi_create_function'
program.cpp:(.text+0xb8): undefined reference to `napi_create_symbol'
program.cpp:(.text+0xd3): undefined reference to `napi_create_external'
program.cpp:(.text+0x10f): undefined reference to `napi_define_properties'
program.cpp:(.text+0x133): undefined reference to `napi_create_string_utf8'
program.cpp:(.text+0x14a): undefined reference to `napi_set_property'
CMakeFiles/program.dir/src/program.cpp.o: In function `classAddTrainModel(Napi::CallbackInfo const&)':
program.cpp:(.text+0x268): undefined reference to `napi_coerce_to_number'
program.cpp:(.text+0x287): undefined reference to `napi_get_value_int32'
program.cpp:(.text+0x33a): undefined reference to `napi_get_element'
program.cpp:(.text+0x35d): undefined reference to `napi_get_element'
program.cpp:(.text+0x380): undefined reference to `napi_get_value_string_utf8'
program.cpp:(.text+0x3f7): undefined reference to `napi_get_value_string_utf8'
program.cpp:(.text+0x415): undefined reference to `napi_get_value_string_utf8'
program.cpp:(.text+0x48c): undefined reference to `napi_get_value_string_utf8'
program.cpp:(.text+0x8b8): undefined reference to `napi_create_double'
program.cpp:(.text+0xb55): undefined reference to `napi_get_undefined'
program.cpp:(.text+0xb7e): undefined reference to `napi_get_undefined'
program.cpp:(.text+0xbae): undefined reference to `napi_get_undefined'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::Error::~Error()':
program.cpp:(.text._ZN4Napi5ErrorD2Ev[_ZN4Napi5ErrorD5Ev]+0x46): undefined reference to `napi_delete_reference'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::AsyncContext::~AsyncContext()':
program.cpp:(.text._ZN4Napi12AsyncContextD2Ev[_ZN4Napi12AsyncContextD5Ev]+0x15): undefined reference to `napi_async_destroy'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::AsyncContext::~AsyncContext()':
program.cpp:(.text._ZN4Napi12AsyncContextD0Ev[_ZN4Napi12AsyncContextD5Ev]+0x19): undefined reference to `napi_async_destroy'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::Error::~Error()':
program.cpp:(.text._ZN4Napi5ErrorD0Ev[_ZN4Napi5ErrorD5Ev]+0x39): undefined reference to `napi_delete_reference'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::Error::Fatal(char const*, char const*)':
program.cpp:(.text._ZN4Napi5Error5FatalEPKcS2_[_ZN4Napi5Error5FatalEPKcS2_]+0x12): undefined reference to `napi_fatal_error'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::CallbackScope::~CallbackScope()':
program.cpp:(.text._ZN4Napi13CallbackScopeD2Ev[_ZN4Napi13CallbackScopeD5Ev]+0x14): undefined reference to `napi_close_callback_scope'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::CallbackScope::~CallbackScope()':
program.cpp:(.text._ZN4Napi13CallbackScopeD0Ev[_ZN4Napi13CallbackScopeD5Ev]+0x14): undefined reference to `napi_close_callback_scope'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::Error::New(napi_env__*)':
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0x30): undefined reference to `napi_get_last_error_info'
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0x45): undefined reference to `napi_is_exception_pending'
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0x84): undefined reference to `napi_create_string_utf8'
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0xbd): undefined reference to `napi_create_error'
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0x10b): undefined reference to `napi_create_reference'
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0x141): undefined reference to `napi_get_and_clear_last_exception'
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0x170): undefined reference to `napi_create_type_error'
program.cpp:(.text._ZN4Napi5Error3NewEP10napi_env__[_ZN4Napi5Error3NewEP10napi_env__]+0x1ef): undefined reference to `napi_delete_reference'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::HandleScope::~HandleScope()':
program.cpp:(.text._ZN4Napi11HandleScopeD2Ev[_ZN4Napi11HandleScopeD5Ev]+0xc): undefined reference to `napi_close_handle_scope'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::Error::ThrowAsJavaScriptException() const':
program.cpp:(.text._ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv[_ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv]+0x28): undefined reference to `napi_open_handle_scope'
program.cpp:(.text._ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv[_ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv]+0x43): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv[_ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv]+0x59): undefined reference to `napi_throw'
program.cpp:(.text._ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv[_ZNK4Napi5Error26ThrowAsJavaScriptExceptionEv]+0x6c): undefined reference to `napi_close_handle_scope'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::details::CallbackData<Napi::Number (*)(Napi::CallbackInfo const&), Napi::Number>::Wrapper(napi_env__*, napi_callback_info__*)':
program.cpp:(.text._ZN4Napi7details12CallbackDataIPFNS_6NumberERKNS_12CallbackInfoEES2_E7WrapperEP10napi_env__P20napi_callback_info__[_ZN4Napi7details12CallbackDataIPFNS_6NumberERKNS_12CallbackInfoEES2_E7WrapperEP10napi_env__P20napi_callback_info__]+0x65): undefined reference to `napi_get_cb_info'
program.cpp:(.text._ZN4Napi7details12CallbackDataIPFNS_6NumberERKNS_12CallbackInfoEES2_E7WrapperEP10napi_env__P20napi_callback_info__[_ZN4Napi7details12CallbackDataIPFNS_6NumberERKNS_12CallbackInfoEES2_E7WrapperEP10napi_env__P20napi_callback_info__]+0xb7): undefined reference to `napi_get_cb_info'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::EscapableHandleScope::~EscapableHandleScope()':
program.cpp:(.text._ZN4Napi20EscapableHandleScopeD2Ev[_ZN4Napi20EscapableHandleScopeD5Ev]+0xc): undefined reference to `napi_close_escapable_handle_scope'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::AsyncWorker::OnError(Napi::Error const&)':
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0x46): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0x71): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0x90): undefined reference to `napi_open_escapable_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0xb3): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0xde): undefined reference to `napi_call_function'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0xfa): undefined reference to `napi_is_exception_pending'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0x11c): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0x163): undefined reference to `napi_escape_handle'
program.cpp:(.text._ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE[_ZN4Napi11AsyncWorker7OnErrorERKNS_5ErrorE]+0x17a): undefined reference to `napi_close_escapable_handle_scope'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::AsyncWorker::OnOK()':
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0x6f): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0x93): undefined reference to `napi_open_escapable_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0xb6): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0xe8): undefined reference to `napi_call_function'
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0x104): undefined reference to `napi_is_exception_pending'
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0x126): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0x13d): undefined reference to `napi_close_escapable_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker4OnOKEv[_ZN4Napi11AsyncWorker4OnOKEv]+0x18b): undefined reference to `napi_escape_handle'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::Error::what() const':
program.cpp:(.text._ZNK4Napi5Error4whatEv[_ZNK4Napi5Error4whatEv]+0x42): undefined reference to `napi_open_escapable_handle_scope'
program.cpp:(.text._ZNK4Napi5Error4whatEv[_ZNK4Napi5Error4whatEv]+0x5f): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZNK4Napi5Error4whatEv[_ZNK4Napi5Error4whatEv]+0x81): undefined reference to `napi_get_named_property'
program.cpp:(.text._ZNK4Napi5Error4whatEv[_ZNK4Napi5Error4whatEv]+0xa2): undefined reference to `napi_escape_handle'
program.cpp:(.text._ZNK4Napi5Error4whatEv[_ZNK4Napi5Error4whatEv]+0xc1): undefined reference to `napi_close_escapable_handle_scope'
program.cpp:(.text._ZNK4Napi5Error4whatEv[_ZNK4Napi5Error4whatEv]+0xdd): undefined reference to `napi_get_value_string_utf8'
program.cpp:(.text._ZNK4Napi5Error4whatEv[_ZNK4Napi5Error4whatEv]+0x147): undefined reference to `napi_get_value_string_utf8'
CMakeFiles/program.dir/src/program.cpp.o: In function `Napi::AsyncWorker::OnWorkComplete(Napi::Env, napi_status)':
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x3b): undefined reference to `napi_open_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x6c): undefined reference to `napi_create_string_utf8'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x88): undefined reference to `napi_create_error'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0xff): undefined reference to `napi_create_reference'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x142): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x172): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x19c): undefined reference to `napi_open_escapable_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x1bf): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x1ed): undefined reference to `napi_call_function'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x20c): undefined reference to `napi_is_exception_pending'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x231): undefined reference to `napi_escape_handle'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x24e): undefined reference to `napi_close_escapable_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x2b3): undefined reference to `napi_close_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x377): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x3a1): undefined reference to `napi_open_escapable_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x3c4): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x3fc): undefined reference to `napi_call_function'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x41b): undefined reference to `napi_is_exception_pending'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x440): undefined reference to `napi_escape_handle'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x45d): undefined reference to `napi_close_escapable_handle_scope'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x491): undefined reference to `napi_delete_reference'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x4c2): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x532): undefined reference to `napi_get_reference_value'
program.cpp:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x778): undefined reference to `napi_delete_reference'
CMakeFiles/program.dir/src/program.cpp.o: In function `_register_mobilenetknn':
program.cpp:(.text.startup+0x6): undefined reference to `napi_module_register'
collect2: error: ld returned 1 exit status
CMakeFiles/program.dir/build.make:161: recipe for target 'program' failed
make[2]: *** [program] Error 1
CMakeFiles/Makefile2:110: recipe for target 'CMakeFiles/program.dir/all' failed
make[1]: *** [CMakeFiles/program.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
ERR! OMG Process terminated: 2
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demo#1.0.0 install: `cmake-js compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the demo#1.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/nishant/.npm/_logs/2021-05-25T19_38_32_738Z-debug.log
CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(mobilenetknn)
set(CMAKE_CXX_STANDARD 11)
SET(Caffe_DIR /home/nishant/caffe/distribute)
include_directories(${CMAKE_JS_INC})
include_directories(${Caffe_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/node_modules/node-addon-api)
file(GLOB_RECURSE SOURCE_O ${CMAKE_CURRENT_SOURCE_DIR}/lib/*.o GLOB SOURCE_FILES "src/*.cpp" "src/*.hpp")
# file(GLOB SOURCE_FILES "src/*.cpp" "src/*.hpp")
add_library(${PROJECT_NAME}
STATIC ${SRC}
${SOURCE_O} ${CMAKE_JS_SRC})
# add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
# add_library(SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
add_definitions(-DCPU_ONLY)
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_JS_LIB} ${Caffe_DIR}/lib/libcaffe.a)
SET(EXAMPLES
program
)
# License source files
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
find_package( OpenCV REQUIRED)
set(CMAKE_BUILD_TYPE release)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-DCPU_ONLY)
find_package(HDF5 COMPONENTS HL REQUIRED)
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${HDF5_LIBRARIES})
list(APPEND Caffe_LINKER_LIBS ${HDF5_HL_LIBRARIES})
execute_process(COMMAND node -p "require('node-addon-api').include"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_ADDON_API_DIR
)
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR} ${CAMKE_JS_INC})
# target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/node_modules/node-addon-api")
# target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_JS_LIB})
add_definitions(-DNAPI_VERSION=3)
include_directories(${OpenCV_DIR}/include)
foreach (example ${EXAMPLES})
add_executable(${example} src/${example}.cpp)
TARGET_LINK_LIBRARIES(${example} ${OpenCV_LIBS} ${CMAKE_CURRENT_LIST_DIR}/build/libmobilenetknn.a ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} -lopenblas -lprotobuf -lboost_system -lglog -lgflags -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_ml -lopencv_imgcodecs -lopencv_videoio -lboost_system -lboost_regex -lboost_filesystem -lboost_thread -lboost_log)
endforeach()
main file(program.cpp)
I commented some of the functions, the same problem was with other functions also.
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/ml.hpp>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
// #include "napi.h"
#include <napi.h>
// #include <node_modules/node-addon-api/napi.h>
using namespace std;
using namespace cv;
using namespace cv::ml;
// using namespace Napi;
struct classInfo{
int classid;
std::string classname;
std::string imageset_location;
};
class Classify{ // declaration of class classify
public:
Classify(); //constructor
~Classify(); //destructor
std::vector<classInfo>cls;
int counter=0;
Ptr<KNearest> trainedModel;
std::string infer(std::string data_path);
void loadModel(string knn_path="train.knn");
std::string exportTrainedModel();
void trainModel(vector<classInfo>cls);
void listClasses(vector<classInfo>n);
vector<classInfo> addClass(std::string classname, std::string imageset_location);
};
Classify ic;
Napi::Number classAddTrainModel(const Napi::CallbackInfo& info){
Napi::Env env = info.Env();
// number of classes
int n = info[0].ToNumber();
Napi::Array classn = info[1].As<Napi::Array>();
Napi::Array iloc = info[2].As<Napi::Array>();
vector<classInfo> classinfo;
for(int i = 0; i < n; i++){
Napi::Value x = classn[i];
Napi::Value y = iloc[i];
string className = (string)x.As<Napi::String>();
string loc = (string)y.As<Napi::String>();
// cout << className << endl << loc << endl;
classinfo = ic.addClass(className, loc);
}
// Train Model
ic.trainModel(classinfo);
return Napi::Number::New(env, 1);
}
// Napi::String modelExport(const Napi::CallbackInfo& info){
// Napi::Env env = info.Env();
// std::string path = ic.exportTrainedModel();
// return Napi::String::New(env, ic.exportTrainedModel());
// }
// Napi::String modelLoad(const Napi::CallbackInfo& info){
// Napi::Env env = info.Env();
// std::string modelPath = info[0].ToString();
// std::string imgPath = info[1].ToString();
// ic.loadModel(modelPath);
// std::string label = ic.infer(imgPath);
// return Napi::String::New(env, label);
// }
Napi::Object Init(Napi::Env env, Napi::Object exports){
// set a key on exports object
exports.Set(
Napi::String::New(env, "classAddTrainModel"),
Napi::Function::New(env, classAddTrainModel)
);
// exports.Set(
// Napi::String::New(env, "modelExport"),
// Napi::Function::New(env, modelExport)
// );
// exports.Set(
// Napi::String::New(env, "modelLoad"),
// Napi::Function::New(env, modelLoad)
// );
// return 'exports' object (always)
return exports;
}
// register 'greet' module which calls Init method
NODE_API_MODULE(mobilenetknn, Init);
int main(){
return 0;
}

I am getting compilation error for posix_spawnp function on Android-ndk

I am using Ubuntu Linux and Android (android-ndk-r21d). When I am compiling my code with ndk-build, I am getting compilation error for posix_spawnp function call. I have included the header <spawn.h> for this function. I am unable to figure what compilation and Link flags I should use for this function in my Android.mk file. Is this function supported on Android-ndk ?
alc#alc:~/src/ForkBench(master)$ ndk-build NDK_PROJECT_PATH=./
[arm64-v8a] Compile : forkBench <= forkBench.c
jni/../forkBench.c:61:12: error: implicit declaration of function 'posix_spawnp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
status = posix_spawnp(&pid, TRUEAPP, NULL, NULL, launch_argv, NULL);
^
jni/../forkBench.c:90:12: error: implicit declaration of function 'posix_spawnp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
status = posix_spawnp(&pid, TRUEAPP, NULL, NULL, launch_argv, NULL);
^
2 errors generated.
make: *** [/home/alc/android-ndk-r21d-linux-x86_64/android-ndk-r21d/build/core/build-binary.mk:476: obj/local/arm64-v8a/objs/forkBench/__/forkBench.o] Error 1

Building old version of Intel i40e driver on centOS errors

I'm trying to build an old version of the i40e driver for the Intel X710 NIC.
I have to use an old version of the driver because they removed a functionality I need.
The version I'm trying to use is i40e-1.5.23 from 10/5/2016.
If I try to build the latest version, I don't get any errors.
I have installed "Development Tools" packages so Kernel-Devel, gcc...
My current Kernel version is 3.10.0-693.21.1.el7.x86_64
My current CentOS version is 7.4.1708
I tried with different kernel/kernel header versions but still get the same error. I also tried with various version of the i40e driver.
In the readme of the driver it's written that the kernel and kernel header files must be the same version and I'm quite sure they are in my situation.
Here is the output when I try to make in the src folder of the driver :
make[1]: Entering directory '/usr/src/kernels/3.10.0-693.21.1.el7.x86_64'
CC [M] /home/fla/Desktop/i40e-1.5.23/src/i40e_main.o
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5097:20: error: redefinition of ‘csum_replace_by_diff’
static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
^~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/skbuff.h:30:0,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/tcp.h:21,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/tcp.h:24,
from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:27,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/checksum.h:110:20: note: previous definition of ‘csum_replace_by_diff’ was here
static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
^~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5131:1: error: redefinition of ‘pci_request_io_regions’
pci_request_io_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1425:1: note: previous definition of ‘pci_request_io_regions’ was here
pci_request_io_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5138:1: error: redefinition of ‘pci_release_io_regions’
pci_release_io_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1432:1: note: previous definition of ‘pci_release_io_regions’ was here
pci_release_io_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5145:1: error: redefinition of ‘pci_request_mem_regions’
pci_request_mem_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1439:1: note: previous definition of ‘pci_request_mem_regions’ was here
pci_request_mem_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5152:1: error: redefinition of ‘pci_release_mem_regions’
pci_release_mem_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1446:1: note: previous definition of ‘pci_release_mem_regions’ was here
pci_release_mem_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:103:6: error: nested redefinition of ‘enum udp_parsable_tunnel_type’
enum udp_parsable_tunnel_type {
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:103:6: error: redeclaration of ‘enum udp_parsable_tunnel_type’
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5120:6: note: originally defined here
enum udp_parsable_tunnel_type {
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:104:2: error: redeclaration of enumerator ‘UDP_TUNNEL_TYPE_VXLAN’
UDP_TUNNEL_TYPE_VXLAN, /* RFC 7348 */
^~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5121:2: note: previous definition of ‘UDP_TUNNEL_TYPE_VXLAN’ was here
UDP_TUNNEL_TYPE_VXLAN,
^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:105:2: error: redeclaration of enumerator ‘UDP_TUNNEL_TYPE_GENEVE’
UDP_TUNNEL_TYPE_GENEVE, /* draft-ietf-nvo3-geneve */
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5122:2: note: previous definition of ‘UDP_TUNNEL_TYPE_GENEVE’ was here
UDP_TUNNEL_TYPE_GENEVE,
^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:109:8: error: redefinition of ‘struct udp_tunnel_info’
struct udp_tunnel_info {
^~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/sock.h:51:0,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/tcp.h:23,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/tcp.h:24,
from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:27,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/netdevice.h:67:8: note: originally defined here
struct udp_tunnel_info;
^~~~~~~~~~~~~~~
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: In function ‘i40e_tx_timeout’:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:281:42: error: ‘struct net_device’ has no member named ‘trans_start’; did you mean ‘mem_start’?
trans_start = q->trans_start ? : netdev->trans_start;
^~
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: In function ‘i40e_ndo_bridge_getlink’:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:9442:9: error: too few arguments to function ‘ndo_dflt_bridge_getlink’
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode,
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/dst.h:13:0,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/sock.h:72,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/tcp.h:23,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/tcp.h:24,
from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:27,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/rtnetlink.h:115:12: note: declared here
extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
^~~~~~~~~~~~~~~~~~~~~~~
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: At top level:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:9494:2: error: unknown field ‘ndo_set_vf_vlan’ specified in initializer
.ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan,
^
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: In function ‘i40e_ndo_bridge_getlink’:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:9451:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/scripts/Makefile.build:341: recipe for target '/home/fla/Desktop/i40e-1.5.23/src/i40e_main.o' failed
make[3]: *** [/home/fla/Desktop/i40e-1.5.23/src/i40e_main.o] Error 1
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/Makefile:1305: recipe for target '_module_/home/fla/Desktop/i40e-1.5.23/src' failed
make[2]: *** [_module_/home/fla/Desktop/i40e-1.5.23/src] Error 2
Makefile:140: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/usr/src/kernels/3.10.0-693.21.1.el7.x86_64'
Makefile:96: recipe for target 'default' failed
make: *** [default] Error 2
It looks like the error is comming from kcompat.h.
I can't find any information on how to solve this problem elsewhere so that's why I created this post.
Any help is appreciated.

error: expected nested-name-specifier when compile breakpad android sample app

When I try to compile android sample app of breakpad, I got this error and have no idea how to resolve it. I'm using Mac OSX 10.11 and android ndk r10e. Many Thanks in advance.
jni/../../google_breakpad/../../src/client/linux/log/log.cc:47:7: error: expected nested-name-specifier before 'AndroidLogBufferWriteFunc'
using AndroidLogBufferWriteFunc = int (*)(int bufID, int prio, const char *tag,
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc:53:1: error: 'AndroidLogBufferWriteFunc' does not name a type
AndroidLogBufferWriteFunc g_android_log_buf_write = nullptr;
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc: In function 'void logger::initializeCrashLogWriter()':
jni/../../google_breakpad/../../src/client/linux/log/log.cc:60:3: error: 'g_android_log_buf_write' was not declared in this scope
g_android_log_buf_write = reinterpret_cast<AndroidLogBufferWriteFunc>(
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc:60:46: error: 'AndroidLogBufferWriteFunc' does not name a type
g_android_log_buf_write = reinterpret_cast<AndroidLogBufferWriteFunc>(
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc: In function 'int logger::writeToCrashLog(const char*)':
jni/../../google_breakpad/../../src/client/linux/log/log.cc:68:7: error: 'g_android_log_buf_write' was not declared in this scope
if (g_android_log_buf_write) {

errors when trying to build in cygwin

Considering none of the code is my own, I feel helpless. It's an open source tool, and I can't use it.
This is the tool : http://www.gnucap.org/devel/gnucap-2013-04-23.tar.gz
And these are the errors I get when building on Cygwin (Win 7, 64b) :
$ ./configure
Configuring gnucap using --prefix=/usr/local
include
lib
In file included from /usr/include/readline/readline.h:35:0,
from test_readline.cc:2:
/usr/include/readline/rltypedefs.h:64:28: error: typedef ‘rl_getc_func_t’ is initialized (use decltype instead)
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/rltypedefs.h:64:28: error: ‘FILE’ was not declared in this scope
/usr/include/readline/rltypedefs.h:64:28: error: expected primary-expression before ‘)’ token
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: ‘FILE’ was not declared in this scope
extern int rl_getc PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: expected primary-expression before ‘)’ token
extern int rl_getc PARAMS((FILE *));
^
In file included from test_readline.cc:2:0:
/usr/include/readline/readline.h:542:8: error: ‘FILE’ does not name a type
extern FILE *rl_instream;
^
/usr/include/readline/readline.h:543:8: error: ‘FILE’ does not name a type
extern FILE *rl_outstream;
^
/usr/include/readline/readline.h:565:8: error: ‘rl_getc_func_t’ does not name a type
extern rl_getc_func_t *rl_getc_function;
^
/usr/include/readline/readline.h:867:3: error: ‘FILE’ does not name a type
FILE *inf;
^
/usr/include/readline/readline.h:868:3: error: ‘FILE’ does not name a type
FILE *outf;
^
either libtermcap or libreadline is missing - not using readline
modelgen
main
apps
In file included from /usr/include/readline/readline.h:35:0,
from test_readline.cc:2:
/usr/include/readline/rltypedefs.h:64:28: error: typedef ‘rl_getc_func_t’ is initialized (use decltype instead)
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/rltypedefs.h:64:28: error: ‘FILE’ was not declared in this scope
/usr/include/readline/rltypedefs.h:64:28: error: expected primary-expression before ‘)’ token
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: ‘FILE’ was not declared in this scope
extern int rl_getc PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: expected primary-expression before ‘)’ token
extern int rl_getc PARAMS((FILE *));
^
In file included from test_readline.cc:2:0:
/usr/include/readline/readline.h:542:8: error: ‘FILE’ does not name a type
extern FILE *rl_instream;
^
/usr/include/readline/readline.h:543:8: error: ‘FILE’ does not name a type
extern FILE *rl_outstream;
^
/usr/include/readline/readline.h:565:8: error: ‘rl_getc_func_t’ does not name a type
extern rl_getc_func_t *rl_getc_function;
^
/usr/include/readline/readline.h:867:3: error: ‘FILE’ does not name a type
FILE *inf;
^
/usr/include/readline/readline.h:868:3: error: ‘FILE’ does not name a type
FILE *outf;
^
either libtermcap or libreadline is missing - not using readline
done
Any help will be great. I feel helpless. If you can suggest resources so I can learn to fix such errors on my own, that would be teaching me how to fish..
You have to include stdio.h in lib/test_readline.cc to define FILE.

Resources