AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.58k stars 7.95k forks source link

yolo_console_dll.obj : error LNK2019 - vcpkg Windows installation #6501

Open milton-logothetis opened 3 years ago

milton-logothetis commented 3 years ago

I am trying to build darknet on Windows using the new instructions for vcpkg, however when I am building the executable I get the following error:

yolo_console_dll.obj : error LNK2019: unresolved external symbol send_json_custom referenced in function "public: bool
__cdecl.....

Copy-Item : Could not find a part of the path 'D:\Repositories\darknet\darknet\share\darknet\'.
At D:\Repositories\darknet\darknet\build.ps1:205 char:3
+   Copy-Item cmake\Modules\*.cmake share\darknet\
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand

The linking error repeats itself for a number of functions suggesting that the build process cannot locate some symbols. I have tried re-setting my environment variables, re-building vcpkg but it wont be solved. I have searched online but can't find any specific info, only when building through the Visual Studio IDE which seems to be a simple issue to fix. << Please help my time is running out >>

AlexeyAB commented 3 years ago

@cenit Hi, Is there any issue with VCPKG currently?

mwkldeveloper commented 3 years ago

@AlexeyAB Hi After run .\vcpkg install darknet[full]:x64-windows successfully , it take around 5 hours I face the same problem when run.\build.ps1 :

yolo_console_dll.obj : error LNK2019: unresolved external symbol send_json_custom referenced in function "public: bool
__cdecl..... 

Which vcpkg release are you suggest for build darknet. image

Rutvik21 commented 3 years ago

@AlexeyAB I am getting the same error while running ./build.ps1. Please help anyone, how to fix that error. Here is that list of error I am getting:

yolo_console_dll.obj : error LNK2019: unresolved external symbol send_json_custom referenced in funct ion "public: bool cdecl Detector::send_json_http(class std::vector<struct bbox_t,class std::allocat or >,class std::vector<class std::basic_string<char,struct std::char_traits,clas s std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits<ch ar>,class std::allocator > > >,int,class std::basic_string<char,struct std::char_traits,c lass std::allocator >,int,int)" (?send_json_http@Detector@@QEAA_NV?$vector@Ubbox_t@@V?$allocato r@Ubbox_t@@@std@@@std@@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$all ocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@3@HV?$basicstring@DU?$char traits@D@std@@V?$allocator@D@2@@3@HH@Z) [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_re lease\uselib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: cdecl Detector::Detector( class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::ba sic_string<char,struct std::char_traits,class std::allocator >,int)" (??0Detector@@QEAA@V ?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0H@Z) referenced in function main [F:\Co mputer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\uselib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: cdecl Detector::~Detector (void)" (??1Detector@@QEAA@XZ) referenced in function main [F:\Computer_Vision\Yolov4_Ear_Detection\d arknet\build_win_release\uselib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: class std::vector<struct bb ox_t,class std::allocator > __cdecl Detector::detect(struct image_t,float,bool)" (?det ect@Detector@@QEAA?AV?$vector@Ubbox_t@@V?$allocator@Ubbox_t@@@std@@@std@@Uimage_t@@M_N@Z) referenced in function "public: void cdecl ::operator()(void)const " (??R@@QEBAXXZ) [F:\Computer_Vision\Yolov4_Ear_Detection\dark net\build_win_release\uselib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: static void cdecl Detecto r::free_image(struct image_t)" (?free_image@Detector@@SAXUimage_t@@@Z) referenced in function "public : void cdecl ::operator()(struct image_t )const " (??R<la mbda_2e9fc37c78f127f2606664cac01bc482>@@QEBAXPEAUimage_t@@@Z) [F:\Computer_Vision\Yolov4_Ear_Detectio n\darknet\build_win_release\uselib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: int cdecl Detector::get_n et_width(void)const " (?get_net_width@Detector@@QEBAHXZ) referenced in function "public: class std::s hared_ptr cdecl Detector::mat_to_image_resize(class cv::Mat)const " (?mat_toimage resize@Detector@@QEBA?AV?$shared_ptr@Uimage_t@@@std@@VMat@cv@@@Z) [F:\Computer_Vision\Yolov4_Ear_Dete ction\darknet\build_win_release\uselib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: int cdecl Detector::get_n et_height(void)const " (?get_net_height@Detector@@QEBAHXZ) referenced in function "public: class std: :shared_ptr cdecl Detector::mat_to_image_resize(class cv::Mat)const " (?mat_to_imag e_resize@Detector@@QEBA?AV?$shared_ptr@Uimage_t@@@std@@VMat@cv@@@Z) [F:\Computer_Vision\Yolov4_Ear_De tection\darknet\build_win_release\uselib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: class std::vector<struct bb ox_t,class std::allocator > cdecl Detector::tracking_id(class std::vector<struct bbo x_t,class std::allocator >,bool,int,int)" (?tracking_id@Detector@@QEAA?AV?$vector@Ubbo x_t@@V?$allocator@Ubbox_t@@@std@@@std@@V23@_NHH@Z) referenced in function "public: void __cdecl <lamb da_ec00cba381fb570bb1b420e2b4c90901>::operator()(void)const " (??R<lambda_ec00cba381fb570bb1b420e2b4c 90901>@@QEBAXXZ) [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\uselib.vcxproj] F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\Release\uselib.exe : fatal error LN K1120: 8 unresolved externals [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\usel ib.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol send_json_custom referenced in funct ion "public: bool cdecl Detector::send_json_http(class std::vector<struct bbox_t,class std::allocat or >,class std::vector<class std::basic_string<char,struct std::char_traits,clas s std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits<ch ar>,class std::allocator > > >,int,class std::basic_string<char,struct std::char_traits,c lass std::allocator >,int,int)" (?send_json_http@Detector@@QEAA_NV?$vector@Ubbox_t@@V?$allocato r@Ubbox_t@@@std@@@std@@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$all ocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@3@HV?$basicstring@DU?$char traits@D@std@@V?$allocator@D@2@@3@HH@Z) [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_re lease\uselib_track.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: cdecl Detector::Detector( class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::ba sic_string<char,struct std::char_traits,class std::allocator >,int)" (??0Detector@@QEAA@V ?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0H@Z) referenced in function main [F:\Co mputer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\uselib_track.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: cdecl Detector::~Detector (void)" (??1Detector@@QEAA@XZ) referenced in function main [F:\Computer_Vision\Yolov4_Ear_Detection\d arknet\build_win_release\uselib_track.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: class std::vector<struct bb ox_t,class std::allocator > __cdecl Detector::detect(struct image_t,float,bool)" (?det ect@Detector@@QEAA?AV?$vector@Ubbox_t@@V?$allocator@Ubbox_t@@@std@@@std@@Uimage_t@@M_N@Z) referenced in function "public: void cdecl ::operator()(void)const " (??R@@QEBAXXZ) [F:\Computer_Vision\Yolov4_Ear_Detection\dark net\build_win_release\uselib_track.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: static void cdecl Detecto r::free_image(struct image_t)" (?free_image@Detector@@SAXUimage_t@@@Z) referenced in function "public : void __cdecl ::operator()(struct image_t )const " (??R<la mbda_2e9fc37c78f127f2606664cac01bc482>@@QEBAXPEAUimage_t@@@Z) [F:\Computer_Vision\Yolov4_Ear_Detectio n\darknet\build_win_release\uselib_track.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: int cdecl Detector::get_n et_width(void)const " (?get_net_width@Detector@@QEBAHXZ) referenced in function "public: class std::s hared_ptr cdecl Detector::mat_to_image_resize(class cv::Mat)const " (?mat_toimage resize@Detector@@QEBA?AV?$shared_ptr@Uimage_t@@@std@@VMat@cv@@@Z) [F:\Computer_Vision\Yolov4_Ear_Dete ction\darknet\build_win_release\uselib_track.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: int cdecl Detector::get_n et_height(void)const " (?get_net_height@Detector@@QEBAHXZ) referenced in function "public: class std: :shared_ptr cdecl Detector::mat_to_image_resize(class cv::Mat)const " (?mat_to_imag e_resize@Detector@@QEBA?AV?$shared_ptr@Uimage_t@@@std@@VMat@cv@@@Z) [F:\Computer_Vision\Yolov4_Ear_De tection\darknet\build_win_release\uselib_track.vcxproj] yolo_console_dll.obj : error LNK2019: unresolved external symbol "public: class std::vector<struct bb ox_t,class std::allocator > __cdecl Detector::tracking_id(class std::vector<struct bbo x_t,class std::allocator >,bool,int,int)" (?tracking_id@Detector@@QEAA?AV?$vector@Ubbo x_t@@V?$allocator@Ubbox_t@@@std@@@std@@V23@_NHH@Z) referenced in function "public: void __cdecl <lamb da_ec00cba381fb570bb1b420e2b4c90901>::operator()(void)const " (??R<lambda_ec00cba381fb570bb1b420e2b4c 90901>@@QEBAXXZ) [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\uselib_track.vcxp roj] F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_release\Release\uselib_track.exe : fatal er ror LNK1120: 8 unresolved externals [F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build_win_releas e\uselib_track.vcxproj] Copy-Item : Could not find a part of the path 'F:\Computer_Vision\Yolov4_Ear_Detection\darknet\share\darknet\'. At F:\Computer_Vision\Yolov4_Ear_Detection\darknet\build.ps1:205 char:3

advanpix commented 3 years ago

There is a quick workaround for this issue here: https://github.com/AlexeyAB/darknet/issues/6679#issuecomment-694640700

The functions are not properly exported from the darknet.dll.

cenit commented 3 years ago

The functions are not properly exported from the darknet.dll.

not true.

Please everybody confirm being running the latest darknet sources. To be honest, I cannot reproduce the error in any build configuration I am trying. Please give as many details as possible about your setup (Win version, VS version, darknet git commit, vcpkg git commit, ...)

mwkldeveloper commented 3 years ago

My pervious fail experience is build under with Window Insider Program Dev Channel (the OS build is 20215 )

After try and error, Finally I successfully build (all the same cmd with guide )and run darknet with GPU with another window 10 computer .

The env are: Window 10 Pro version 2004 OS build 19041.508 cmake-3.18.2 Visual studio 2019 community Version 16.7.3 installed with C++ Redistributable CUDA 10.1 update2 with cudnn v7.6.5.32 darknet eb0272f27acda1982fe4d30acd838fca427785a9 vcpkg 32eccc18191fbb57b159784a1724d2d00613ae82

Total elapsed time: 4.846 h for .\vcpkg install darknet[full]:x64-windows