cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mathmaxsean
Explorer
Explorer
29,199 Views
Registered: ‎05-23-2017

(.text+0x20): undefined reference to `main'

Jump to solution

 I met a issue when compiling the code.

Here is the ouput.

 

$ make all TARGETS=sw_emu DEVICES=xilinx_vcu1525_dynamic_5_1
mkdir -p ./xclbin
/opt/Xilinx/SDx/2018.2.EA2236721/bin/xcpp -I /opt/Xilinx/SDx/2018.2.EA2236721/runtime/include/1_2/ -I//opt/Xilinx/SDx/2018.2.EA2236721/Vivado_HLS/include/ -I.//include/ -O0 -g -Wall -fmessage-length=0 -std=c++14 -fopenmp -DRSA_2048 -I../../..//libs/logger -I../../..//libs/cmdparser -I../../..//libs/xcl -lssl -lcrypto -ldl ../../..//libs/logger/logger.cpp ../../..//libs/cmdparser/cmdlineparser.cpp ../../..//libs/xcl/xcl.c ../../..//libs/xcl2/xcl2.hpp src/common.h src/csv_parser.h src/k_nn.h src/pca_index.h src/pca_svd_index.h src/common.h  -o 'pcaf_host' -lOpenCL -lpthread -lrt -lstdc++ -lflann -lgsl -L/opt/Xilinx/SDx/2018.2.EA2236721/runtime/lib/x86_64 -L.//lib 

../../..//libs/xcl2/xcl2.hpp:31:9: warning: #pragma once in main file
#pragma once
^
In file included from .//include/eigen3/Eigen/Core:276:0,
from .//include/eigen3/Eigen/QR:4,
from .//include/eigen3/Eigen/SVD:4,
from src/pca_svd_index.h:7:
.//include/eigen3/Eigen/src/Core/Functors.h:973:28: warning: \u2018template<class _Operation> class std::binder2nd\u2019 is deprecated [-Wdeprecated-declarations]
struct functor_traits<std::binder2nd<T> >
^
In file included from /usr/include/c++/5/bits/stl_function.h:1128:0,
from /usr/include/c++/5/string:48,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/istream:38,
from /usr/include/c++/5/fstream:38,
from src/common.h:17,
from src/pca_svd_index.h:5:
/usr/include/c++/5/backward/binders.h:143:11: note: declared here
class binder2nd
^
In file included from .//include/eigen3/Eigen/Core:276:0,
from .//include/eigen3/Eigen/QR:4,
from .//include/eigen3/Eigen/SVD:4,
from src/pca_svd_index.h:7:
.//include/eigen3/Eigen/src/Core/Functors.h:977:28: warning: \u2018template<class _Operation> class std::binder1st\u2019 is deprecated [-Wdeprecated-declarations]
struct functor_traits<std::binder1st<T> >
^
In file included from /usr/include/c++/5/bits/stl_function.h:1128:0,
from /usr/include/c++/5/string:48,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/istream:38,
from /usr/include/c++/5/fstream:38,
from src/common.h:17,
from src/pca_svd_index.h:5:
/usr/include/c++/5/backward/binders.h:108:11: note: declared here
class binder1st
^
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
Makefile:79: recipe for target 'pcaf_host' failed
make: *** [pcaf_host] Error 1

 

Please help!

Thanks in advance.

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
mathmaxsean
Explorer
Explorer
29,119 Views
Registered: ‎05-23-2017

I found the isuue was caused by giving a wrong file path to the eigne3 funciton.

 

solved.

 

Thanks 

  

View solution in original post

0 Kudos
3 Replies
hongh
Moderator
Moderator
29,171 Views
Registered: ‎11-04-2010

Hi, @mathmaxsean ,

Could you share your code?

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
mathmaxsean
Explorer
Explorer
29,144 Views
Registered: ‎05-23-2017

HI hongh,

Thanks for you quick reply.

I finally found this issue is caused by the Makefile.

 

Now I met a issue when using g++ and xcpp to compile the same host side code.

 

My issue is when I compile my code with g++ everything goes well. The execution result is also good.
But when I try to compile the same  host side code with xcpp in the sdaccel the compiler complains a lot of warnings. Most of them are about the type of the data is not consistent.
/*****************************************************/
src/pca_index.cpp:147:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < que.rows; ++i){
​/*****************************************************/
I just ignore them.
When I try to run the host side code it shows a error :"Aborted (core dumped)"
/*****************************************************/
./include/eigen3/Eigen/src/Core/PlainObjectBase.h:285: void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index, Eigen::Index) [with Derived = Eigen::Matrix<float, 1, -1>; Eigen::Index = long int]: Assertion `(!(RowsAtCompileTime!=Dynamic) || (rows==RowsAtCompileTime)) && (!(ColsAtCompileTime!=Dynamic) || (cols==ColsAtCompileTime)) && (!(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic) || (rows<=MaxRowsAtCompileTime)) && (!(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic) || (cols<=MaxColsAtCompileTime)) && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array."' failed.
Aborted (core dumped)
​/*****************************************************/

The warning during the compiling and error during exection happens because of a library:
eigen: http://eigen.tuxfamily.org/index.php?title=Main_Page#Download

What is the diference between xcpp and g++?

How can I make the xcpp work for the host side code?

0 Kudos
mathmaxsean
Explorer
Explorer
29,120 Views
Registered: ‎05-23-2017

I found the isuue was caused by giving a wrong file path to the eigne3 funciton.

 

solved.

 

Thanks 

  

View solution in original post

0 Kudos