Dependicies in static C++ lib in IOS - c++

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?

Related

How to build MLPack library as a static library using NDK-build?

Can I build a library like mlpack which has only .hpp file as a shared library using NDK-Build?
I am trying to build an API using ndk-build from linux for android arm64 and armeabi-v7a. But my API has a dependency on mlpack. But I can't use the libmlpack.so that I have built in my development environment as it was built in my desktop linux environment.
ld: error: ~/jni/lib/libmlpack.so is incompatible with aarch64linux
So, I was wondering if I could build the libmlpack.so for arm64 by using the library's source files. The following is the git repo for mlpack:
https://github.com/mlpack/mlpack
I was able to build boost library for android using the following git repo which seems to work fine.
https://github.com/moritz-wundke/Boost-for-Android

Dynamically linked FFTW library to Qt5 Project fails when I build it

Details about my setup: Using a Qt Mingw64 Build with .lib files for 64-bit machine generated per the FFTW instructions: http://www.fftw.org/install/windows.html using Visual Code 2019. Made sure to download the pre-compiled 64-bit DLLs to generate the .lib files.
This excerpt of the .pro file was generated by Qt Creator's Add Library tool:
win32: LIBS += -L$$PWD/fftw/ -llibfftw3f-3
INCLUDEPATH += $$PWD/fftw
DEPENDPATH += $$PWD/fftw
In .CPP where I want to use FFTW library:
#include <fftw3.h>
What is in $$PWD/fftw:
libfftw3f-3.lib
libfftw3f-3.dll
libfftw3f-3.def
libfftw3f-3.esp
fftw3.h
Other misc. files included in FFTW 3.3.5 Precompiled DLL .zip
Where it fails: When I try to build it I get
"error: undefined reference to `__imp_fftw_malloc'"
and more similar errors based on the methods I'm calling from the FFTW library but fails at build.
Qt Creator auto-completes the methods so it seems to be linking the FFTW library correctly.

Using c++ experimental filesystem in Xcode project

My Xcode project contains C++ static libraries that compiled for iOS.
The C++ code includes <experimental/filesystem> that is not part of the Xcode C++ lib. I manage to compile the c++ code to static lib with Xcode 9-beta command line tools (With Xcode 8.3.3 I didn't manage to compile the c++ code since filesystem was not part of c++ lib).
When including the static lib in my project I'm getting:
Undefined symbols for architecture arm64:
std::experimental::filesystem::v1::__status(std::experimental::filesystem::v1::path..
This is not specific arm64 issue. Probably need to use C++ lib with this implementation or include filesystem lib but didn't manage to find a way to do it.
Do you have any idea how to solve this issue?

Linking error iLBC codec library from webRTC to iOS app

I've been trying to include libilbc.a library from the webRTC project into my iOS app. I'm linking it to static library (c++, Xcode project) and then linking this library to my iOS app. It's all in one workspace.
I'm stuck on the next linking error:
Undefined symbols for architecture arm64:
"_WebRtcIlbcfix_EncoderInit", referenced from:
If I check the library architecture I get the right info:
$ lipo -info libilc.a
$ Non-fat file: libilbc.a is architecture: arm64
Also if I check the content of the library, it includes the object:
$ nm libilbc.a | grep "_WebRtcIlbcfix_EncoderInit"
$ U _WebRtcIlbcfix_EncoderInit
I have included header files into the Xcode project and linked with -lilbc flag.
Remark:
I have successfully build the same project for simulator with different library that I got on Github and it worked (meaning, there is nothing wrong with the linking or including header files). The problem is that mentioned library isn't compiled for arm64 architecture.
I would really appreciate if someone knows where could I get compiled ilbc library (for ios arm64) or how to integrate the library from the webRTC project.

How to link a C++ static library with XCode which is dependent on standard library?

I have cross compiled the exiv2 library for iOS SDK 6.0.
I confirmed using lipo -i that indeed i386(simulator) and arm7 code is present in the library.
The header files (.hpp) of exiv2 uses std. XCode is unable to find the C++ standard library.
Here is my setup:
I have one XCode project which targets iOS SDK 6.0.
Inside it, there is a folder called exiv2 and it contains a header and lib folder. The exiv2 header and the .a library are in those folders.
When I compile, I get an error that in (one given file)
#include <string> : no such file or directory
Any ideas on how to link the C++ std under such a setup in XCode?
Thanks a lot.
You can go to Project Setting, select "Build Phases" and then "Link Binary with Libraries".
For standard C++ library, you can add (+) either "libc++.tbd" or "libstdc++.tbd"