Mangling of FORTRAN symbols

Asked by Paolo Crosetto

Dear developers,

I still have some problems when linking BLAS, due to the mangling: my compiler looks for a symbol like "zgesdd_", while the symbol defined in the library is "zgesdd", without underscore. Is there a way for specifying the mangling of F77 symblos from CMake? (like some preprocessor variable, F77_BLAS_MANGLE ....)
Thank you, and sorry for asking so many questions....

Paolo

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Paolo Crosetto
Solved:
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

GCC has the option -fno-underscoring, but I don't know if your compiler has a similar option.

Revision history for this message
Garth Wells (garth-wells) said :
#2

I haven't see a name mangling problem for so long I thought that it was a thing of the past!

I would have thought that if you're using the system compilers and the systems BLAS, then things should take care of themselves. There is a CMake module

   FortranCInterface.cmake

but it looks very technical.

Revision history for this message
Paolo Crosetto (p-crosetto) said :
#3

Hi!
Thanks for your answers, I solved the problem: it is Armadillo which is adding by default the underscores. To disable it there is a preprocessor constant which is called "ARMA_BLAS_UNDERSCORE", which can be modified in the config.hpp file. This fix is dirty because config.hpp is automatically generated by CMake, but I didn´t find CMake variables that allow to undefine this ARMA_BLAS_UNDERSCORE from a CMake script.
Anyway this solved the mangling problem.

Revision history for this message
Garth Wells (garth-wells) said :
#4

Could you try changing

   set(ARMA_USE_WRAPPER true )

to

   set(ARMA_USE_WRAPPER false )

in the Armadillo CMakeLists.txt file? I have never succeeded in building Armadillo and linking to it from DOLFIN without making this change.