Xilinx / Vitis-AI

Vitis AI is Xilinx’s development stack for AI inference on Xilinx hardware platforms, including both edge devices and Alveo cards.
https://www.xilinx.com/ai
Apache License 2.0
1.49k stars 630 forks source link

Undefined Reference to Symbol #1451

Closed MiyuruThathsara closed 3 months ago

MiyuruThathsara commented 3 months ago

I'm trying to run super point model with Vitis-AI in the ZCU102 board. However, I'm getting the following error when try to cross-compile it using the build.sh script. I'm using Ubuntu 20.04 and Vitis-AI 3.0.

I think this error happens due to a linking issue. Any help would be highly appreciated

`(vitis-ai-tensorflow) vitis-ai-user@docker-desktop:/workspace/examples/vai_library/samples/dpu_task/superpoint$ ./build.sh

mkdir -p ./build

g++ -I=/install/Release/include -I=/usr/include/vitis/ai -std=c++17 -O3 -Wall -I/usr/include/opencv4/opencv -I/usr/include/opencv4 -c -o build/demo_superpoint.o -I. demo_superpoint.cpp

g++ -I=/install/Release/include -I=/usr/include/vitis/ai -std=c++17 -O3 -Wall -I/usr/include/opencv4/opencv -I/usr/include/opencv4 -c -o build/superpoint.o -I. superpoint.cpp

g++ -std=c++17 -I=/install/Release/include -I=/usr/include/vitis/ai -std=c++17 -O3 -Wall -I/usr/include/opencv4/opencv -I/usr/include/opencv4 -I. -o demo_superpoint build/demo_superpoint.o build/superpoint.o -L=/install/Release/lib -L/opt/petalinux/2021.1/sysroots/cortexa72-cortexa53-xilinx-linux/install/Release/lib/ -lglog -lprotobuf -lvitis_ai_library-math -lvitis_ai_library-dpu_task -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_quality -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core -pthread

/usr/bin/ld: build/superpoint.o: undefined reference to symbol '_ZN5vitis2ai11my_getenv_sEPKcRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE' /usr/bin/ld: /usr/lib/libvart-util.so.3: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [Makefile:48: demo_superpoint] Error 1`

MiyuruThathsara commented 3 months ago

I was able to solve this issue by changing the Makefile

Add the following compiler flag to the Makefile

LD_FLAGS += -lvart-util

Further, this issue exists for HFNet too. That Makefile should also do this change to resolve this problem.