Xcode 5 llvm-g++ and llvm-gcc path? - ios

I'm building an app for iOS7 with Xcode 5 using Google Tesseract OCR:
http://lois.di-qual.net/blog/install-and-use-tesseract-on-ios-with-tesseract-ios/
It worked fine with English recognition but I couldn't add any other language to the project. Then I found some other projects do it successfully by compiling Tesseract library:
http://inspirationteam.weebly.com/home/compile-use-tesseract-ocr-lib-301-on-ios
http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/
According to these articles, my llvm-g++ and llvm-gcc should be in
export CXX="$DEVROOT/usr/bin/llvm-g++"
export CC="$DEVROOT/usr/bin/llvm-gcc"
With $DEVROOT should be something like
export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
While I'm using Xcode 5 and Mac OSX 9.2 (I've heard that there're somethings had changed about C compiler with these guys), these paths didn't work for me:
checking build system type... i386-apple-darwin13.3.0
checking host system type... i386-apple-darwin13.3.0
checking how to print strings... printf
checking for gcc... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc
checking whether the C compiler works... no
configure: error: in `/Users/phuoc-de/Desktop/a/leptonica-1.71':
configure: error: C compiler cannot create executables
See `config.log' for more details
I've already installed Command line, but it still didn't work.
Does anyone know how to solve this problem? Thanks.

My days of using configure, autoconf and friends are at an end as I can pretty much find everything I want from Macports.
For me it's as simple as typing:
$ sudo port install tesseract
and going to make tea.

I found my answer here
export CXX=`xcrun -find c++`
export CC=`xcrun -find cc`
Hope it helps someone!

Related

"fftw.h not found" after installing it in Mac terminal

I'm running problem of getting fftw working. I'm on mac and have installed fftw using brew on the terminal.
brew install fftw
It gave me a reminder of "Warning: fftw 3.3.8 is already installed and up-to-date" if I put in this install command again. But I cannot call fftw.h in C. It gave me an error of "fftw.h file not found" if I have a line of
#include <fftw.h>
I also tried installing directly by
./configure
make
make install
and ran
make check
It told me "FFTW transforms passed basic tests!", but it still didn't work in C.
Any suggestions would be appreciated!
You need to specify the location of the header to your compiler. Adding the directory inclusion for either installation in both cases the header can be found in /usr/local/include
gcc ... -I/usr/local/include ...
Additionally, as has been pointed out, you need to #include <fftw3.h>. Also be reminded, that your autoconf build only has the double precision functionality installed. While the brew installation brings all 3 precisions, float, double and long double.
You will hit a wall again, possibly, when you want to link. Add -L/usr/local/lib to the linker command to be able to link like so -lfftw3 -lfftw3f -lfftw3l etc

Lambdanative can compile for OSX but not iOS

I'm running Sierra with XCode 8.3 including command line tools. I can use Gambit to compile to OSX native code. I can use lambdanative to compile the test Calculator app to OSX but when I try to configure and then compile for iOS I get the following error in verbose mode:
checking whether the C compiler works... no
configure: error: in `/Users/querist/.lambdanative/tmp_install/gambc-v4_7_9':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: failed with exit code 77
There is no config.log to read. I've done a search for it and there is not one related to this project.
Any ideas? I really like the idea of being able to develop iOS apps in Scheme.
Thanks.
I realize this may be too late, but in case somebody else stumbles upon this, I though I'd try to explain.
config.log is placed in the library output directory, not your working folder. You can look for it by running find ~/Library/ -name 'config.log'.
In my case, config.log revealed the problem is that it can't find some version of a crt library. This problem is addressed here.
I edited my ./SETUP file from my lamdbanative working directory folder, so that IOSVERSION went from the 5.1.1 default to 6.0. That solved the problem for me.

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

Configure Mac native Clang with Macports paths

When compiling projects that make use of libraries installed via MacPorts (boost, opencv, etc) I need to pass clang the library and include file locations via the -I and -L arguments.
Is there any "official" way to direct the Apple native clang look in these locations by default.
I guess I could just make a bash script with something to the effect of
clang -I/opt/local/include -L/opt/local/lib %#
and call that instead of the compiler, but is there a cleaner way to point clang to these locations automatically?
I am not looking for an Xcode based fix, instead I would like to be able to compile from the command line without having to manually type the above arguments in each time.
Any suggestions?
I had a similar question answered on the MacPorts mailing list[0].
Export these environment variables.
export CPPFLAGS='-isystem/opt/local/include'
export LDFLAGS='-L/opt/local/lib'
P.S. Hope you've not been waiting this long for an answer :)
[0] https://lists.macports.org/pipermail/macports-users/2017-July/043562.html

Erlang: Building Issue of not finding Ncurses on Solaris 10

I am trying to build Erlang on Solaris 10. The build process fails with the message that it can not find libncurses.so.5.
I have installed libncurses from sunfreeware.com, which I have build from scratch and has installed itself in /usr/local/lib/.
I have tried to set LDFLAGS with -L/usr/local/lib/ but have still had no luck.
What am I missing so that make picks up the library?
I am using GNU Make 3.81 and GCC 3.4.6.
Could you post the relevant bit from config.log?
Did you also set the include path with -I in either CPPFLAGS or CFLAGS?
Update: You could also try installing Erlang from OpenCSW instead.

Resources