AlexeyAB / darknet

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

fatal error LNK1120: 57 unresolved externals #1906

Open tholmber opened 5 years ago

tholmber commented 5 years ago

I get this kind of errors when i'm truing to build darknet in Win10, OpenCV 3.3 and CUDA9.1. I managed to build project darknet_no_gpu but the training is very slow (it takes 10 min to do one iteration). I have included same folders in project of darknet Linker and C++ properties than in darknet_no_gpu. If extra information about problem is needed, I'm ready to reply to incoming message. Thanks in advance

1>activation_layer.obj : error LNK2001: unresolved external symbol copy_ongpu 1>activation_layer.obj : error LNK2001: unresolved external symbol activate_array_ongpu 1>activation_layer.obj : error LNK2001: unresolved external symbol gradient_array_ongpu 1>avgpool_layer.obj : error LNK2001: unresolved external symbol forward_avgpool_layer_gpu 1>avgpool_layer.obj : error LNK2001: unresolved external symbol backward_avgpool_layer_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol fast_mean_delta_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol add_bias_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol normalize_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol backward_scale_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol scal_ongpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol scale_bias_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol backward_bias_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol fast_mean_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol axpy_ongpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol normalize_delta_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol fast_variance_gpu 1>batchnorm_layer.obj : error LNK2001: unresolved external symbol fast_variance_delta_gpu 1>classifier.obj : error LNK2001: unresolved external symbol sync_nets 1>classifier.obj : error LNK2001: unresolved external symbol train_networks 1>connected_layer.obj : error LNK2001: unresolved external symbol fill_ongpu 1>connected_layer.obj : error LNK2001: unresolved external symbol constrain_ongpu 1>convolutional_layer.obj : error LNK2001: unresolved external symbol forward_convolutional_layer_gpu 1>convolutional_layer.obj : error LNK2001: unresolved external symbol update_convolutional_layer_gpu 1>convolutional_layer.obj : error LNK2001: unresolved external symbol backward_convolutional_layer_gpu 1>cost_layer.obj : error LNK2001: unresolved external symbol l2_gpu 1>cost_layer.obj : error LNK2001: unresolved external symbol mask_ongpu 1>cost_layer.obj : error LNK2001: unresolved external symbol supp_ongpu 1>cost_layer.obj : error LNK2001: unresolved external symbol smooth_l1_gpu 1>crnn_layer.obj : error LNK2001: unresolved external symbol push_convolutional_layer 1>crnn_layer.obj : error LNK2001: unresolved external symbol pull_convolutional_layer 1>crop_layer.obj : error LNK2001: unresolved external symbol forward_crop_layer_gpu 1>dropout_layer.obj : error LNK2001: unresolved external symbol forward_dropout_layer_gpu 1>dropout_layer.obj : error LNK2001: unresolved external symbol backward_dropout_layer_gpu 1>gru_layer.obj : error LNK2001: unresolved external symbol weighted_sum_gpu 1>gru_layer.obj : error LNK2001: unresolved external symbol weighted_delta_gpu 1>gru_layer.obj : error LNK2001: unresolved external symbol mul_ongpu 1>gru_layer.obj : error LNK2001: unresolved external symbol mult_add_into_gpu 1>local_layer.obj : error LNK2001: unresolved external symbol im2col_ongpu 1>local_layer.obj : error LNK2001: unresolved external symbol col2im_ongpu 1>maxpool_layer.obj : error LNK2001: unresolved external symbol backward_maxpool_layer_gpu 1>maxpool_layer.obj : error LNK2001: unresolved external symbol forward_maxpool_layer_gpu 1>network.obj : error LNK2001: unresolved external symbol get_network_output_gpu 1>network.obj : error LNK2001: unresolved external symbol train_network_datum_gpu 1>network.obj : error LNK2001: unresolved external symbol network_predict_gpu 1>nightmare.obj : error LNK2001: unresolved external symbol backward_network_gpu 1>nightmare.obj : error LNK2001: unresolved external symbol forward_network_gpu 1>normalization_layer.obj : error LNK2001: unresolved external symbol const_ongpu 1>normalization_layer.obj : error LNK2001: unresolved external symbol pow_ongpu 1>region_layer.obj : error LNK2001: unresolved external symbol flatten_ongpu 1>region_layer.obj : error LNK2001: unresolved external symbol softmax_gpu 1>reorg_layer.obj : error LNK2001: unresolved external symbol reorg_ongpu 1>shortcut_layer.obj : error LNK2001: unresolved external symbol shortcut_gpu 1>softmax_layer.obj : error LNK2001: unresolved external symbol mask_gpu_new_api 1>softmax_layer.obj : error LNK2001: unresolved external symbol softmax_tree_gpu 1>softmax_layer.obj : error LNK2001: unresolved external symbol softmax_gpu_new_api 1>softmax_layer.obj : error LNK2001: unresolved external symbol softmax_x_ent_gpu 1>upsample_layer.obj : error LNK2001: unresolved external symbol upsample_gpu 1>E:\worm_eggs\worm_eggs\yolo\darknet\build\darknet\x64\darknet.exe : fatal error LNK1120: 57 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

ixtiyoruz commented 5 years ago

did you find the solution ?

ixtiyoruz commented 5 years ago

I have also the same problem: 1>------ Build started: Project: darknet, Configuration: Release x64 ------ 1>Compiling CUDA source file ....\src\activation_kernels.cu... 1>Compiling CUDA source file ....\src\blas_kernels.cu... 1>Compiling CUDA source file ....\src\crop_layer_kernels.cu... ......... 1>....\src\http_stream.cpp(253): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(291): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data 1>....\src\http_stream.cpp(369): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(403): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(414): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(415): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(416): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data 1>....\src\http_stream.cpp(416): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(428): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(429): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data 1>....\src\http_stream.cpp(429): warning C4244: 'argument': conversion from 'SOCKET' to 'int', possible loss of data 1>....\src\http_stream.cpp(517): warning C4244: '=': conversion from 'double' to 'int', possible loss of data 1>....\src\http_stream.cpp(643): warning C4244: 'return': conversion from 'int64' to 'double', possible loss of data 1>maxpool_layer_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPushCallConfiguration 1>convolutional_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPushCallConfiguration 1>crop_layer_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPushCallConfiguration 1>dropout_layer_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPushCallConfiguration 1>im2col_kernels.cu.obj : error LNK2001: unresolved external symbol __cudaPushCallConfiguration 1>activation_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPushCallConfiguration 1>avgpool_layer_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPushCallConfiguration 1>blas_kernels.cu.obj : error LNK2001: unresolved external symbol __cudaPushCallConfiguration 1>col2im_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPushCallConfiguration 1>maxpool_layer_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPopCallConfiguration 1>convolutional_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPopCallConfiguration 1>crop_layer_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPopCallConfiguration 1>dropout_layer_kernels.cu.obj : error LNK2001: unresolved external symbol __cudaPopCallConfiguration 1>im2col_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPopCallConfiguration 1>activation_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPopCallConfiguration 1>avgpool_layer_kernels.cu.obj : error LNK2001: unresolved external symbol cudaPopCallConfiguration 1>blas_kernels.cu.obj : error LNK2001: unresolved external symbol __cudaPopCallConfiguration 1>col2im_kernels.cu.obj : error LNK2001: unresolved external symbol __cudaPopCallConfiguration 1>C:\Users\ASUS\object detector\darknet\darknet\build\darknet\x64\darknet.exe : fatal error LNK1120: 2 unresolved externals 1>Done building project "darknet.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

image

EggAgainstStone commented 5 years ago

你们找到问题的原因了吗? 我也碰到了这个问题.

PNeigel commented 4 years ago

I have the same problem. I found out that the functions it cannot link are defined in the .cu cuda sources, so apparently Visual Studio doesn't compile them correctly.

PNeigel commented 4 years ago

I found the solution. As I said in my previous post, Visual Studio is not compiling the .cu Cuda source files. The steps I took to make it work:

  1. Downloaded the Cuda Toolkit v.10 installer
  2. Run the installer. The important box to tick is the Cuda Visual Studio integration. (You probably have Cuda v.10 already installed, so you can untick the boxes corresponding to the headers, binaries etc.)
  3. (Don't know if this step is necessary) Copy all the files in your\path\to\NVIDIA GPU Computing Toolkit\CUDA\v10.0\extras\visual_studio_integration\MSBuildExtensions into C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\BuildCustomizations (change path to your Visual Studio installation accordingly)

Now Cuda is integrated into visual studio. If you make a new project, you can select NVidia Runtime project as a template. But in our already existing solution for darknet it doesn't recognize cuda files yet.

  1. In our darknet solution, right click the project dark and under build dependencies -> build customizations select CUDA 10 instruc1 instruc2
  2. The last thing you need to do is select all the .cu files in the project and under right click properties set the item type to CUDA C/C++ instruc3

Now the project dark should compile. Do the same steps for darknet and the solution should build.

(I also had to manually set the include directories of CUDA and link the according .lib files manually, but I don't think it has anything to do with this problem)