[squid-users] Windows Squid built using MinGW and running, trying to get adapter linked in at run time

Russel McDonald russel_mcdonald at swbell.net
Thu Dec 20 14:46:54 UTC 2018

I switched from Cygwin to building with MinGW, and after 8 squid code modifications, mostly include and define settings but one flat out access violation crash, I now have Squid proxy running and accessible via browser on Windows :)
And now I have built the ecap library, successfully rebuilt squid with --enable-ecap,  and built the adapter.All good!
However I'm at the apparent crux of getting the adapter loaded at squid run time and failing.
I understand that(1) squid needs to link in the same exact ecap library binary that the adapter does so they can communicate correctly through that ecap,(2) we don't want to statically link in the adapter to squid.exe,(3) so that adapter needs to be a shared such library, but(4) building with MinGW creates a static library. 
And I see a comment output during make:
> *** Warning: This system can not link to static lib archive
> /usr/local/lib/libecap.la. *** 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. *** But as you try to
> build a module library, libtool will still create *** a static
> module, that should work as long as the dlopening application ***
> is linked with the -dlopen flag to resolve symbols at runtime.

So I did use this ./configure for squid, specifying the dlopen:
./configure LDFLAGS="-dlopen=C:/MinGW/src/ecap_adapter_sample-1.0.0/src/.libs/ecap_adapter_modifying.la" --prefix=c:/squid  --enable-ecap --enable-default-hostsfile=none --disable-strict-error-checking  --enable-win32-service --disable-optimizations --enable-debug-cbdata --with-pidfile=/var/run/squid.pid --enable-delay-pools --disable-eui --with-filedescriptors=65536 --enable-removal-policies=lru,heap
my understanding further being that the dlopen will cause squid to not link in the adapter until run time even though that library is static. And since it is not a native Windows format library (not a dll) then squid has to run in a MinGW window. Correct?
Yet I still get:2018/12/19 22:57:32| Loading Squid module from 'C:/MinGW/src/ecap_adapter_sample-1.0.0/src/.libs/ecap_adapter_modifying.la'2018/12/19 22:57:32| FATAL: dying from an unhandled exception: file not foundterminate called after throwing an instance of 'TextException'  what():  file not found
If I change my squid.conf instead to load in .a instead of .la just as a test, I get this:2018/12/20 08:39:58| Loading Squid module from 'C:/MinGW/src/ecap_adapter_sample-1.0.0/src/.libs/ecap_adapter_modifying.a'2018/12/20 08:39:58| FATAL: dying from an unhandled exception: %1 is not a valid Win32 application.terminate called after throwing an instance of 'TextException'  what():  %1 is not a valid Win32 application.
So I know it's actually accessing that .la, which does exist at that location, yet still complains that "file not found".Is it as well trying to link in another library that the adapter needs?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20181220/287d860e/attachment.html>

More information about the squid-users mailing list