i am looking for solution of merging my own library with third party library on ios platform.
i have my desktop project with some C++ functions, which i want to use in ios app. In original this project use fftw3 lib, which i built from sources on windows. fftw3 is included as static lib(.lib file) with suitable header:
#include <fftw3.h>
I made ios static c++ lib from VS template and transfered my code to there. But there is no library depencies option in the project settings, so i can't add fftw3 lib to this project. The project is sucsefully building(with adding fftw3 header inside project) on ARM64 platform in ".a" file on remoted Mac, but of course it failed, when it used by client code. I have a lot of errors like this:
Undefined symbols for architecture arm64:
"_fftwf_alloc_complex", referenced from:
Also i built fftw3 lib on Mac with arm64 platform and got libfftw3.a file. After that i tried to merge these libs toghether with libtool:
libtool -static -o new.a mylib.a libfftw3.a
But i have got the same errors. What am I doing wrong?
I have a Linux build machine with a cross build toolchain (armhf) for my ARM target device. Both systems are Debian based.
I am struggling how to properly include prebuilt external libraries in my toolchain. When not cross compiling, I would just install the dev package versions with apt on my build machine.
So the first idea was to download the dev packages of the libraries (and all its dependencies) on the target device and extract these to a library directory on the build machine, which I can then include to my build.
Then I realized that it is kind of a second sysroot and that tools like pkg-config have trouble finding some libraries in this setup.
So the second idea was to backup the original sysroot and extract all dev packages to the sysroot.
This allows me to build my application and other libraries.
But is this a valid way of including external libraries?
Are there better ways to use the prebuilt dev packages in the cross build environment?
I've C++ project build using CMake and currently facing 1 issue, brief description below
lib_common -- STATIC library
lib common uses libconfig to load common configurations used in other project.
script_executor -- CMake project
It references above static library and also add external library libconfig, see below:
add_executable(script_executor)
target_link_libraries(script_executor "-lconfig++" "-llibcommon")
So I'm referencing llibcommon inside this project and llibcommon also uses libconfig which is already reference("-lconfig++") from this project.
But I'm still getting undefined reference to libconfig::Config::Config()
Environment details:
UBuntu 16.04,
cmake version 3.5.1,
gcc version 5.4.0,
g++ version 5.4.0
I've been developing c++ project using a Tensorflow c++ api. it just execute created tensorflow's graph from Python. I build it using bazel with Tensorflow code now. But I think it's inefficient way.
I want just Tensorflow library and header files, and Just compile my project only using Cmake.
I know how to build shared library.
bazel build -c opt --config=cuda //tensorflow:libtensorflow.so but this command just make a libtensorflow.so file. I can't find header files for build my project.
Is there way to package tensorflow library for c++? such as mvn package command.
As far as I know, there is no official distributable C++ API package. There is, however, tensorflow_cc project that builds and installs TF C++ API for you, along with convenient CMake targets you can link against. According to your description, that may be just what you need.
If your operating system is Debian or Ubuntu, you can download unofficial prebuilt packages with the Tensorflow C/C++ libraries. This distribution can be used for C/C++ inference with CPU, GPU support is not included:
https://github.com/kecsap/tensorflow_cpp_packaging/releases
There are instructions written how to freeze a checkpoint in Tensorflow (TFLearn) and load this model for inference with the C/C++ API:
https://github.com/kecsap/tensorflow_cpp_packaging/blob/master/README.md
Beware: I am the developer of this Github project.
As Floop already mentioned, his tensorflow_cc project is also a good alternative without packaging, especially if you want GPU support for the inference.
You can build tensorflow with CMake. This also creates a TensorflowConfig.cmake, which you can integrate in your project
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/cmake
Little hint: You have to build the shared lib, even if you do not need it.
You have two option: static linking and dynamic linking.
If you want to dynamic link your c++ project to TensorFlow, all you need is a --whole-archive linker flag. The necessary header files are provided by a pip install.
Generating the library is basically
bazel build -c opt --copt=-mfpmath=both --config=cuda //tensorflow:libtensorflow.so
bazel build -c opt --copt=-mfpmath=both --config=cuda //tensorflow:libtensorflow_cc.so
Having everything in place it is easy to run a TensorFlow graph in C, C++, Go (GitHub project). See the linked project for these working examples in C, C++, Go.
When building against the shared library, the headers I use are in $PROJECT_HOME/bazel-genfiles.
Adding $PROJECT_HOME/bazel-genfiles to the linker header list should be enough.
I want to use SOCI C++ library - http://soci.sourceforge.net/ in my cocos2d-x project (iOS and Android). It requires CMake flags to be configured - http://soci.sourceforge.net/doc/3.2/installation.html.
Is there way to add external lib with CMake flags in cocos2d-x?
cocos2d-x v3 has cmake build template with every project.
If you are comfortable with cmake build scripts, edit the cmake file to your liking.