I'm trying to install clang and llvm as mentioned in this link
http://clang.llvm.org/get_started.html. However I require llvm-config in one of my code. I cannot find llvm-config in /usr/bin directory which has other llvm commands. Does this mean llvm/clang installation is corrupted?
Thanks
svn co http://llvm.org/svn/llvm-project/llvm/branches/release_31/ llvm31
cd llvm31
cd tools
svn co http://llvm.org/svn/llvm-project/cfe/branches/release_31/ clang
cd ..
./configure --enable-optimized --disable-doxygen --prefix=~/llvm31
make
make install
Related
I am installing libusb with brew in my Mac
brew install libusb
The linking step failed as below
Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local
Could not symlink lib/libusb-1.0.0.dylib
Target /usr/local/lib/libusb-1.0.0.dylib already exists.
You may want to remove it: rm '/usr/local/lib/libusb-1.0.0.dylib'
To force the link and overwrite all conflicting files: brew link
--overwrite libusb
So I removed the existing libusb with
sudo rm '/usr/local/lib/libusb-1.0.0.dylib'
and then did a link
brew link --overwrite libusb
The linking doesn't work, shows error below
Error: Could not symlink lib/libusb-1.0.0.dylib
/usr/local/lib is not writable.
If I try
sudo brew link --overwrite libusb
instead, that doesn't work either. What am I missing?
I am using OSX El Capitan version 10.11.4 (15E65)
If things seem not to work with homebrew, my general strategy is first to try:
brew doctor
and do whatever the good doctor recommends.
If that fails, I tend to uninstall things, normally using --force which really does a good clean-up and removes old versions. So, in your case:
brew rm libusb --force
Then re-install the "unhappy" package. So, in your case:
brew install libusb
In answer to your new question in the comments. Your installation looks correct because libusb isn't an executable program - it is just a library without any associated command-line tools - so it won't show up when you run which libusb.
You can see the constituent parts of the package with this command:
brew ls libusb
/usr/local/Cellar/libusb/1.0.20/include/libusb-1.0/libusb.h
/usr/local/Cellar/libusb/1.0.20/lib/libusb-1.0.0.dylib
/usr/local/Cellar/libusb/1.0.20/lib/pkgconfig/libusb-1.0.pc
/usr/local/Cellar/libusb/1.0.20/lib/ (2 other files)
And, as you can see, there is no stand-alone executable program in /usr/local/bin called libusb, there are just
libusb.h - a C header file you would compile against
libusb...dylib - a dynamic library you would link against
libusb...pc - which supplies the info for the pkgconfig tool
So, if you wanted to compile and link an application against libusb, you would run pkg-config like this to find out the "Include path" and linker details
pkg-config --cflags --libs libusb
-I/usr/local/Cellar/libusb-compat/0.1.5/include \
-I/usr/local/Cellar/libusb/1.0.20/include/libusb-1.0 \
-L/usr/local/Cellar/libusb
which means your compilation command would look like this:
gcc yourApp.c $(pkg-config --cflags --libs libusb) -o yourApp
I am trying to build SDK for linphone-iphone.
But, unable to do so. It is giving me an error:
"You need at least CMake version 3.3.20150815 but you are currently using
3.2.3. There is no Cmake release available for it yet, so you must either
compile it manually or revert to XCode6 temporary."
I am using Xcode 7.1.
Even I don't know how to compile it manually or revert to XCode6 temporary. So, if anybody knows, please help me.
Note: I am building it by command "./prepare.py -c && ./prepare.py && make" in linphone-iphone project directory from terminal in Mac OS as per instructions given on https://github.com/BelledonneCommunications/linphone-iphone.
You should install cmake version >= 3.2.3
install them like this:
brew install cmake
this will install cmake to /usr/local/bin You can check version like this:
/usr/local/bin/cmake --version
then you need to reorder your PATH variable:
export PATH=/usr/local/bin:$PATH
after that, you can continue:
./prepare.py -c
./prepare.py
make
Solved by updating linphone submodule:
git pull && git submodule update --init --recursive && ./prepare.py -c && make
I want to compile my IOS appication from linux terminal(command line)....
Is it possible to do so, if yes, then how?
Yes, it's possible.
At least you need:
Assembler and Linker: cctools and ld64 from apple opensource.
Compiler: Clang/LLVM
SDK, include headers and libraries.
Utilities: such as ldid codesign tool.
Step 1 : The compiler
Clang/llvm >= 3.2 is highly recommended and tested.
If you want to build clang/llvm from scratch, Please refer to this link to build a svn version for your linux distribution.
If your distribution already provides clang/llvm packages,make sure it is 3.2 release or above. Lower version may work but isn't tested.
for Ubuntu 13.04 and later, clang/llvm already provided in repos, please run:
$sudo apt-get install gcc g++ clang libclang-dev uuid-dev libssl-dev libpng12-dev libicu-dev bison flex libsqlite3-dev
to install some dev packages, other dev packages related to llvm/llvm-dev should be installed automatically.
Step 2 : The assembler and linker
The latest cctools-855 and ld64-236.3 had been ported from Apple opensource to linux. the porting process is a little bit complicated, also with a lot of codes modified for linux, let's just skip it.
please check out the codes from:
svn checkout http://ios-toolchain-based-on-clang-for-linux.googlecode.com/svn/trunk/cctools-porting
Build it:
$ sed -i 's/proz -k=20 --no-curses/wget/g' cctools-ld64.sh
$ ./cctools-ld64.sh
$ cd cctools-855-ld64-236.3
$
$ ./configure --target=arm-apple-darwin11 --prefix=/usr
$ make
$ make install
For Ubuntu 13.04, since the clang/llvm 3.2 package use a customized libraries/headers path. please setup CFLAGS and CXXFLAGS first before run configure.
$export CFLAGS="-I/usr/include/llvm-c-3.2"
$export CXXFLAGS="-I/usr/include/llvm-c-3.2"
Step 3: The iPhoneOS SDK.
The old iPhone SDK with ARC support extracted from xcode had been provided in Download Sections. You can directly download it and extract it to /usr/share
For iOS 4.2: https://ios-toolchain-based-on-clang-for-linux.googlecode.com/files/iPhoneOS4.2.sdk.tar.xz
For iOS 5.0: https://ios-toolchain-based-on-clang-for-linux.googlecode.com/files/iPhoneOS5.0.sdk.tar.xz
For iOS 6.0: https://ios-toolchain-based-on-clang-for-linux.googlecode.com/files/iPhoneOS6.0.sdk.tar.xz
For other iOS versions, You may need follow these steps to get the SDK for your self.
Step 4: The utilities
iphonesdk-utils is a utility collection for iOS development, provides below utilities:
NOTE: (Some of them are collected from internet with some modifications.)
ldid : codesign tool, with armv7/armv7s support and other changes from orig version. it will be involked by ld64 after link complete.
ios-clang-wrapper : automatically find SDK and construct proper compilation args.
ios-switchsdk : switch sdk when multiple version of SDK exist.
ios-pngcrush: png crush/de-crush tool, like Apple's pngcrush.
ios-createProject : project templates
ios-genLocalization : iOS app localization tool based on clang lexer.
ios-plutil : plist compiler/decompiler.
ios-xcbuild : convert xcode project to makefile, build xcode project directly under linux.
Download the source tarball from: https://ios-toolchain-based-on-clang-for-linux.googlecode.com/files/iphonesdk-utils-2.0.tar.gz
Build and install it:
$./configure --prefix=/usr
$make
$make install
Build App
Now you can build and install your project simply doing:
$cd ProjectDir
$make
$make install IPHONE_IP=<your own device IP
Complete info you can find here — https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/wiki/HowTo_en
The above solution given by Barjomet is correct incase if its not mavericks, but if it is Maverics then following is the solution:
1) Install the appropriate command line tool
2) for building :a)xcodebuild -list -project .xcodeproj
b)- xcodebuild -scheme build
For detail reference you can refer the following link:
https://developer.apple.com/library/ios/technotes/tn2339/_index.html.
I want to build a program (YCM for VIM) which needs compiled Clang binaries to be linked with. For a reason, I can't use precompiled version which llvm itself offers for download (I've tested it, it doesn't work), so I want to build Clang and then build YCM, both with gcc.
For YCM to be built, I need compiled Clang files in the same way that they are in the precompiled package that llvm offers, that is there should be these folders:
bin docs include lib share
with corresponding files in them.
Now, I can build llvm and Clang with these commands:
mkdir llvm && cd llvm
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ..
cd ..
mkdir llvm-build && cd llvm-build
../llvm/configure --prefix=/usr/clang_3_4 --enable-optimized --enable-targets=host --disable-compiler-version-checks
make -j 8
after these, I get these folders in my llvm-build folder:
bindings config.log docs include LLVMBuild.cmake Makefile Makefile.config projects test unittests
cmake config.status examples lib llvm.spec Makefile.common Makefile.llvmbuild Release+Asserts tools utils
How can I create the files in the aforementioned way?
I think you should then run sudo make install.
You can also set the configure prefix to a local dir (e.g. somewhere in $HOME) if you don't want it to get copied into the system dirs and needing root access.
I'm currently trying to install the lib++.1.dylib on my mac. I followed the instructions here http://libcxx.llvm.org/ and downloaded the source. When I tried to ./buildit I encountered a clang++: command not found error.
So I went here http://clang.llvm.org/get_started.html and installed clang. Unfortunately now when I went back to installing libcxx, I still got the clang++ error. Clang itself works as clang --help brings up the help menu.
Installing Xcode isn't an option as I am runnning 10.6.8.
How do I proceed i.e. get the clang++ command to work?
There is an instruction for build libc++ on 10.6 in github
https://github.com/llvm-mirror/libcxx/tree/apple
To build on Mac OS X 10.6, you need a helper library and header found
here. cp cxxabi.h to /usr/include, and cp libc++abi.dylib to /usr/lib.
Next:
cd libcxx/lib
export TRIPLE=-apple-
./buildit
That should result in a libc++.1.dylib. To install it I like to use
links instead of copying, but either should work:
cd /usr/lib
sudo ln -sf path-to-libcxx/lib/libc++.1.dylib libc++.1.dylib
sudo ln -sf libc++.1.dylib libc++.dylib
cd /usr/include/c++
sudo ln -sf path-to-libcxx/include v1
Link in instruction not work.
The libcppabi for 10.6 You can download on this link http://www.mediafire.com/download/2aq37hc97n4f47c/libcppabi.zip
It is a fairly complex process to build libc++ on Mac 10.6, as it needs libc++abi to be present, which didn't ship with 10.6. So the working steps are as follow:
Build Clang.
Use this Clang to build libc++abi.
You have to make sure libc++abi and its header are properly placed so that in the next step in can be found.
Then use this Clang to build libc++ and link to this libc++abi.
Also note if you are using Clang 3.3 instead of the latest development trunk, you will also need this patch (http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?r1=172666&r2=189535&view=patch) to unwind.h so that libc++abi can be built properly.
I have tested a working process and updated the homebrew-version formula so it works in homebrew out-of-the-box. You can check the details at https://github.com/Homebrew/homebrew-versions/blob/master/llvm33.rb. Hope this helps.