Page 1 of 1

LAPACK with Mac Xcode

PostPosted: Wed Jan 06, 2010 12:00 am
by khaled83
Hello everyone,

I'm using xCode 3.0 and Mac OS X 10.5.8. I have downloaded clapack-3.2.1-CMAKE, configured and generated xCode project using cmake 2.8.0, it has configured and generated the files with no problems. I have opened the generated xCode project file, built it, and it succeeded with 5 warnings.

Following the warnings:
Compiling /Users/khaledabbas/Documents/UM/Dissertation/Software/Insight3D/Prerequisite/clapack-3.2.1-CMAKE/BLAS/SRC/xerbla.c
warning: implicit declaration of function 'printf'
warning: incompatible implicit declaration of built-in function 'printf'
warning: format '%2i' expects type 'int', but argument 3 has type 'long int'
warning: unused variable 'io___1'
At top level:
warning: 'c__1' defined but not used


After building the xCode Lapack project I get a number of Unix executable files and and the following 4 libraries as products: libf2c.a, libblas.a, liblapack.a, libtmglib.a

I'm using Blas and Lapack as a prerequisite for another open source project for stereo 3D reconstruction from multiple images called Insight3D (project also uses several other libraries as prerequisites). Insight3D also uses sba library, and I think that is the library which uses Lapack. I'm also compiling my project in xCode.

I add the 4 Lapack libraries into my project. When I build my project, I get no compilation errors, but I get the following linking error:

Undefined symbols:
"_MAIN__", referenced from:
_main in libf2c.a(main.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status


I have tried to solve the problem for several days but I couldn't. Please provide me with any help.

Re: LAPACK with Mac Xcode

PostPosted: Wed Jan 06, 2010 10:56 am
by admin
Khaked,
The quick fix is to use the terminal and not xcode on your Mac to generate the libraries and add them in xcode.
Regenerate the package for Unix makefile and just type make.
I will take a look but I am not really an expert in xcode.

Some quick comments:
- the libtmglib.a library is not needed for your program, this is just used to run the LAPACK testing.
- If you use the reference blas, you will not get any performance. On Mac, you can use the Veclib library instead (link with -framewok veclib)

Hope it helps
Julie

Re: LAPACK with Mac Xcode

PostPosted: Sun Jan 10, 2010 3:38 am
by khaled83
Hi Julie,

Thanks a lot for the quick reply.

I have regenerated the package using Unix makefile, but unfortunately still got the same problem.
However, I have found a LAPACK library that is generated as part of OpenCV 2, named libopencv_lapack.a, I have added it to my project instead in addition to Veclib library you mentioned (thanks for your comment about it), and I don't get that error any more. Insight3d project relies on OpenCV, so I think even if libopencv_lapack had limited functionality, it may be enough for this project.

Now I don't get complains in my project about LAPACK, however I get another linking error related to main again:

"_main", referenced from:
start in crt1.10.5.o
symbol(s) not found
collect2: ld returned 1 exit status


I'm not sure how to solve it yet. I think it's about application entry point now. May be there is something I should do in source code or configurations to compile and run source code project tested on Linux and Microsoft Visual C++ Express 2008 on a different OS and IDE, Mac OS and xCode. I'm figuring out this. May be this is out of the scope of this forum, but I would be glad if you have any idea.

Though my problem related to LAPACK should be solved now, if you have other recommendations to be able to compile and use LAPACK on Mac from original distribution clapack-3.2.1-CMAKE, I can try out to confirm library consistency with Mac and xCode.

Thanks for your help,
Khaled