bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoid gawkextlib as a separate shared library


From: Manuel Collado
Subject: Re: Avoid gawkextlib as a separate shared library
Date: Wed, 18 May 2022 23:54:19 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

Apologies for this long post. Hope not be wasting your time.

Eli, thanks for your advices. I'm really interested in diagnosing the link issue.

El 18/05/2022 a las 18:16, Eli Zaretskii escribió:
Cc: arnold@skeeve.com, eliz@gnu.org, bug-gawk@gnu.org
From: Manuel Collado <mcollado2011@gmail.com>
Date: Wed, 18 May 2022 17:54:22 +0200

I've revised what I did last year. The issue seems to be that the gcc
linker of my installed MinGW distribution needs access to both
gawkextlib-0.dll and libgawkextlib.dll.a.

How can this be?

Don't know. I'm also puzzled by the build failure.


What version of ld do you have there?  What does "ld --version"
display?

$ ld --version
GNU ld (GNU Binutils) 2.32

 Can you show the output of the gawk-mpfr linking command, if
you add the -v switch to its command line, and remove the DLL from the
lib/ directory, leaving there only the import library?

Don't know how to add the -v switch. The linker is invoked by libtool.

Attached is a copy of the console output from a direct attempt to build gawk-mpfr. The starting point is a c:\gnu tree with gawk and gawkextlib installed.

Here is an excerpt. The full log is attached as a text file.

-- Unpack the gawk-mpfr tarball:

mcollado@PC6 /c/Temp/gawextlib-mingw
$ tar zxvf gawk-mpfr-1.1.0.tar.gz
gawk-mpfr-1.1.0/
....
mcollado@PC6 /c/Temp/gawextlib-mingw
$ cd gawk-mpfr-1.1.0


--Verify the content of the install dir:

mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ ls -l /c/gnu/bin
total 18779
-rwxr-xr-x 1 mcollado Administradores 6476300 May  7  2021 awk.exe
-rwxr-xr-x 1 mcollado Administradores 6794462 May 11  2021 gawk.exe
-rwxr-xr-x 1 mcollado Administradores    1632 May  7  2021 igawk
-rwxr-xr-x 1 mcollado Administradores      36 May  7  2021 igawk.bat
-rw-r--r-- 1 mcollado Administradores    1670 May  7  2021 igawk.cmd
-rwxr-xr-x 1 mcollado Administradores 242747 May 16 15:30 libgawkextlib-0.dll -rwxr-xr-x 1 mcollado Administradores 1036415 May 7 2021 libgcc_s_dw2-1.dll
-rwxr-xr-x 1 mcollado Administradores 1415068 May  7  2021 libiconv-2.dll
-rwxr-xr-x 1 mcollado Administradores  484613 Apr 30  2014 libintl-8.dll
-rwxr-xr-x 1 mcollado Administradores 2770620 May  7  2021 libmpfr-6.dll

mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ ls -l /c/gnu/lib
total 10
drwxr-xr-x 2 mcollado Administradores 4096 May  7  2021 gawk
-rw-r--r-- 1 mcollado Administradores 5454 May 16 15:30 libgawkextlib.dll.a

mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ ls -l /c/gnu/include
total 45
-rw-r--r-- 1 mcollado Administradores 40645 May  7  2021 gawkapi.h
-rw-r--r-- 1 mcollado Administradores  4494 May 16 15:30 gawkextlib.h


-- First attempt to build gawk-mpfr ===>> FAIL

mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ ./configure --prefix=/c/gnu --with-gawk=/c/gnu --with-gawkextlib=/c/gnu
...
checking for ld used by GCC... c:/mingw/mingw32/bin/ld.exe
checking if the linker (c:/mingw/mingw32/bin/ld.exe) is GNU ld... yes
...
checking whether the gcc linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries... yes
...
mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ make
make  all-recursive
...
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -Wall -Wextra -Wpointer-arith -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wshadow -module -avoid-version -no-undefined -L/c/gnu/lib -L/c/gnu/lib -o mpfr.la -rpath /c/gnu/lib/gawk mpfr.lo -lmpfr -lgmp -lgawkextlib -lintl

*** Warning: linker path does not have real file for library -lgawkextlib.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libgawkextlib and none of the candidates passed a file format test
*** using a file magic. Last file checked: /c/gnu/lib/libgawkextlib.dll.a

*** Warning: libtool could not satisfy all declared inter-library
*** dependencies of module mpfr.  Therefore, libtool will create
*** a static module, that should work as long as the dlopening
*** application is linked with the -dlopen flag.
libtool: link: ar cru .libs/mpfr.a .libs/mpfr.o
libtool: link: ranlib .libs/mpfr.a
libtool: link: ( cd ".libs" && rm -f "mpfr.la" && cp -pR "../mpfr.la" "mpfr.la" )
make[2]: Leaving directory `/c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0'
make[1]: Leaving directory `/c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0'


-- Dirty hack: copy libgawkextlib-0.dll to c:\gnu\lib.
Please note that the build succeeds also by adding -L/c/gnu/bin to the link flags in addition to -L/c/gnu/lib, instead of copying the DLL file.

mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ cp /c/gnu/bin/libgawkextlib-0.dll /c/gnu/lib


-- New attempt to build ===> SUCCESS

mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ make clean
...
make[1]: Entering directory `/c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0'
rm -rf .libs _libs
test -z "mpfr.la" || rm -f mpfr.la
rm -f ./so_locations
rm -f *.o
rm -f *.lo
make[1]: Leaving directory `/c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0'

mcollado@PC6 /c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0
$ make
make  all-recursive
...
make[2]: Entering directory `/c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0'
...
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -Wall -Wextra -Wpointer-arith -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wshadow -module -avoid-version -no-undefined -L/c/gnu/lib -L/c/gnu/lib -o mpfr.la -rpath /c/gnu/lib/gawk mpfr.lo -lmpfr -lgmp -lgawkextlib -lintl libtool: link: gcc -shared .libs/mpfr.o -L/c/gnu/lib -lmpfr -lgmp -lgawkextlib -lintl -g -O2 -o .libs/mpfr.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/mpfr.dll.a libtool: link: ( cd ".libs" && rm -f "mpfr.la" && cp -pR "../mpfr.la" "mpfr.la" )
make[2]: Leaving directory `/c/Temp/gawextlib-mingw/gawk-mpfr-1.1.0'


Also, can you verify that the input library is valid: not an empty
file, in the ar format, and that it includes the __imp__* symbols as
an import library should?  (I suggest to use "nm -A" to see that.)

It looks ok.


And finally, what does the command below show?

   nm -A path/to/lib/libgawkextlib.dll.a | fgrep -i .dll

mcollado@PC6 /c/gnu/lib
$ nm -A libgawkextlib.dll.a | fgrep -i .dll
libgawkextlib.dll.a:d000008.o:00000000 i .idata$4
libgawkextlib.dll.a:d000008.o:00000000 i .idata$5
libgawkextlib.dll.a:d000008.o:00000000 i .idata$7
libgawkextlib.dll.a:d000008.o:00000000 I _libgawkextlib_0_dll_iname
libgawkextlib.dll.a:d000000.o:00000000 i .idata$2
libgawkextlib.dll.a:d000000.o:00000000 i .idata$4
libgawkextlib.dll.a:d000000.o:00000000 i .idata$5
libgawkextlib.dll.a:d000000.o:00000000 I __head_libgawkextlib_0_dll
libgawkextlib.dll.a:d000000.o:         U _libgawkextlib_0_dll_iname
libgawkextlib.dll.a:d000007.o:00000000 i .idata$4
libgawkextlib.dll.a:d000007.o:00000000 i .idata$5
libgawkextlib.dll.a:d000007.o:00000000 i .idata$6
libgawkextlib.dll.a:d000007.o:00000000 i .idata$7
libgawkextlib.dll.a:d000007.o:00000000 t .text
libgawkextlib.dll.a:d000007.o:00000001 a @feat.00
libgawkextlib.dll.a:d000007.o:         U __head_libgawkextlib_0_dll
libgawkextlib.dll.a:d000007.o:00000000 I __imp__strhash_get
libgawkextlib.dll.a:d000007.o:00000000 T _strhash_get
libgawkextlib.dll.a:d000006.o:00000000 i .idata$4
libgawkextlib.dll.a:d000006.o:00000000 i .idata$5
libgawkextlib.dll.a:d000006.o:00000000 i .idata$6
libgawkextlib.dll.a:d000006.o:00000000 i .idata$7
libgawkextlib.dll.a:d000006.o:00000000 t .text
libgawkextlib.dll.a:d000006.o:00000001 a @feat.00
libgawkextlib.dll.a:d000006.o:         U __head_libgawkextlib_0_dll
libgawkextlib.dll.a:d000006.o:00000000 I __imp__strhash_destroy
libgawkextlib.dll.a:d000006.o:00000000 T _strhash_destroy
libgawkextlib.dll.a:d000005.o:00000000 i .idata$4
[...]


Btw, the DLL on my system is called libgawkextlib-0.dll, not
gawkextlib-0.dll.  Could this be part of this puzzle?

My mistake. It is libgawkextlib-0.dll, of course.

What else can I do to diagnose the issue?

Thank you very much. Regards.
--
Manuel Collado - http://mcollado.z15.es

Attachment: gawk-mpfr.log
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]