Linking boost libraries - c++

I have downloaded the boost library (version 1.46.1), but I don't know how to link it through xcode.I found an old question says to put the -lfftw3 flag, so I've put it.
I also added the path: /home/Documents/C++/boost_1_46_1 (it's the directory where I have put the library), but I am getting an error from the linker:
ld: warning: directory not found for option '-L/home/ramy/Documents/C++/boost_1_46_1'
ld: library not found for -lfftw3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Command /Developer/usr/bin/clang++ failed with exit code 1
So the question are two:
1)How to manage xcode to link boost?
2)Where to put the library in file system? In linux there was /usr/lib, here there isn't this path, should I put it in /Developer/usr/lib?

Or for those who are looking for a quick answer (and are on linux), the magic is simply to add the following flags:
-l boost_system

Related

Pybind11 doesn't work or C++ doesn't compile after upgrading to Mojave: -lstdc++ not found

I was able to install the pybind11 example here before I upgraded my MacOS. However, after I upgraded my MacOS to Mojave, when I compile the same example on that link, I see the following error:
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
Am I missing a linker command? I've searched online but couldn't find a solution.
I actually found the answer. I only needed to do
export MACOSX_DEPLOYMENT_TARGET=10.9
The installation went smoothly.

Setting up Vimeo SDK in iOS

Trying to incorporate Vimeo SDK from github into my iOS project.
Xcode 7.3.1
I have cocoa pods installed and my TestVimeo1 project setup but when I attempt target VIMNetworking, AFNetworking and VIMObjectMapper I must not be going about this correct.
ld: warning: directory not found for option '-L/Users/xxxxx/xcodebuild/_buildoutput/TestVimeo1-fktedyrxeulxmicndbpgghnbdjtn/Build/Products/Debug-iphonesimulator/AFNetworking'
ld: warning: directory not found for option '-L/Users/xxxxx/xcodebuild/_buildoutput/TestVimeo1-fktedyrxeulxmicndbpgghnbdjtn/Build/Products/Debug-iphonesimulator/VIMNetworking'
ld: warning: directory not found for option '-L/Users/xxxxx/xcodebuild/_buildoutput/TestVimeo1-fktedyrxeulxmicndbpgghnbdjtn/Build/Products/Debug-iphonesimulator/VIMObjectMapper'
ld: library not found for -lAFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can't find the output directories. Where am I going wrong with setting up the target builds for these git submodules? Thanks!

How to resolve build errors in OSX cctools?

I am attempting to build tools from the CCtools collection for OSX, under OSX. I am doing this for research purposes.
When I run the makefile for the entire project I get a linker error:
=========== /Applications/Xcode.app/Contents/Developer/usr/bin/make all for misc =============
cc -Os -DLTO_SUPPORT -DTRIE_SUPPORT -g -Wall -I. -I./../include -I. -I/usr/local/include -c -o ./lipo.o lipo.c
cc -nostdlib -r \
-o ./lipo.private.o \
./lipo.o -L./../libstuff -lstuff
cc -o ./lipo.NEW \
./lipo.private.o
Undefined symbols for architecture x86_64:
"_is_llvm_bitcode_from_memory", referenced from:
_main in lipo.private.o
_check_archive in lipo.private.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[1]: *** [lipo.NEW] Error 1
make: *** [all] Error 1
Running the make files of the individual tools nets me a similar linker error. This occurs for all versions of the CCtools I have tried (Including 877.5, the latest source, and 862, the version that my installed tools are at.)
What am I missing to make the tools compile?
How can I coax the linker to let me know what library I am missing?
Where can I find instruction to make the tools compile?
Additional info:
I have XCode and developer tools installed, and I build projects all the time.
I also have gcc installed from brew.
I must be missing something stupid.
I cannot give you the exact solution for your version 877.5 but the overall problem is that the compilation requires some of the LLVM code on your machine. It might be as simple as missing include directories for the LLVM headers or can require linking some of the LLVM libraries. In your case, they seem to be related to LLVM Bitcode somehow.
In my case, I have just built a subset of the more recent version cctools-895. It complained about a missing symbol related to LLVM's llvm-c/lto.h header. The error went away when I added the following to the problematic file's compilation rules:
-I/opt/llvm-7.0.0/include/
The version of LLVM 7 was a random guess that worked because I had it on my machine. You might want to tailor your include paths to point to the correct version of LLVM that the cctools are supposed to be built with.
The easiest way to get the LLVM on your machine is to get a binary version from the LLVM Download page.

libSOIL Linker Error In XCode

So, I downloaded libSoil from https://github.com/smibarber/libSOIL and ran make, then sudo make install in Terminal. No errors, seemed to go fine.
But when I try and add libSOIL.dylib to the "Link Binary With Libraries" list in my XCode project, I get a linker error when I try to compile.
It says:
ld: library not found for -lSOIL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I managed to install and link GLFW3 to my project without any problems, so I'm not sure what the problem is here.
I figured out the problem: my header search path was at /usr/local/Cellar/glfw3/3.1/include instead of /usr/local/include

ld: library not found

I'm trying to build a project that depends on SDL2 library. I've installed and linked it using homebrew:
> ls /usr/local/lib | grep SDL2
libSDL2-2.0.0.dylib
libSDL2.a
libSDL2.dylib
libSDL2_test.a
libSDL2main.a
I also added /usr/local/lib to my /etc/paths and ~/.bash_profile as well:
> cat /etc/paths
/usr/local/lib
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
However, when I try to build the project, I still get this error:
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' (...) '-lSDL2'
ld: library not found for -lSDL2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Why does it happen and how can I fix it?
I fixed the issue by adding /usr/local/lib to my $LIBRARY_PATH:
For bash, in ~/.bash_profile:
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib"
And for fish shell, in ~/.config/fish/config.fish:
set -g -x LIBRARY_PATH $LIBRARY_PATH /usr/local/lib
/etc/paths is for executable files, not shared libraries. Same with the $PATH environmental variable set in .bash_profile. These are the paths searched for programs when you type a command in the terminal.
What you need to do is change the linkers link path. See the answer to this question for details on how to set up the link path.