Hi Alberto,

So, if I understand correctly, you've made modifications to the 
CMakeLists.txt that governs your modified example problem as opposed to 
linking deal.II itself directly to Lapack. I would say that the most simple 
(although time-consuming) way to get the correct linker line would be to 
build deal.II with Lapack enabled. You can do this my adding the following 
lines to the configuration line for deal.II:
cmake -DDEAL_II_WITH_LAPACK:BOOL=ON -DLAPACK_DIR=/path/to/lapack etc...
Then every time that you link against the deal.II library, it will 
automatically link against LAPACK.

Otherwise if you're really prefer to keep it local to your project then 
you'd best do it by adding a cmake module such as this one 
<https://github.com/Kitware/CMake/blob/master/Modules/FindLAPACK.cmake>. 
These will help you include all of the header files into your project that 
you need to, as well as correctly link the LAPACK library (and any of its 
dependencies) itself. 

I hope that this helps you.

Best regards,
Jean-Paul


On Monday, March 27, 2017 at 4:07:17 PM UTC+2, Alberto Salvadori wrote:
>
> Hi,
>
>
> I appreciate any help on the issue below.
>
>
> Moving from step-17 and step-18, I have been developing a non linear 
> solver for mechanical problems. It is a way to learn about deal.II rather 
> than else. Conceptually it is rather simple, I have implemented some 
> material model drivers (as J2 plasticity, for instance ) and a 
> Newton-Raphson scheme. 
>
>
> In my material model however, I am using lapack (specifically lapacke or 
> mkl). It turned out that I am not sufficiently skilled to modify the cmake 
> file in order to link deal.II with those libraries. I wonder if anyone can 
> provide some help.
>
> The error reads as follows:
>
>
> [ 22%] *Linking CXX executable step-18*
>
> Undefined symbols for architecture x86_64:
>
>   "_LAPACKE_dgesv", referenced from:
>
>       ttl::lib::solve_impl<ttl::expressions::Bind<ttl::Tensor<4, 2, 
> double> const&, std::__1::tuple<ttl::Index<(char)4>, ttl::Index<(char)3>, 
> ttl::Index<(char)2>, ttl::Index<(char)1> > >, 
> ttl::expressions::Bind<ttl::Tensor<2, 2, double> const&, 
> std::__1::tuple<ttl::Index<(char)2>, ttl::Index<(char)1> > >, 
> 4>::op(ttl::expressions::Bind<ttl::Tensor<4, 2, double> const&, 
> std::__1::tuple<ttl::Index<(char)4>, ttl::Index<(char)3>, 
> ttl::Index<(char)2>, ttl::Index<(char)1> > >, 
> ttl::expressions::Bind<ttl::Tensor<2, 2, double> const&, 
> std::__1::tuple<ttl::Index<(char)2>, ttl::Index<(char)1> > >) in 
> step-18.cc.o
>
>   "_LAPACKE_dgetrf", referenced from:
>
>       int ttl::lib::inverse_impl<ttl::expressions::Bind<ttl::Tensor<4, 2, 
> double> const&, std::__1::tuple<ttl::Index<(char)4>, ttl::Index<(char)3>, 
> ttl::Index<(char)2>, ttl::Index<(char)1> > >, 4>::op<ttl::Tensor<4, 2, 
> double> >(ttl::expressions::Bind<ttl::Tensor<4, 2, double> const&, 
> std::__1::tuple<ttl::Index<(char)4>, ttl::Index<(char)3>, 
> ttl::Index<(char)2>, ttl::Index<(char)1> > >, ttl::Tensor<4, 2, double>&) 
> in step-18.cc.o
>
>   "_LAPACKE_dgetri", referenced from:
>
>       int ttl::lib::inverse_impl<ttl::expressions::Bind<ttl::Tensor<4, 2, 
> double> const&, std::__1::tuple<ttl::Index<(char)4>, ttl::Index<(char)3>, 
> ttl::Index<(char)2>, ttl::Index<(char)1> > >, 4>::op<ttl::Tensor<4, 2, 
> double> >(ttl::expressions::Bind<ttl::Tensor<4, 2, double> const&, 
> std::__1::tuple<ttl::Index<(char)4>, ttl::Index<(char)3>, 
> ttl::Index<(char)2>, ttl::Index<(char)1> > >, ttl::Tensor<4, 2, double>&) 
> in step-18.cc.o
>
> ld: symbol(s) not found for architecture x86_64
>
> clang: *error: *linker command failed with exit code 1 (use -v to see 
> invocation)
>
> make[6]: *** [step-18] Error 1
>
> make[5]: *** [CMakeFiles/step-18.dir/all] Error 2
>
> make[4]: *** [all] Error 2
>
> make[3]: *** [CMakeFiles/release] Error 2
>
> make[2]: *** [CMakeFiles/release.dir/all] Error 2
>
> make[1]: *** [CMakeFiles/release.dir/rule] Error 2
>
> make: *** [release] Error 2
>
> after slight modifications of the cmakelist.txt file (adding the new 
> source files, basically).
>
>
> By the way, I was able to link libraries to deal.II within Xcode and it 
> worked out well.
>
>
> Thanks
>
> Alberto
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to