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

How to Compile A Program ? #20

Closed
IBNU1 opened this issue Apr 12, 2024 · 5 comments
Closed

How to Compile A Program ? #20

IBNU1 opened this issue Apr 12, 2024 · 5 comments
Assignees

Comments

@IBNU1
Copy link

IBNU1 commented Apr 12, 2024

Hi,
I'm trying to compile a program using your interface by running the GCC compiler on it and I keep getting this list of errors that i'm not really sure how to solve. What instructions and options do I need to configure with my compiler in order to get software properly with this frame work ?

test_cynq.cpp:(.text+0x28): undefined reference to `std::allocator<char>::allocator()'
/usr/bin/ld: test_cynq.cpp:(.text+0x5c): undefined reference to `cynq::IHardware::Create(cynq::HardwareArchitecture, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: test_cynq.cpp:(.text+0x64): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/bin/ld: test_cynq.cpp:(.text+0x6c): undefined reference to `std::allocator<char>::~allocator()'
/usr/bin/ld: test_cynq.cpp:(.text+0x110): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/bin/ld: test_cynq.cpp:(.text+0x120): undefined reference to `std::allocator<char>::~allocator()'
/usr/bin/ld: /tmp/cc3ZiyKX.o: in function `__static_initialization_and_destruction_0(int, int)':
test_cynq.cpp:(.text+0x198): undefined reference to `std::ios_base::Init::Init()'
/usr/bin/ld: test_cynq.cpp:(.text+0x1ac): undefined reference to `std::ios_base::Init::~Init()'
/usr/bin/ld: test_cynq.cpp:(.text+0x1b0): undefined reference to `std::ios_base::Init::~Init()'
/usr/bin/ld: /tmp/cc3ZiyKX.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::~_Alloc_hider()':
test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderD2Ev[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderD5Ev]+0x10): undefined reference to `std::allocator<char>::~allocator()'
/usr/bin/ld: /tmp/cc3ZiyKX.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(char const*, std::allocator<char> const&)':
test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_]+0x34): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_local_data()'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_]+0x44): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::_Alloc_hider(char*, std::allocator<char> const&)'
/usr/bin/ld: /tmp/cc3ZiyKX.o: in function `void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag)':
test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0x70): undefined reference to `std::__throw_logic_error(char const*)'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0xa0): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0xac): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data(char*)'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0xbc): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_capacity(unsigned long)'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0xc4): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0xd0): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars(char*, char const*, char const*)'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0xe0): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_set_length(unsigned long)'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0x108): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0x110): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0x114): undefined reference to `__cxa_rethrow'
/usr/bin/ld: test_cynq.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag]+0x11c): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /tmp/cc3ZiyKX.o:(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
@lleon95 lleon95 self-assigned this Apr 12, 2024
@lleon95
Copy link
Collaborator

lleon95 commented Apr 12, 2024

Hi @IBNU1

Can you share the steps you have followed to reproduce the issue?

Cheers,
Leon

@IBNU1
Copy link
Author

IBNU1 commented Apr 12, 2024

Sure @lleon95 , I followed the standard installation instructions and ran the example program from the buildir which ran fan. Then in a seperate directory under root I typed up this code to use my own IP. All of this was being done on a Kria Kv260 board.


`#include <cynq/cynq.hpp>
#include <cstdint>
#include <cynq/accelerator.hpp>
#include <cynq/datamover.hpp>
#include <cynq/hardware.hpp>
#include <cynq/memory.hpp>
#include <iostream>
#include <memory>
#include <string>


// Configure the FPGA
int main(){
using namespace cynq;
auto kArch = HardwareArchitecture::UltraScale;
auto platform = IHardware::Create(kArch, "euler_test.bit");
int x1 = 1;
int y1 = 2;
int x2 = 4;
int y2 = 5;
// Extract the accelerator (IP Core) and DMA
// Addresses are given by the design
const uint64_t accel_addr = 0xb0000000; //get this value from the the Vivado program
auto accel = platform->GetAccelerator(accel_addr);
int test_output = 0;
printf("The Value of the output data is %d",test_output);
return 0;
}
`

I then tried to compile this code by entering GCC test.cpp and it returned me the above error.

@lleon95
Copy link
Collaborator

lleon95 commented Apr 12, 2024

Alright,

Are you compiling it using?

g++ -o test test.cpp `pkg-config --cflags --libs cynq`

the pkg-config --cflags --libs cynq captures all the flags required for linking. It usually adds: -lcynq

@IBNU1
Copy link
Author

IBNU1 commented Apr 12, 2024

Thanks so much, got it working.

@lleon95
Copy link
Collaborator

lleon95 commented Apr 12, 2024

Perfect :) Glad it worked.

@lleon95 lleon95 closed this as completed Apr 12, 2024
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

2 participants