> On 27 Jun 2024, at 17:36, Ileana Dumitrescu <ileanadumitresc...@gmail.com> 
> wrote:
> 
> On 26/06/2024 10:21, Shterenlikht, Anton wrote:
>> Please help understand and fix this problem:
>> libtool: link: ftn -shared   <skip files>  -soname libxxx.so.0 -o 
>> .libs/libxxx.so.0.0.0
>> clang-16: error: unknown argument: '-soname'
>> which comes from my compiler wrapper not recognised.
> 
> Sorry for missing your earlier response. To set 'wl' for
> flang, armflang, flang-new, and ftn, the following patch
> should work:
> 
> --- a/m4/libtool.m4
> +++ b/m4/libtool.m4
> @@@ -4805,7 -4805,7 +4805,7 @@@ m4_if([$1], [CXX],
>        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
>        _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
>          ;;
> --      *flang)
> ++      *flang* | ftn*)
>          # Flang compiler.
>        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
>        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
> 
> Could you test this again in your environment?

That's what I tried before, but it does not help.

If I clone with: git clone https://git.savannah.gnu.org/git/libtool.git
I get different line numbers:

% git diff
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index bbf2d21f..8ec0be58 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -4706,7 +4706,7 @@ m4_if([$1], [CXX], [
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
         ;;
-      *flang)
+      *flang* | ftn)
         # Flang compiler.
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'

Am I on the right branch?

With that patch I get in share/aclocal/libtool.m4

4701     linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
4702       case $cc_basename in
4703       # old Intel for x86_64, which still supported -KPIC.
4704       ecc*)
4705         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4706         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
4707         _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4708         ;;
4709       *flang* | ftn)
4710         # Flang compiler.
4711         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4712         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4713         _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
4714         ;;

However, this does not help.
I still get in my project libtool:


# A language specific compiler.
CC="ftn"

# Is the compiler the GNU compiler?
with_gcc=no

# Compiler flag to turn off builtin functions.
no_builtin_flag=""

# Additional compiler flags for building library objects.
pic_flag=""

# How to pass a linker flag through the compiler.
wl=""


I wonder if flang/ftn is applied in the right place in m4/libtool.m4.
Or maybe has to be applied in several places.

Other compilers appear multiple times, e.g. nagfor:

% grep -nC1 icc m4/libtool.m4
4714-        ;;
4715:      # icc used to be incompatible with GCC.
4716-      # ICC 10 doesn't accept -KPIC any more.
4717:      icc* | ifort*)
4718- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
--
5217-   tmp_addflag=' $pic_flag -Mnomain' ;;
5218: ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
5219-   tmp_addflag=' -i_dynamic' ;;
ashterenli@NB-068 libtool % grep -nC1 nagfor m4/libtool.m4
1117-  case $cc_basename in
1118:     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
1119-     *) _lt_dar_can_shared=$GCC ;;
--
4657-      case $cc_basename in
4658:      nagfor*)
4659-        # NAG Fortran compiler
--
4727- ;;
4728:      nagfor*)
4729- # NAG Fortran compiler
--
5226-   tmp_sharedflag='--shared' ;;
5227:        nagfor*)                        # NAGFOR 5.3
5228-          tmp_sharedflag='-Wl,-shared' ;;



or ifort:


% grep -nC1 ifort m4/libtool.m4
1117-  case $cc_basename in
1118:     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
1119-     *) _lt_dar_can_shared=$GCC ;;
--
4716-      # ICC 10 doesn't accept -KPIC any more.
4717:      icc* | ifort*)
4718- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
--
5219-   tmp_addflag=' -i_dynamic' ;;
5220: efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
5221-   tmp_addflag=' -i_dynamic -nofor_main' ;;
5222: ifc* | ifort*) # Intel Fortran compiler
5223-   tmp_addflag=' -nofor_main' ;;

Thank you

Anton



Reply via email to