dev-cafe / autocmake

CMake plugin composer.
http://autocmake.org
BSD 3-Clause "New" or "Revised" License
42 stars 18 forks source link

explicit libs example ? #165

Closed miroi closed 8 years ago

miroi commented 8 years ago

Hi,

I wanted explicit libraries to be passed to compiled objects.

I put into autocmake.cfg (after DIRAC autocmake.cfg)

[explicit]
docopt: --explicit-libs=<LIBS> Explicit linker specification for extra libraries passed directly to the linker [default: off].
define: '-DEXPLICIT_LIBS=%s' % arguments['--explicit-libs'].strip()

did setup

python setup --fc=gfortran --blas=off --lapack=off --explicit-libs="/u/milias/Work/qch/software/lapack/lapack-3.6.0/build/lib/liblapack.a  /u/milias/Work/qch/software/lapack/lapack-3.6.0/build/lib/libblas.a"  build_gfortran_lapack3.6.0

but the linking command is not complete:

/usr/bin/gfortran       -O3 -funroll-all-loops CMakeFiles/dsyerv_check.dir/dsyerv_check.F90.o CMakeFiles/dsyerv_check.dir/eispack.F.o  -o dsyerv_check -rdynamic /u/milias/Work/qch/software/lapack/lapack-3.6.0/build/lib/liblapack.a

The reason could be the python strip() command. Could we have an autocmake example of explicit libs adding ?

miroi commented 8 years ago

The problem is that explicit

[explicit]
docopt: --explicit-libs=<LIBS> Explicit linker specification for extra libraries passed directly to the linker [default: off].
define: '-DEXPLICIT_LIBS=%s' % arguments['--explicit-libs']

accepts only one string, we need more strings separated by blanks....

bast commented 8 years ago

I will try to fix that. But independently of this apparent issue why don't you include BLAS and LAPACK via --blas and --lapack?

miroi commented 8 years ago

Hi,

I was testing fresh lapack3.6.0, https://github.com/miroi/lapack-dsyevr-test

python setup --fc=ifort --blas=off --lapack=off --cmake-options="-D EXPLICIT_LIBS='-L/u/milias/Work/qch/software/lapack/lapack-3.6.0/build/lib -llapack -lblas -lgfortran'"  build_ifort_lapack3.6.0

I don't know if ot works to include both blas+lapack viac --blas/--lapack for such a package...

bast commented 8 years ago

Well ideally it should work and if it does not, we need to fix it. It is otherwise unnatural to include BLAS and LAPACK using --blas=off --lapack=off. But independently I will try to fix the --explicit-libs issue.

bast commented 8 years ago

There is no explicit libs module in Autocmake. This is not an Autocmake issue. Probably a DIRAC issue. Closing.

miroi commented 8 years ago

Yes,it's rather DIRAC support. Also, would be good to extend the autocmake documentation on it...

bast commented 8 years ago

Extend the Autocmake documentation on what?

miroi commented 8 years ago

....on adding the explicit libs as I did, via _--cmake-options="-D EXPLICITLIBS='-L/u ...

bast commented 8 years ago

You mean documentation on --cmake-options? Autocmake knows nothing about EXPLICIT_LIBS. Please try to keep these things separated.

miroi commented 8 years ago

I would add an example (or test) to autocmake on how to include standalone math libraries. This has to do with math library search when math libs are on 'non-standard' positions (like user downloaded packages).

bast commented 8 years ago

Good idea on such doc. I will open a new issue on that. This one is closed now.

miroi commented 8 years ago

...and please, Rado, would you improve EXPLICIT_LIBS usage in Dirac to that it can include more than one string ?

bast commented 8 years ago

This is not the right place to discuss DIRAC issues. Open an issue there, mention me, and then we see what we can do about it.