Author Topic: How to configure Lapack external libraries with C::B  (Read 12007 times)

Offline asd34

  • Multiple posting newcomer
  • *
  • Posts: 27
How to configure Lapack external libraries with C::B
« 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/

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,


Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: How to configure Lapack external libraries with C::B
« Reply #1 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.

Offline asd34

  • Multiple posting newcomer
  • *
  • Posts: 27
Re: How to configure Lapack external libraries with C::B
« Reply #2 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,

Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: How to configure Lapack external libraries with C::B
« Reply #3 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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline asd34

  • Multiple posting newcomer
  • *
  • Posts: 27
Re: How to configure Lapack external libraries with C::B
« Reply #5 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to configure Lapack external libraries with C::B
« Reply #6 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_'" ...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: How to configure Lapack external libraries with C::B
« Reply #7 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.
Regards,
xunxun