Install libc++ on mac 10.6.8 - clang

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.

Related

Espressif tool chain broken after macOS Monterey 12.3 beta 3 install

After Monterey 12.3 beta 2 installed, the Espressif tool chain is broken. If you compile with platformIO you'll get the following error:
^
Linking .pio/build/esp32dev/firmware.elf
/Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.so: error loading plugin: dlopen(/Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.so, 0x0002): Library not loaded: /opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/libstdc++.6.dylib
Referenced from: /Users/stephanedeluca/.platformio/packages/toolchain-xtensa32/libexec/gcc/xtensa-esp32-elf/5.2.0/liblto_plugin.0.so
Reason: tried: '/opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/libstdc++.6.dylib' (no such file)
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1
Looking at my Mac, there is no /opt/osxcross.
I have searched on another Mac with the beta 1 where the tool chain was still working the presence of the folder, and guess what?! there's none!
Any idea what as actually broken by the beta?
Finally, here is a work around: we are going to provide the missing /opt/osxcross folder and contents.
If you do not have gcc installed (this should be unlikely though, install gcc to get the folder content, as follows:
$ brew install gcc
Create the missing /opt/osxcross folder as follows:
$ sudo mkdir -p /opt/osxcross/target/bin/../x86_64-apple-darwin12/lib/
Note that you'll be prompted for your password.
And, finally, copy the folder contents from the gcc build as follows:
$ sudo cp /usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/libstdc++.6.dylib /opt/osxcross/target/x86_64-apple-darwin12/lib/libstdc++.6.dylib
This completes the fix.
You must restart vscode, Arduino IDE or whatever tool you use. And then build your project, which should compile successfully.
And voila.

Unable to build OpenSSL for iOS Simulator

I'm trying to build OpenSSL for iOS Simulator with the following steps:
(MackBook Pro, OS X Version 10.10.5v + Xcode Version 7.2)
$ mkdir openssl
$ cd openssl
$ wget http://www.openssl.org/source/openssl-1.0.2e.tar.gz
$ tar xvzf openssl-1.0.2e.tar.gz
$ cd openssl-1.0.2e
$ mkdir /tmp/openssl-1.0.2e-i386
$ ./configure BSD-generic32 --openssldir=/tmp/openssl-1.0.2e-i386
$ vi Makefile
Make the following changes:
1) Replace
"CC= gcc"
with
"CC= /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386"
2) Append
"-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
to the end of
"CFLAG= ..."
$ make
However, the following error occurs:
ld: building for OSX, but linking against dylib built for iOS, file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.dylib' for architecture i386
Can someone tell me what is wrong?
Solved this issue by referring other question.
I added "-miphoneos-version-min=6.0" to CFLAG and the issue has gone.
Thanks.
The error is one that you receive whenever you're importing and trying to link an OSX app to an iOS system library. There are many differences between the two platforms, and the libraries are not interchangeable. You're running a line to change the location of the library file that is pulled for the project. Ensure that the library you're pointing to has slices for the system architecture you're trying to build for (i386, in this case).

Is there anyone who help me to build iOS linphone on Yosemite 10.10.2?

I download the linphone SDK, installed MacPorts and then when writing following command in terminal, i got 'Xcode not installed properly....' and then I follow their rules to install left XCode's software, that are also done on my terminal screen.
sudo port install automake autoconf libtool pkgconfig intltool wget cunit \
antlr3 speex readline sqlite3 openldap libupnp \
ffmpeg-devel -gpl2
But here problem persists...
Please help me to get out from this problem.
Thanks in advance
Actually there's few Steps of compiling the Linphone SDK.
Install dependencies
Install Antlr 3
Install gas-preprosessor.pl
Symlink libtoolize to glibtoolize
Link host strings to simulator SDK
Link /opt/local/bin to /usr/local/bin
Then Build
git clone git://git.linphone.org/linphone-iphone.git --recursive
Set the SDK version
./prepare.py && make(The link below use "make" instead which is deprecated)
Detailed steps as:Building linphone SDK using Homebrew
I currently have to do the same thing and you don't have to get through this steps.....been there done that...
Instead you can download instead this the SDK by searching this on google liblinphone-iphone-sdk-2.2.5.zip
And, of course check the latest news from Linphone, to be updated.
Best Approach would be to clone and start this:
https://github.com/BelledonneCommunications/linphone-iphone
And very important use a Xcode 6 version. Xcode 7 gives you some errors as they introduced some new features and depracated old stuff.
If you don't know how to use git, please pause what you are doing and dedicate some time to do it because will have to do it multiple time during your career.
Hope this helps! Good luck

Compile IOS program from linux commandline

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.

Building libxml2-2.9.2 on OS X Yosemite, xCode 6

I have an xcode project which uses xmppframework.
the KissXML module of this framework needs libxml2, according to https://github.com/robbiehanson/KissXML/wiki/GettingStarted.
I followed these instructions, and downloaded libxml2 from ftp://xmlsoft.org/libxml2/.
Specifically, I downloaded and extracted LATEST_LIBXML2, which turns out to be libxml2-2.9.2.
I then added the relevant header search path to my xcode project, and
-l "lxml2"
to my linker flags.
However, when I build my project, it gives the following linker error:
ld: library not found for -llxml2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I suspect this is because I need to build libxml2 myself, in order to get the library binary. However, I can't find specific instructions for doing this on OS X Yosemite, xcode 6.
Does anyone have any instructions on building libxml2-2.9.2 on OS X Yosemite, Xcode 6, so that I can link to it in my project?
Alternatively, if someone can provide a binary for libxml2-2.9.2, that might also work. I did find http://www.explain.com.au/oss/libxml2xslt.html#id2658905, but this guy only seems to offer binaries for older versions of libxml2, not the current version.
Thanks!
Best regards,
Chris
Well firstly, the library is called libxml2, so the link should be -lxml2 and not -llxml2.
Secondly, there is already a libxml2 built-in to OSX/iOS, and you can actually reference that library in the link libraries section for the project. You generally don't need to build the library unless you really want newer features of the newer version.
In the General tab of the project, use the Linked frameworks and Libraries to add a reference to libxml2.dylib.
The instructions on the page you reference are using the version of libxml2 that is available on OSX/iOS already. You do not need to download libxml2 to get it to work.
The location that's mentioned /usr/include/libxml2 on the page will work for you also if you install the command line developer tools - at a terminal prompt do xcode-select --install.
I have built LibXML2 (latest version 2.9.2) on Solaris SPARC, Linux and Windows. I have never use MacOS (poor =)) ).
Here's my brief instruction. You can try the similar way.
cd /opt/mydir/libxml2
mkdir linux-gcc3
gunzib -c libxml2-2.9.2.tar.gz | tar xvf –
cd libxml2-2.9.2
./configure --prefix=/opt/mydir/libxml2/linux-gcc3 --enable-static --disable-shared 2>&1 | tee conf.log
## 64 bit
## ./configure CC="cc -m64" --prefix=/opt/mydir/libxml2/linux-gcc3 --enable-static --disable-shared 2>&1 | tee conf.log
make 2>&1 | tee make.log
make install

Resources