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

Russell Almond ru@@e||@g@@|mond @end|ng |rom gm@||@com
Wed Jul 12 15:41:11 CEST 2023


I have an R package (RNetica available at 
https://ralmond.r-universe.dev/RNetica and 
https://github.com/ralmond/RNetica) which links to a 3rd party library 
Netica.dll, so RNetica.dll (built from my C code) calls the 3rd party code.

The config.win script downloads Netica.dll and moves it into the 
libs/x64 directory, where it should get loaded when RNetica.dll is 
loaded.  However this is not happening:

Here is the relevant portion of the build log (build is on R-universe, 
but I think it is the same script as CRAN):

```

cp 
"/d/a/ralmond/ralmond/RNETIC~1.RCH/00_PKG~1/RNetica/src/Netica/Netica_API_5
10/lib64/Netica.dll" 
"D:/a/ralmond/ralmond/RNetica.Rcheck/00LOCK-RNetica/00new/R
Netica/libs/x64"
   cp 
"/d/a/ralmond/ralmond/RNETIC~1.RCH/00_PKG~1/RNetica/src/Netica/Netica_API_5
10/lib64/Netica.lib" 
"D:/a/ralmond/ralmond/RNetica.Rcheck/00LOCK-RNetica/00new/R
Netica/libs/x64"
   C:\rtools43\x86_64-w64-mingw32.static.posix\bin\nm.exe: 'NeticaDLL': 
No such f
ile
   gcc -shared -s -static-libgcc -o RNetica.dll tmp.def Cases.o 
Continuous.o Edge
s.o Experience.o Inference.o Networks.o Node.o Random.o Registration.o 
Session.o
  -L. 
-LD:/a/ralmond/ralmond/RNetica.Rcheck/00LOCK-RNetica/00new/RNetica/libs/x64
  -lNetica -LC:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 
-LC:/rtools43/x8
6_64-w64-mingw32.static.posix/lib -LC:/R/bin/x64 -lR
   C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: internal 
error: aborti
ng 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
```

A little bit of searching on the internet, indicates that Windows 
sometimes reports Dll A not found when Dll A needs Dll B and it can't 
find B.

This used to work under older versions of R and the tool chain and I 
don't think I've changed anything related to the C side of the code.

1) Have the paths changed, so I no longer should be moving the (64 bit 
version of the) 3rd party DLL to `libs/x64`?

2) Is there something that has changed with the mingw tools (nm.exe and 
ld.exe) which are changing things?

3) Is there a change on how win32 and win64 variants are handled (I have 
both 32 and 64 bit copies of the 3rd party DLL, I just need to move them 
to the right places).

Thanks for any enlightenment you can offer,

     --Russell Almond




-- 
Russell Almond
https://ralmond.net/

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list