# Linking problem when cross compiling for Raspberry Pi

**URL:** <https://forum.hdfgroup.org/t/linking-problem-when-cross-compiling-for-raspberry-pi/6370>\
**Category:** C++ Users' Group\
**Created:** [November 8, 2019, 8:13pm UTC](https://forum.hdfgroup.org/t/linking-problem-when-cross-compiling-for-raspberry-pi/6370 "2019-11-08T20:13:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrkshdr](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@mrkshdr](https://forum.hdfgroup.org/u/mrkshdr)\
**Post date:** [November 8, 2019, 8:13pm UTC](https://forum.hdfgroup.org/t/linking-problem-when-cross-compiling-for-raspberry-pi/6370/1 "2019-11-08T20:13:25Z")

</div>

I have an application which is using HDF5. I want to cross compile it for the Raspberry Pi. For this I mount the raspberry PI to a local folder which I use as sysroot. I installed hdf5 on the raspberry once via the package repository and once I did a manual compilation on the raspberry. However, in both cases I get errors when linking:  
hdf5file.cpp.o: In function `HDF5File::getChildren(std:: __cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__ cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std:: __cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__ cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)': hdf5file.cpp:(.text+0x15b4): undefined reference to`H5::CommonFG::openGroup(std::\_\_cxx11::basic\_string\<char, std::char\_traits, std::allocator \> const&) const’  
hdf5file.cpp:(.text+0x15d4): undefined reference to `H5::CommonFG::getNumObjs() const' hdf5file.cpp:(.text+0x1608): undefined reference to`H5::CommonFG::getObjnameByIdx[abi:cxx11](unsigned long long) const’  
hdf5file.cpp.o: In function `HDF5File::readGroup(std:: __cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__ cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int*)': hdf5file.cpp:(.text+0x1d34): undefined reference to`H5::CommonFG::openGroup(std::\_\_cxx11::basic\_string\<char, std::char\_traits, std::allocator \> const&) const’  
hdf5file.cpp:(.text+0x1d5c): undefined reference to `H5::H5Location::openAttribute(char const*) const' hdf5file.cpp:(.text+0x1da6): undefined reference to`H5::H5Location::openAttribute(char const\*) const’  
hdf5file.cpp.o: In function `HDF5File::readDataset(std:: __cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__ cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<double, std::allocator<double> >*)': hdf5file.cpp:(.text+0x2846): undefined reference to`H5::CommonFG::openDataSet(std::\_\_cxx11::basic\_string\<char, std::char\_traits, std::allocator \> const&) const’  
fileio.cpp.o: In function `HDF5File::readValueString(std:: __cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__ cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)': fileio.cpp:(.text._ZN8HDF5File15readValueStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_RS5_[_ZN8HDF5File15readValueStringERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_RS5_]+0x100): undefined reference to`H5::H5Location::openAttribute(char const\*) const’

At the end of my makefile (on my linux machine not the raspberry) I have  
-L/opt/raspberry/sysroot/home/pi/hdf5-1.10.5/hdf5/lib/ -lhdf5 -lhdf5\_cpp

How can I fix this?
