cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gicgatv
Contributor
Contributor
1,183 Views
Registered: ‎01-27-2015

XSDK linker error while trying to create Release

Jump to solution

Good Afternoon,

 

I have a project in XDSK that is compiling  when I set Active the Debug configuration. When I Change to Release is not possible to compile, I have the following linker error:

 

18:36:17 **** Auto Build of configuration Release for project tracking ****
make all 
Building target: tracking.elf
Invoking: ARM v7 Linux g++ linker
arm-linux-gnueabihf-g++ -L"/media/Fast/zedboard_root_fs/usr/lib" -L"/media/Fast/zedboard_root_fs/lib" --sysroot=/media/Fast/zedboard_root_fs/ -o "tracking.elf"  ./src/contour_finder.o ./src/disjoint_set.o ./src/hungarian.o ./src/kalman_tracker.o ./src/main.o ./src/multi_object_tracker.o ./src/tracker_log.o   -lm -lswresample -lz -lavformat -lopencv_calib3d -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui -lopencv_features2d -lopencv_flann -lopencv_video -lopencv_videoio
./src/tracker_log.o: In function `nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long, unsigned long long, double, std::allocator>::dump(std::ostream&, bool, unsigned int, unsigned int) const':
tracker_log.cpp:(.text._ZNK8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbxydSaE4dumpERSobjj[_ZNK8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbxydSaE4dumpERSobjj]+0x204): undefined reference to `std::__cxx11::numpunct<char>::_M_initialize_numpunct(int*)'
tracker_log.cpp:(.text._ZNK8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbxydSaE4dumpERSobjj[_ZNK8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbxydSaE4dumpERSobjj]+0xf54): undefined reference to `std::__cxx11::numpunct<char>::_M_initialize_numpunct(int*)'
makefile:48: recipe for target 'tracking.elf' failed
collect2: error: ld returned 1 exit status
make: *** [tracking.elf] Error 1

18:36:18 Build Finished (took 465ms)

I'm using the 2017.4 XSDK. I'm compiling the app for Petalinux 2017.4, I have a folder with petalinux In path with XSDK. I'm using OpenCV 3.1 Libraries... Everything works fine in debug mode, the elf is working on my Zed Board, but in Release mode I'm not able to compile.

Any help will be really appreciated!

 

 

0 Kudos
1 Solution

Accepted Solutions
gicgatv
Contributor
Contributor
1,276 Views
Registered: ‎01-27-2015

At the end I've found a possible workaround.

It depends on the optimization level. In Debug The XSDK optimization level is -O0 while in Release is -O2.

Is possible to change the optimization going in project Properties->Settings->ARM v7 Linux g++ compiler->Optimization (like shown in the following picture).

 

problem.png

 

 

I had a Doubt: Which optimization is recommended and supported by ARM? I have surfed over Internet and various sites recommend:

 

  • Compile with compiler options for smallest code size (-Os) in release mode
  • Compile with compiler options for optimized debugging (-Og) in debug mode

 

as you can read in the following reference

http://blog.atollic.com/optimizing-code-size-with-the-gnu-gcc-compiler-for-stm32-and-other-arm-cortex-m-targets

 

Looking to the XSDK optimization options I decide to use -O0 for Debug and -Os for Release, because the others choices (-O1 -O2 -O3) seems not be supported by ARM.

View solution in original post

0 Kudos
3 Replies
sadanan
Xilinx Employee
Xilinx Employee
1,143 Views
Registered: ‎10-21-2010

Hi,

Can you please post a testcase so that we can look into this?

0 Kudos
gicgatv
Contributor
Contributor
1,136 Views
Registered: ‎01-27-2015

What do you mean with test case? Do you want I post the code?

0 Kudos
gicgatv
Contributor
Contributor
1,277 Views
Registered: ‎01-27-2015

At the end I've found a possible workaround.

It depends on the optimization level. In Debug The XSDK optimization level is -O0 while in Release is -O2.

Is possible to change the optimization going in project Properties->Settings->ARM v7 Linux g++ compiler->Optimization (like shown in the following picture).

 

problem.png

 

 

I had a Doubt: Which optimization is recommended and supported by ARM? I have surfed over Internet and various sites recommend:

 

  • Compile with compiler options for smallest code size (-Os) in release mode
  • Compile with compiler options for optimized debugging (-Og) in debug mode

 

as you can read in the following reference

http://blog.atollic.com/optimizing-code-size-with-the-gnu-gcc-compiler-for-stm32-and-other-arm-cortex-m-targets

 

Looking to the XSDK optimization options I decide to use -O0 for Debug and -Os for Release, because the others choices (-O1 -O2 -O3) seems not be supported by ARM.

View solution in original post

0 Kudos