Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g++ error, several undefined reference to `xrt:: #326

Closed
EnzoRafinesque opened this issue Nov 25, 2022 · 1 comment
Closed

g++ error, several undefined reference to `xrt:: #326

EnzoRafinesque opened this issue Nov 25, 2022 · 1 comment

Comments

@EnzoRafinesque
Copy link

Hi,
I'm trying to follow the Vitis Getting Started tutorial and I encounter an issue in the part 4 : Build and Run the Data Center application,

I'm working on Ubuntu 20.04 and I've installed xrt for Vitis 2022.1 / Alveo U200 board following this : https://www.xilinx.com/products/boards-and-kits/alveo/u200.html#gettingStarted

The issue is on the command : g++ -Wall -g -std=c++17 ../../src/host.cpp -o app.exe -I${XILINX_XRT}/include/ -L${XILINX_XRT}/lib/ -lOpenCL -lpthread -lrt -lstdc++

and it return the following error :

/usr/bin/ld: /tmp/ccjTQG0I.o: in function main': /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:43: undefined reference to xrt::device::load_xclbin(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
/usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:48: undefined reference to xrt::kernel::kernel(xrt::device const&, xrt::uuid const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, xrt::kernel::cu_access_mode)' /usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:51: undefined reference to xrt::kernel::group_id(int) const'
/usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:51: undefined reference to xrt::device::operator void*() const' /usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:52: undefined reference to xrt::kernel::group_id(int) const'
/usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:52: undefined reference to xrt::device::operator void*() const' /usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:53: undefined reference to xrt::kernel::group_id(int) const'
/usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:53: undefined reference to xrt::device::operator void*() const' /usr/bin/ld: /home/enzo/Desktop/workspace/Vitis-Tutorials/Getting_Started/Vitis/example/u200/sw_emu/../../src/host.cpp:78: undefined reference to xrt::run::wait(std::chrono::duration<long, std::ratio<1l, 1000l> > const&) const'
/usr/bin/ld: /tmp/ccjTQG0I.o: in function xrt::bo::bo(void*, unsigned long, unsigned int)': /opt/xilinx/xrt/include/xrt/xrt_bo.h:187: undefined reference to xrt::bo::bo(void*, unsigned long, xrt::bo::flags, unsigned int)'
/usr/bin/ld: /tmp/ccjTQG0I.o: in function xrt::bo::sync(xclBOSyncDirection)': /opt/xilinx/xrt/include/xrt/xrt_bo.h:393: undefined reference to xrt::bo::size() const'
/usr/bin/ld: /opt/xilinx/xrt/include/xrt/xrt_bo.h:393: undefined reference to xrt::bo::sync(xclBOSyncDirection, unsigned long, unsigned long)' /usr/bin/ld: /tmp/ccjTQG0I.o: in function xrt::device::device(int)':
/opt/xilinx/xrt/include/xrt/xrt_device.h:205: undefined reference to xrt::device::device(unsigned int)' /usr/bin/ld: /tmp/ccjTQG0I.o: in function xrt::run::set_arg(int, xrt::bo&)':
/opt/xilinx/xrt/include/xrt/xrt_kernel.h:361: undefined reference to xrt::run::set_arg_at_index(int, xrt::bo const&)' /usr/bin/ld: /tmp/ccjTQG0I.o: in function int* xrt::bo::map<int*>()':
/opt/xilinx/xrt/include/xrt/xrt_bo.h:420: undefined reference to xrt::bo::map()' /usr/bin/ld: /tmp/ccjTQG0I.o: in function xrt::run xrt::kernel::operator()<xrt::bo&, xrt::bo&, xrt::bo&, int>(xrt::bo&, xrt::bo&, xrt::bo&, int&&)':
/opt/xilinx/xrt/include/xrt/xrt_kernel.h:633: undefined reference to xrt::run::run(xrt::kernel const&)' /usr/bin/ld: /tmp/ccjTQG0I.o: in function void xrt::run::operator()<xrt::bo&, xrt::bo&, xrt::bo&, int>(xrt::bo&, xrt::bo&, xrt::bo&, int&&)':
/opt/xilinx/xrt/include/xrt/xrt_kernel.h:455: undefined reference to xrt::run::start()' /usr/bin/ld: /tmp/ccjTQG0I.o: in function void xrt::run::set_arg(int, int&&)':
/opt/xilinx/xrt/include/xrt/xrt_kernel.h:341: undefined reference to `xrt::run::set_arg_at_index(int, void const*, unsigned long)'
collect2: error: ld returned 1 exit status

I've searched on issues and other forums but I didn't found anything about that issue, if someone have an idea that will be helpful, thank you.

Best Regards,

Enzo.

@EnzoRafinesque
Copy link
Author

EnzoRafinesque commented Nov 29, 2022

From 2020.2 release XRT provides a new XRT API set in C, C++, and Python flavor.

To use the native XRT APIs, the host application must link with the xrt_coreutil library. Compiling host code with XRT native C++ API requires C++ standard with -std=c++17 (or newer).

add -lxrt_coreutil in the command to fix :

g++ -Wall -g -std=c++17 ../../src/host.cpp -o app.exe -I${XILINX_XRT}/include/ -L${XILINX_XRT}/lib/ -lOpenCL -lpthread -lrt -lstdc++ -lxrt_coreutil

CRTejaswi pushed a commit to CRTejaswi/amd-vitis that referenced this issue Oct 3, 2023
a6d968d Merge pull request Xilinx#333 from yunleiz/next
51577ce keep on refining README.md index.rst release.rst
fdd127d refined pwm_gen.rst svpwm_duty.rst index.rst release.rst tutorial.rst README.md
e924359 [doc] fixed typos
c442eeb [doc] fixed typos
bc12d74 Merge pull request Xilinx#332 from yunleiz/next
7ffdf66 [doc] Fix typos
d6df03a Merge pull request Xilinx#331 from yunleiz/next
dfa95f5 [doc] refine doc
7f5d0ce Merge branch 'next' of https://gitenterprise.xilinx.com/FaaSApps/xf_motorcontrol into next
0443aca refined README.md index.rst release.rst tutorial.rst
2bcaaac Merge branch 'next' of gitenterprise.xilinx.com:FaaSApps/xf_motorcontrol into next
b086140 [doc] refine doc
8dd5ca6 Merge pull request Xilinx#330 from yipengz/ffnext_update_docs
dd6ac51 cousumer_to_consumer
e9c89c6 update_table_svpwm
c488c25 Merge branch 'next' of https://gitenterprise.xilinx.com/FaaSApps/xf_motorcontrol into ffnext_update_docs
24ab9c2 re-org_svpwm_docs
8779702 Merge pull request Xilinx#329 from yunleiz/next
4206f4a [doc] refine readme
5d511f7 Merge pull request Xilinx#328 from yunleiz/next
636cbda [doc] remove all 'graph'
6448b6f Merge branch 'next' of https://gitenterprise.xilinx.com/FaaSApps/xf_motorcontrol into ffnext_proofread
61edba1 renew_svpwm_docs_except_tutorial
a875af7 Merge pull request Xilinx#327 from congt/next
afa2d61 Merge pull request Xilinx#326 from yipengz/ffnext_proofread
691567f [tutorial]fix errors
b2b6e66 renew_benchmark_data
b740131 proofread_impl_resources

Co-authored-by: sdausr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant