Project

Profile

Help

DLL not found error in SaxonHEC 11.4

Added by Lauren Wood over 1 year ago

Windows 10 Pro, 64-bit, with SaxonHEC 11.4

I followed the instructions at https://www.saxonica.com/saxon-c/documentation11/index.html#!starting/installing/installingWindows to install, taking the default location. Then installed the Visual Studio Build Tools as per https://code.visualstudio.com/docs/cpp/config-msvc to be able to build. Running build-windows.bat was apparently successful, although there were a couple of error messages about warning LNK4042: object specified more than once; extras ignored.

Running testXPath.exe was not successful; I got the 'unable to load DLL' error. In case it was a problem with the space in the folder names, I experimented with changing the install location, updating the SAXONC_HOME environment variable in each case. I got the same error each time. The file is in the location that's given in each case.

Unable to load C:\Saxonica\SaxonHEC11.4\libsaxonhec.dll
Error: : No error

Any ideas what might be going wrong?


Replies (16)

Please register to reply

RE: DLL not found error in SaxonHEC 11.4 - Added by Lauren Wood over 1 year ago

I also installed on my Mac laptop, and got the same error result, although the dylib is in /usr/local/lib.

 $ ./testXPath
Unable to load /usr/local/lib/libsaxonhec.dylib
Error: : Undefined error: 0

RE: DLL not found error in SaxonHEC 11.4 - Added by O'Neil Delpratt over 1 year ago

Hi Lauren,

For the windows issue it looks like the product us installed in a location with a space character in the directory name. On my machine I installed SaxonC within the default location: 'C:\Program Files\Saxonica\SaxonHEC 11.4', but I guess the product is looking for one without.

Please try setting SAXONC_HOME to match or removing the space in the directory.

I see that you have installed the product in different location to the default. This should work given that you have set SAXONC_HOME, but I will investigate this further.

For the Mac laptop are you using an Intel chip machine?

SaxonC currently does not work on the new Mac M1 chips, also we have dropped support for the 32-bit machines.

RE: DLL not found error in SaxonHEC 11.4 - Added by Lauren Wood over 1 year ago

Hi O'Neil,

thanks for the information about the Intel Macs.

I did try a number of different locations: 'C:\Program Files\Saxonica\SaxonHEC 11.4' 'C:\Program Files\Saxonica\SaxonHEC11.4', 'C:\Saxonica\SaxonHEC11.4' but I'll try again with the default in case I missed something (maybe setting SAXONC_HOME is required even for the default?) and let you know. It's an old Windows PC and I don't usually develop in C or C++ so it might be missing something else.

thanks,

Lauren

RE: DLL not found error in SaxonHEC 11.4 - Added by O'Neil Delpratt over 1 year ago

When you say old Windows PC is that a 64-bit Windows?

RE: DLL not found error in SaxonHEC 11.4 - Added by Lauren Wood over 1 year ago

Yes, it's 64-bit. Old, but not quite that old.

RE: DLL not found error in SaxonHEC 11.4 - Added by O'Neil Delpratt over 1 year ago

I am willing to do a screen share with you to try and resolve your issue. Please let me know if you would like to step through the install and build process together.

RE: DLL not found error in SaxonHEC 11.4 - Added by Lauren Wood over 1 year ago

Hi O'Neil,

I tried again; uninstall old version, reboot desktop, reinstall in the default location, set SAXONC_HOME. Build in the Developer Command Prompt for VS 2022.

Same result

C:\Program Files\Saxonica\SaxonHEC 11.4\samples\cppTests>testXPath.exe
Unable to load "C:\Program Files\Saxonica\SaxonHEC 11.4"\libsaxonhec.dll
Error: : No error

I was clutching at straws wondering if the quote characters should be around the entire path, thus "C:\Program Files\Saxonica\SaxonHEC 11.4\libsaxonhec.dll", but dir "C:\Program Files\Saxonica\SaxonHEC 11.4"\libsaxonhec.dll in the Developer Command Prompt for VS 2022 terminal finds the DLL so I suspect that is not the cause.

I'm getting a new PC and will try again with that.

thanks,

Lauren

RE: DLL not found error in SaxonHEC 11.4 - Added by Martin Honnen over 1 year ago

In my understanding, if you get the error Unable to load "C:\Program Files\Saxonica\SaxonHEC 11.4"\libsaxonhec.dll, you haven't set the SAXONC_HOME correctly, you have set it with quotes (e.g. set SAXONC_HOME="C:\Program Files\Saxonica\SaxonHEC 11.4") but should simply do e.g. set SAXONC_HOME=C:\Program Files\Saxonica\SaxonHEC 11.4 in the cmd prompt.

RE: DLL not found error in SaxonHEC 11.4 - Added by Lauren Wood over 1 year ago

Hi Martin,

good thought, but when I tried it I got the same result (DLL not found) so that's not the cause. I think the " characters are needed to offset the spaces in the filename on Windows.

thanks,

Lauren

RE: DLL not found error in SaxonHEC 11.4 - Added by Martin Honnen over 1 year ago

It is more than thought, I tend to work on Windows and on two Windows systems, when I set set SAXONC_HOME="C:\Program Files\Saxonica\SaxonHEC 11.4" in a command shell and then try to run e.g. .\testXPath.exe get exactly the error

Unable to load "C:\Program Files\Saxonica\SaxonHEC 11.4"\libsaxonhec.dll
Error: : No error

If I set set SAXONC_HOME=C:\Program Files\Saxonica\SaxonHEC 11.4 I can run the sample:

Test: XPathProcessor with Saxon version=SaxonC-HE 11.4 from Saxonica

Test testXPathSingle:
Number of items=1
[snip]

Somehow your setup seems to be different if set SAXONC_HOME=C:\Program Files\Saxonica\SaxonHEC 11.4 doesn't work.

I hope you find a way to get SaxonC running.

RE: DLL not found error in SaxonHEC 11.4 - Added by Lauren Wood over 1 year ago

Thanks Martin, now I just have to track down what's weird about my system. Or try on a different Windows box.

RE: DLL not found error in SaxonHEC 11.4 - Added by Martin Honnen over 1 year ago

One other reason why your compilation/build attempt might appear fine but doesn't seem to be able to find or use or load the Saxon DLL is indeed the 32bit versus 64bit problem, I don't know which tool you use but if there is a x64 developer command prompt or an x64 native tools command prompt make sure you use that one instead of the default developer command prompt to run the build-windows.bat files, otherwise I think you end up with a 32bit executable trying to load the 64bit SaxonC dll and that fails.

RE: DLL not found error in SaxonHEC 11.4 - Added by O'Neil Delpratt over 1 year ago

Thanks Martin for pointing this out. I confirm this is another possible cause of the error.

RE: DLL not found error in SaxonHEC 11.4 - Added by Lauren Wood over 1 year ago

I finally managed to get the testXPath.exe to run. I still don't know what precisely went wrong, but in case this helps someone else... My working assumption was that something somewhere in the C++ build environment PC was pointing to some 32-bit code, though everything I had installed claimed to be 64-bit. Thus the steps:

  • uninstall Visual Studio Build Tools
  • install Visual Studio 2022 Community edition, with the C++ environment
  • open a Windows cmd.exe as administrator
  • run the vcvars64.bat file in the Community\VC\Auxiliary\Build folder to set the environment variables correctly for building C++ code
  • then run build-windows.bat in the samples\cppTests folder

Thanks to both Martin and O'Neil for helping point me in the right direction.

RE: DLL not found error in SaxonHEC 11.4 - Added by O'Neil Delpratt over 1 year ago

Your welcome Lauren. Glad you got it to work.

RE: DLL not found error in SaxonHEC 11.4 - Added by O'Neil Delpratt over 1 year ago

Thanks Lauren for noting your steps. I will add some notes in our documentation (https://www.saxonica.com/saxon-c/documentation11/index.html#!starting/installing/installingWindows) which may help other users.

    (1-16/16)

    Please register to reply