Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: asd34 on June 03, 2012, 11:53:54 am

Title: How to configure Lapack external libraries with C::B
Post by: asd34 on June 03, 2012, 11:53:54 am
hi all,

I'm new to the C:B enviroment. I wish to use the lapack libraries in the C::B IDE. Allthough I've managed to accurately configure the compiler and linker for gfortran. I couldn't figure out how to set up properly the external fortran libraries in Ide. I followed the guidance given in that link http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/ (http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/)

I set search directories, and compiler and linker libraries carefully under compiler debugger options, but it seems the program still coudn't locate the libraries and complains the "undefined reference to ......" I also set the path variable in the enviromental settings to point to the correct directory where required libraries resides but with no success.

What am I doing wrong?

Regards,

Title: Re: How to configure Lapack external libraries with C::B
Post by: Freem on June 05, 2012, 10:38:10 pm
We could have some use of the compile logs.
Especially the command used to link which is inside it.

In fact, we can do nothing without it. And it is highly probable that you could just look at it to find yourself the problem and fix it, in fact.
Title: Re: How to configure Lapack external libraries with C::B
Post by: asd34 on June 06, 2012, 11:06:04 am
Thanks for commenting ,
here is the log. but that doesn't ring any bell for me .
Everything that I know which malfunctioning is there, but don't know how to fix it.

The complained routines are missign subroutines, they reside in the blas.lib and lapack.lib static libraries.
I've added and specified directories conatining them properly but still doesn't work for me?

||=== Fort_empty, Debug ===|
obj\Debug\main_fort.o||In function `my':|
...Fort_empty\main_fort.f90|72|undefined reference to `dlansy_'|
...Fort_empty\main_fort.f90|73|undefined reference to `dlansy_'|
...Fort_empty\main_fort.f90|82|undefined reference to `dsygv_'|
...Fort_empty\main_fort.f90|104|undefined reference to `x04caf_'|
...Fort_empty\main_fort.f90|110|undefined reference to `dtrcon_'|
...Fort_empty\main_fort.f90|124|undefined reference to `dlamch_'|
...Fort_empty\main_fort.f90|130|undefined reference to `ddisna_'|
||=== Build finished: 7 errors, 0 warnings ===|

Regards,
Title: Re: How to configure Lapack external libraries with C::B
Post by: Freem on June 06, 2012, 12:24:00 pm
Please enable the full log:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Full log is verbose enough to give you hints about what is the problem.

And, I did not know that this FAQ exists but it could help you too: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
Title: Re: How to configure Lapack external libraries with C::B
Post by: stahta01 on June 06, 2012, 04:03:47 pm
If the above two links do not fix the problem read this one.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F)

Tim S.
Title: Re: How to configure Lapack external libraries with C::B
Post by: asd34 on June 06, 2012, 06:44:17 pm
thanks for helping,

I deliberately followed the links you provided, putting IDE into verbose mode did helped me, but didn't solve the problem in overall.
I even tried to change the dependency in under the Project>Properties>Build Target>Dependencies without success.

Here is the verbose output.

gfortran.exe -LE:\TEST_FOLDER\lapack_lib -LE:\TEST_FOLDER\lapack_lib\ -LE:\TEST_FOLDER\lapack_lib\ -LE:\TEST_FOLDER\lapack_lib -LE:\TEST_FOLDER\lapack_lib\ -LE:\TEST_FOLDER\lapack_lib -o bin\Debug\Fort_empty.exe obj\Debug\main_fort.o E:\TEST_FOLDER\lapack_lib\blasd.lib E:\TEST_FOLDER\lapack_lib\extrasd.lib E:\TEST_FOLDER\lapack_lib\lapack.lib E:\TEST_FOLDER\lapack_lib\lapack.lib E:\TEST_FOLDER\lapack_lib\blas.lib E:\TEST_FOLDER\lapack_lib\blas.lib E:\TEST_FOLDER\lapack_lib\lapack.lib
obj\Debug\main_fort.o: In function `my':
.../CB Projects/Fort_empty/main_fort.f90:72: undefined reference to `dlansy_'
.../CB Projects/Fort_empty/main_fort.f90:73: undefined reference to `dlansy_'
.../CB Projects/Fort_empty/main_fort.f90:82: undefined reference to `dsygv_'
.../CB Projects/Fort_empty/main_fort.f90:104: undefined reference to `x04caf_'
.../CB Projects/Fort_empty/main_fort.f90:110: undefined reference to `dtrcon_'
.../CB Projects/Fort_empty/main_fort.f90:124: undefined reference to `dlamch_'
.../CB Projects/Fort_empty/main_fort.f90:130: undefined reference to `ddisna_'
collect2: ld returned 1 exit status

What really am I doing wrong?
Title: Re: How to configure Lapack external libraries with C::B
Post by: oBFusCATed on June 06, 2012, 07:16:16 pm
What really am I doing wrong?
You're not searching the internet using part of the error message, like searching for "undefined reference to `dlansy_'" ...
Title: Re: How to configure Lapack external libraries with C::B
Post by: xunxun on June 06, 2012, 07:55:01 pm
Please note, which compiler is your lapack.lib/blas.lib built?
If lapack.lib/blas.lib is built using intel compiler, there will be a capital symbol for this.

So there will be no dlansy_, and there will be only "DLANSY"

To solve the issue, you can rebuild lapack using gfortran.
Or using Fortran 2003 ISO_C_BINDING Module to change the symbol.