Re: armflang: error: unknown argument: '-soname'

Anthony Scemama <[email protected]>
Newsgroups gmane.comp.sysutils.automake.general
Organization CNRS
Message-ID <3fb5c87d9a82e36d241ca1c80e99686161023d27.camel@irsamc.ups-tlse.fr>
Dear Anton,

here is a patch for libtool that Francois Coppens and I submitted to
libtool in February. I think we did something went wrong in the PR
process because it has still not been included... Maybe you can submit
it again to the libtool team, it is not a big change and it is quite
important for us too to have this patch included.

best,

Anthony


$ git diff 1ec8fa28dcb29500d485c136db28315671ec4c3b
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 79a2451e..df1a7860 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -4719,6 +4719,12 @@ m4_if([$1], [CXX], [
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
         ;;
+      # ARM flang
+      armflang*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
       # Lahey Fortran 8.1.
       lf95*)
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'





On Fri, 2023-10-20 at 10:47 +0000, Shterenlikht, Anton wrote:
> This seems like an automake issue, not libtool.
> 
> The libtool produced by running configure has:
> 
> 11661 # ### BEGIN LIBTOOL TAG CONFIG: FC
> 11662 
> 11663 # The linker used to build libraries.
> 11664 LD="<some path>/arm-compiler-for-linux_23.10_AmazonLinux-2/gcc-
> 12.2.0_AmazonLinux-2/aarch64-linux-gnu/bin/ld"
> 11665 
> 11666 # How to create reloadable object files.
> 11667 reload_flag=" -r"
> 11668 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
> 11669 
> 11670 # Commands used to build an old-style archive.
> 11671 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB
> \$tool_oldlib"
> 11672 
> 11673 # A language specific compiler.
> 11674 CC="armflang"
> 11675 
> 11676 # Is the compiler the GNU compiler?
> 11677 with_gcc=no
> 11678 
> 11679 # Compiler flag to turn off builtin functions.
> 11680 no_builtin_flag=""
> 11681 
> 11682 # Additional compiler flags for building library objects.
> 11683 pic_flag=""
> 11684 
> 11685 # How to pass a linker flag through the compiler.
> 11686 wl=""
> 
> Note that wl= is emtpy.
> 
> Compare with the portion of this file for C compiler:
> 
>   317 # A language specific compiler.
>   318 CC="mpicc"
>   319 
>   320 # Is the compiler the GNU compiler?
>   321 with_gcc=yes
>   322 
>   323 # Compiler flag to turn off builtin functions.
>   324 no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions"
>   325 
>   326 # Additional compiler flags for building library objects.
>   327 pic_flag=" -fPIC -DPIC"
>   328 
>   329 # How to pass a linker flag through the compiler.
>   330 wl="-Wl,"
> 
> 
> This simple patch works:
> 
> sed -i 's|wl=""|wl="-Wl,"|' libtool
> 
> and gives:
> 
> libtool: link: armflang -shared   <some *.o files>    -g -fopenmp
> -mcpu=neoverse-512tvb -march=armv8.4-a+sve   -fopenmp -Wl,-soname
> -Wl,libp2.so.0 -o .libs/libp2.so.0.0.0
> 
> However, this crude hack will not work with "make distcheck",
> because it will generate a new libtool.
> 
> Still, I'm trying to understand if this is a bug in autotools,
> and if there is a workaround via edits in configure.ac and/or
> Makefile.am.
> 
> Thank you
> 
> Anton
> 
> > On 20 Oct 2023, at 08:40, Shterenlikht, Anton <
> > [email protected]> wrote:
> > 
> > [also posted in [email protected]]
> > 
> > Please help me understand how to deal correctly with this error:
> > 
> > libtool: link: armflang -shared   <some *.o files>     -g   -soname 
> > libp2.so.0 -o .libs/libp2.so.0.0.0
> > armflang: error: unknown argument: '-soname'
> > 
> > 
> > I see this issue mentioned in multiple places, e.g:
> > 
> > https://github.com/HDFGroup/hdf5/issues/366
> > 
> > with the solution that "-Wl," must be prepended somehow to "-
> > soname".
> > 
> > But I'm not sure what changes I need to do
> > to my configure.ac and/or Makefile.am
> > to fix this correctly.
> > 
> > For comparison, here's how the same line looks like when
> > I use gfortran:
> > 
> > libtool: link: gfortran -shared  -fPIC  <some *.o files>    -g
> > -O2   -Wl,-soname -Wl,libp2.so.0 -o .libs/libp2.so.0.0.0
> > 
> > 
> > Thank you
> > 
> > Anton
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.