Re: [R-pkg-devel] Package Load fails to find 3rd Party DLL

2023-07-17 Thread Russell Almond

Okay,  I've changed my Makevars.win so that it has:

PKG_LIBS = -L. -L${NETICA_LIB} -lNetica

and

all: NeticaDLL

where ${NETICA_LIB} is set to the appropriate lib subdirectory of the 
unpacked sources.  I'm no longer getting the nm.exe error, so it may be 
a bug in ld.exe.



| gcc -shared -s -static-libgcc -o RNetica.dll tmp.def Cases.o 
Continuous.o Edges.o Experience.o Inference.o Networks.o Node.o Random.o 
Registration.o Session.o -L. 
-L/c/Users/ralmond/Projects/RNetica/src/Netica/Netica_API_510/lib64 
-lNetica -LC:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 
-LC:/rtools43/x86_64-w64-mingw32.static.posix/lib 
-LC:/PROGRA~1/R/R-43~1.1/bin/x64 -lR
| C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: internal 
error: aborting at ../../binutils-2.40/ld/ldlang.c:527 in compare_section
| C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: please report 
this bug

| collect2.exe: error: ld returned 1 exit status

However, when I manually moved Netica.dll to the source directory, and 
removed NETICA_LIB from the path, it compiled correctly.


So, I'm guessing this is a bug in ld.exe, and in fact it is here:
https://github.com/msys2/MINGW-packages/issues/15469

So I'll see if I can try to fix my script to only copy the .dll and not 
the .lib.

--Russell


On 7/17/23 5:30 AM, Ivan Krylov wrote:

В Fri, 14 Jul 2023 22:25:51 +0300
Ivan Krylov  пишет:


Maybe it's a red herring. Maybe the message from nm about missing file
has always been harmless, and what we're seeing here is a bug in the
toolchain; perhaps ld.exe doesn't like something about Netica.lib so
much that it crashes. I think that's less likely. If you run the
commands manually but without mentioning NeticaDLL, do you get a DLL
in the end?


Judging by your build logs, this could be a toolchain bug. If you set
the *.lib file aside and only give the *.dll to the linker (using
-l:Netica.dll if necessary), does it still fail? I know that GCC can
link directly to *.dll files, without relying on import libraries.



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Package Load fails to find 3rd Party DLL

2023-07-17 Thread Russell Almond
Thanks for the suggestion.  In previous versions of the build tools, I 
know I needed the .lib files.


I'm also not sure I'm copying the DLL files into the right directory, so 
that maybe the linker isn't seeing it.  This always confuses me as the 
location used to build and compile is (potentially) different from the 
test location and the final build location, and I'm not sure of the best 
way to refer to these directories in my script.  I'm thinking maybe I 
need to copy the DLL into the src directory.


Unfortunately, I don't have a windows box on which to easily test.  I'm 
trying to get a virtualBox setup working so I can test more quickly.


  --Russell


On 7/17/23 5:30 AM, Ivan Krylov wrote:

В Fri, 14 Jul 2023 22:25:51 +0300
Ivan Krylov  пишет:


Maybe it's a red herring. Maybe the message from nm about missing file
has always been harmless, and what we're seeing here is a bug in the
toolchain; perhaps ld.exe doesn't like something about Netica.lib so
much that it crashes. I think that's less likely. If you run the
commands manually but without mentioning NeticaDLL, do you get a DLL
in the end?


Judging by your build logs, this could be a toolchain bug. If you set
the *.lib file aside and only give the *.dll to the linker (using
-l:Netica.dll if necessary), does it still fail? I know that GCC can
link directly to *.dll files, without relying on import libraries.



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Package Load fails to find 3rd Party DLL

2023-07-17 Thread Ivan Krylov
В Fri, 14 Jul 2023 22:25:51 +0300
Ivan Krylov  пишет:

> Maybe it's a red herring. Maybe the message from nm about missing file
> has always been harmless, and what we're seeing here is a bug in the
> toolchain; perhaps ld.exe doesn't like something about Netica.lib so
> much that it crashes. I think that's less likely. If you run the
> commands manually but without mentioning NeticaDLL, do you get a DLL
> in the end?

Judging by your build logs, this could be a toolchain bug. If you set
the *.lib file aside and only give the *.dll to the linker (using
-l:Netica.dll if necessary), does it still fail? I know that GCC can
link directly to *.dll files, without relying on import libraries.

-- 
Best regards,
Ivan

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel