how to compile C++ - libsndfile on iOS - c++

ld: warning: ignoring file /Users/vibhavarirajadnya/MyDev/iOS-Projects/Music/POC/ReadWaveFile/ReadWaveFile/libsndfile.a, file was built for archive which is not the architecture being linked (i386): /Users/vibhavarirajadnya/MyDev/iOS-Projects/Music/POC/ReadWaveFile/ReadWaveFile/libsndfile.a
Undefined symbols for architecture i386:
"_sf_close", referenced from:
SndfileHandle::SNDFILE_ref::~SNDFILE_ref() in ReadWaveFile.o
"_sf_open", referenced from:
SndfileHandle::SndfileHandle(char const*, int, int, int, int) in ReadWaveFile.o
"_sf_strerror", referenced from:
SndfileHandle::strError() const in ReadWaveFile.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried compiling libsndfile file in 3 ways:
1. ./configure then make and make install through command prompt.
2. http://ofdsp.blogspot.in/2011/07/installing-libsndfile-with-xcode.html
3. http://en.efreedom.net/Question/1-11576168/Cross-Compile-Libsndfile-Arm-Raspberry-Pi
With the first option I am getting the error mentioned above. With the second, I am getting some 69 errors most of them related to FLAC. With the third option I am getting the same as 1. It also gives a msg in the command prompt:
Installation directories :
Library directory : ................... /Users/vibhavarirajadnya/Arm/lib
Program directory : ................... /Users/vibhavarirajadnya/Arm/bin
Pkgconfig directory : ................. /Users/vibhavarirajadnya/Arm/lib/pkgconfig
HTML docs directory : ................. /Users/vibhavarirajadnya/Arm/share/doc/libsndfile1-dev/html
But when I check in Finder, there is no such directory.
Can somebody tell me a step by step method to compile libsndfile and its dependencies for Mac iOSX?

Related

Error code while compiling a project: Undefined symbol for architecture arm64

I'm trying to compile a projet with a makefile but I get this error message :
g++ testVecteur2D.o Vecteur2D.o -o testVecteur2D
ld: warning: ignoring file Vecteur2D.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file testVecteur2D.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
Undefined symbols for architecture arm64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [testVecteur2D] Error 1
my code is working on other computer so I don't understand why it is not on mine. For information I'm using de new m1 Mac maybe it has something to do with it.

How use dlib in Xcode C++?

I have installed dlib using Homebrew.
brew install dlib
Did this:
Add /usr/local/Cellar/dlib/19.16/include to Header Search Paths
Add /usr/local/Cellar/dlib/19.16/lib to Library Search Paths
Add -ldlib to Other Linker Flags
Add Accelerate.framework and change status to "Required" in Link Binary With Libraries
But when I include dlib's .h files have error:
Undefined symbols for architecture x86_64:
"_USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_", referenced from:
_dlib_check_consistent_assert_usage in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
P.S. Yes, i used -v, but it's no effects

Xcode 8 - c++ - Undefined symbols for architecture x86_64: "liblas::Reader....."

I am currently working on a c++ project using xcode 8, and I keep getting this error:
Undefined symbols for architecture x86_64:
"liblas::Reader::Reader(std::__1::basic_istream<char, std::__1::char_traits<char> >&)", referenced from:
_main in main.o
"liblas::Reader::~Reader()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have compiled boost, liblas, etc. I have it included in my cmakelists.txt as well, and have the folder it is included in listed in 'Framework Search Paths' as well as 'Header Search Paths'. My compiler is the xcode 8 default of Apple LLVM 8.0. My deployment target is 10.11. The valid architectures are 'x86_64' and 'i386'.
Here is the code that attempts to use libLAS (file.las contains a hardcoded path to my las file). This code was pulled directly off the libLAS c++ tutorial here:
std::ifstream ifs;
ifs.open("file.las", std::ios::in | std::ios::binary);
liblas::ReaderFactory f;
liblas::Reader reader = f.CreateWithStream(ifs);
If I comment out the line liblas::Reader reader = f.CreateWithStream(ifs);, the code compiles fine, and produces a valid executable. With this line here, it throws the error. I need to be able to read LAS files with this project however, so I need to try to get the Reader to work.
So my questions are:
Is there a better way to debug this?
Is this an obvious error that I'm missing?
Is this an issue with the library? (libLAS)
What can I do to get this working?
Thanks to anyone in advance!

Working on CS106B through SEE, continued "ld: symbol(s) not found for architecture x86_64" errors when using their libraries

I'm using Eclipse and have been including the relevant libraries in the project folder as I build. Now that I'm a bit further in the course, I'm trying to
#include "vector.h"
but building gives 16 warnings that look like:
In file included from ../CS106B_Prog_Ass01_05.cpp:6:
Finished building: ../CS106B_Prog_Ass01_05.cpp
../vector.h:560:26: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
and the following error that prevents the project from building:
Undefined symbols for architecture x86_64:
"mainWrapper(int, char**)", referenced from:
_main in CS106B_Prog_Ass01_05.o
"__mainFlags", referenced from:
_main in CS106B_Prog_Ass01_05.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [CS106B_Prog_Ass01_05] Error 1
I would love to simply link to the library folder, but that results in a similar error even if I switch it to a different architecture. Has anyone had this problem?

Apple Mach-O linker error: Undefined symbols for architecture i386 Google Protobuf

I am trying to use Protobuf 2.6 with Xcode version 6.3. I've added the libprotobuf-lite.a to my Demo application and added the path to the Header files in the Header Search Paths., but I am getting this error.
Undefined symbols for architecture i386:
"google::protobuf::io::StringOutputStream::StringOutputStream(std::string*)",
referenced from:
attributes::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)
in attributes.pb.o ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)