Page 1 of 1

clapack shared dynamic library through cmake

PostPosted: Sat Jan 30, 2010 12:40 pm
by georgiuk
So I would like to build a shared library of clapack through cmake. What is the prcedure?

When I put SET(BUILD_SHARED_LIBS ON) to CMakeLists.txt i run cmake . and then make, I get an error
.....
[ 5%] Building C object F2CLIBS/libf2c/CMakeFiles/f2c.dir/etime_.c.o
Linking C shared library libf2c.dylib
Undefined symbols:
"_MAIN__", referenced from:
_main in main.c.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [F2CLIBS/libf2c/libf2c.dylib] Error 1
make[1]: *** [F2CLIBS/libf2c/CMakeFiles/f2c.dir/all] Error 2
make: *** [all] Error 2

I run it on osx snow leopard and I have installed gfortran and f2c from http://www.webmo.net/support/fortran_osx.html

Any ideas?

Best Regards,
Kostas

Re: clapack shared dynamic library through cmake

PostPosted: Sun Jan 31, 2010 12:22 pm
by georgiuk
i found a sort of solution for mac osx
adding this to CMakeLists.txt
IF(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
ENDIF(APPLE)

I don't know if it is ok or not

What do you think?

Also if somehow setting a command line option with -DVARIABLE:TYPE=VALUE could set the
SET(BUILD_SHARED_LIBS ON)
and then some if-else checking this variable and customizing depending on platform (as above)

Re: clapack shared dynamic library through cmake

PostPosted: Mon Aug 16, 2010 7:55 pm
by ChimpGames
georgiuk,

Looking over this code, that should work. Have you tried it out and if so, what results did you get back?
There is a cli option with the DVARIABLE:TYPE=VALUE but i don't have the syntax off hand.

Reguards