Cannot resolve symbol in libprotobuf in openwrt - openwrt

I have cross compiled a client server program to be run on openwrt plattform
I have used protoc version 2.6.1 to generate the .pb.h and .pb.cc files.
I have installed he protobuf package for cross compilation using the this
I have linked the compiled protobuf libraries to the source while compiling.
But when I try to run the executable on the openwrt VM (chaos calmer) it gives me the following error.
symbol '_ZN6google8protobuf8internal13empty_string_B5cxx11E': can't
resolve the symbol in lib './opwenwrt-client'
error image
I can guess the that there is mismatch between linking library.
But I dont understand that everywhere I am using protobuf version 2.1.6.
Any kind of help would be appreciated.

This looks like it's probably caused by using a different compiler / C++ ABI to compile your application vs. libprotobuf.so. See this previous question for more:
Undefined reference to google::protobuf::internal::empty_string_[abi:cxx11]

Related

Visual Studio 2019, Win10, and HDF5 installed using vcpkg. Unresolved external symbol H5T_IEEE_F64BE_g

Any help is much appreciated. I'm having link errors when trying to use HDF5 libraries installed using vcpkg with Visual Studio 2019 on Windows 10.
I installed HDF5 1.12.0 on Windows 10 using vcpkg:
PowerShell: .\vcpkg install hdf5 hdf5:x64-windows
I then attempted to use Visual Studio 2019 to build my project that uses HDF5, but I keep getting the following LNK2001 errors.
unresolved external symbol H5T_IEEE_F64BE_g
unresolved external symbol H5T_STD_I64BE_g
unresolved external symbol H5T_C_S1_g
unresolved external symbol H5T_NATIVE_INT_g
unresolved external symbol H5T_NATIVE_DOUBLE_g
I tried to solve this by directly adding the additional library directories that are under the vcpkg/packages/ for HDF5, SZIP, and ZLIB, that were automatically installed as part of the HDF5 installation step given previously, and I also added the library files to the additional dependencies in the order prescribed by the HDF5 documentation:
hdf5_hl.lib
hdf5.lib
szip.lib
zlib.lib
But I still have the unresolved external symbol errors.
All those symbols are prefixed with H5_DLLVAR. As such you need to explicitly set the preprocessor definitionH5_BUILT_AS_DYNAMIC_LIBif you are not using CMake and only the MSBuild integration vcpkg provides. You could also open and issue with vcpkg since it should embedded that definition into the correct hdf5 header if the library is built dynamically.
The vcpkg command that I used installs the dynamic version of the libraries. Instead I installed the static version of the libraries using:
./vcpkg install hdf5:x64-windows-static
No manual inclusion of the library directories or libraries themselves is needed. Just be sure to run this command as well (when first installing vcpkg):
./vcpkg.exe integrate install
Once that was done, Visual Studio 2019 was able to properly use the HDF5 libraries for my project and the linker error was gone (binary produced).
Hope this helps someone in the future!

clang/clang++ not detecting standard header files like iostream.h and stdio.h

I ran clang++ -v testfile.cpp and found that many standard headers were missing from the directory C:\LLVM\lib\clang\3.9.0\include. I downloaded a pre-built binary of clang 3.9.0 for 32 bit windows from this link.
Can someone please help me sort out this mess and explain me why the standard libraries are missing in the pre-build version of clang? I've searched the web for hours to get the answer and solution to this problem but couldn't find one. Thanks in advance.
why the standard libraries are missing in the pre-build version of clang?
Your Windows binary download comprises only binary build tools
plus a handful of clang-specific headers because you are supposed
to use clang, on Windows, in lieu of another native compiler that provides your
standard library. Similarly if you install clang on Linux you'll build against
the GCC standard library by default.
Your internet search seemingly failed to lead you to Installing clang++ to compile and link on Windows, which
explains how to integrate clang with the mingw-w64 GCC standard library for 32- and/or 64-bit work
in the manner that clang for Windows expects and supports.

Run a c++ binary file that requires library on a different system

I have written c++ Code that requires Opencv libraries to compile in Ubuntu 12.04. When I try to run the binary generated on a different system, it asks for the library. Does this happens, or there is error in code. If no error how can I run the code than.
You should build it on the new system , if it asks for the library, you are not linking correctly.

cvBlobsLib with mingw

Does anybody know how to build cvBlobsLib using MinGW? On official page http://opencv.willowgarage.com/wiki/cvBlobsLib there is only instruction for VS.
There is also linux version of this lib http://opencv.willowgarage.com/wiki/cvBlobsLib?action=AttachFile&do=view&target=cvblobs8.3_linux.tgz , but its makefile cannot be used in windows as i see.
If you use eclipse then you dont have a lot of work:
Create a new project, using MinGW toolchain.
Go to the project properties, and under C/C++ General >> Paths and Symbols add the openCV library paths.
compile the project and it should be OK.
Use this
http://opencv.willowgarage.com/wiki/cvBlobsLib#Build_intructions
if you have more problems (especially NOTE 3)

Cross Compiling a library from intel to arm

I am using open source C++ library DCMTK from http://dicom.offis.de/dcmtk.php.en.
I have successfully compiled this library on Windows using VC++ IDE, MacOS Xcode, Mac iOS simulator.
But I am not able to compile this library on iOS device as it is ARM based architecture.
DCMTK library compiled very well on Intel architecture.
Now my problem statement is :-
I need to compile this DCMTK C++ library on ARM architecture by cross compilation.
I am using Ubuntu 64 bit machine for cross compilation.
I have installed binaries from GNU ARM tool chain from http://www.gnuarm.com/
I am using GCC toolchain 4.0 binutils-2.16.1, gcc-4.0.2-c-c++, newlib-1.14.0, insight-6.4, TAR BZ2 [65.5MB] binaries for Ubuntu 64 bit machine for ARM cross compilation.
After Installing these binaries on Ubuntu I have set PATH environment variable to
PATH=$PATH/gnu_arm/bin
For configuring the DCMTK C++ library I have run the following command on shell
CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar RANLIB=arm-elf-ranlib ARFLAGS=cruv ./configure –prefix=$home_dicom –target=arm-elf –host=arm-elf –enable-std-includes –disable-threads
It creates a make file properly. Now I am trying to compile the code by using make command, but facing so many compilation errors like :-
1) I tried to compile my first dependent C++ library that is ofstd.
I got error for DIR*, struct dirent, opendir(), closedir() calls.
It includes for these calls, but I did not found any definitions for the above calls in this header file.
2) When I compile another library oflog I got the following errors like
error: nthos was not declared in this scope
error: ntohl was not declared in this scope
error: htons was not declared in this scope
error: htonl was not declared in this scope.
These calls are networking calls and are not defined in any of the header file from GNU ARM tool.
I tried to download the sources of ARM binaries and extracted the tar files and try to copy missing header files to installed GNU ARM on Ubuntu.
For some files it compiles after doing changes to copied header files, and for some again it gives compilation errors.. There is a loop of compilation errors for every file present under DCMTK library as some of the standard header files are missing.
Please suggest if there is any other tool chain available for ARM cross compilation on Ubuntu 64 bit machine.
Or any other good solution apart from this.
Thanks!!!
Amit
There are many areas for problems when it comes to cross compiling. There are three main flags for cross compiling. -host , -target, and -build. The -host flash is the machine in which the resulting binaries will run on. The -build flash is the system in which you will be compiling on. The -target flag is for building libraries that will be used in cross compiling. So if you were to build your own gcc tool chain. So in your case you won't set the target flag as we're not building a tool chain. the -host flag will be arm-elf. And the -build flag will be amd64.
Usually a cross compilation fails if there are inconsistencies between the regular c compiler and the cross compiler. I have compiled several libraries for the avr32 with a toolchain generated by buildroot, but in some cases (socat project for example) it hasn't been possible.
Your host, your target and the CXX flags look ok. I think it is not necessary to put the AR flag (that is the idea with the host and target option).
In other hand, this is an example for the expat libraries for the avr32:
./configure --host=avr32-linux --prefix=/home/juan/builds/build_expat/ CC=avr32-linux-gcc
make; make install
I can recommend you that tries to cross compile from an ia32 architecture. I had several problems with that ubuntu in the past.

Resources