I have c++ project where I have 3 libraries. Two static and one dynamic which is dependent from first two. Those two are building successfully and third is crashing while building because lack of symbols from static libs. There is also warning which I think is crucial here:
ld: warning: ignoring file /Users/pwpw/Desktop/plid/Core/../Common/libcommon64.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
I am using QT to build the project. The problem occurs only on MacOS and my version is now 10.15.2
Related
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'm working on a program that needs to be linked to libtorch_lite, and Essentia, on iOS, and have had Essentia working on iOS for a while, but when trying to add the torch dependency, which requires the -all_load linker flag to work at runtime, and I got this error:
ld: in
/Users/sylmorrison/JUCE_old/UserModules/kalide_extractors_juce/libs/iOS/arm64/libessentia.a(nnls.c.1.o),
building for iOS, but linking in object file built for macOS, file
'/Users/sylmorrison/JUCE_old/UserModules/kalide_extractors_juce/libs/iOS/arm64/libessentia.a'
A lipo -info on libessentia.a returns arm64 and arm7, and if I leave out the -all_load flag everything works fine, but torch errors at runtime (undefined reference to aten::unsqueeze)
Because torch has a load of extra dependencies, and because I thought I just needed the -all_load flag somewhere, I thought I'd try compiling it into a static library, and then linking to that library, but doing that results in the same error. I also tried modifying Essentia's build script to add an all_load flag (out of desperation mostly), which didn't get me anywhere. Any suggestions would be amazing, am at a loss about what's going on, it's like Xcode, when the all_load flag is enabled, convinces itself it's a macOS static library. If it makes a difference, I'm using an M1 Mac mini on Monterey
Okay, fixed it by figuring out which files essentia wanted to compile when cross compiling for iOS, copying them and the headers to a new folder, and then making an Xcode project to build an iOS static library, I guess due to the cross compiling somehow some of the object files were actually for macOS?
I have an ReasonML project that is using dune build to build an executable. The executable runs on the development machine (where the code is built) without any problems. However, if I copy this exe to my other laptop (Another mac with the same OSX version), I can´t execute the file due to missing libraries:
dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
Referenced from: /usr/local/bin/foo
Reason: image not found
I´m not very experienced with ocaml / reason but I expected the executable to bundle all necessary dependencies within the binary.
Is there a special build-flag or some other step that I have to perform apart from dune build in order to include all necessary libs?
What you are looking for is statically linking binaries. MacOS unfortunately does not official encourage or recommend static linking. An old page can be found here. You might find this Stackoverflow answer useful as well.
This has less to do with OCaml itself and more wrt how linkers behave on different platforms (MacOS, Linux etc)
To overcome your issue, you could checkout esy-gmp assuming you are using esy as your package manager. If you're on OPAM, you could add conf-gmp to you opam dependencies
All this being said, if you're interested in static linking on supported platform like Linux (and Windows too I guess?), you'll have to provide C linker flags via dune
(link_flags (-ccopt -static))
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 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.