Windows Squid built using MinGW and running, trying to get adapter linked in at run time

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows Squid built using MinGW and running, trying to get adapter linked in at run time

Russel McDonald
Hi,

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 found
terminate 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?

Russel



_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Windows Squid built using MinGW and running, trying to get adapter linked in at run time

Alex Rousskov
On 12/20/18 7:46 AM, Russel McDonald wrote:

> 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 found

I do not know enough to help with Windows-specific questions, but please
note that the "file not found" error in this context is often lying.
IIRC, the libtool library that Squid uses to handle dynamic library
loading returns an essentially invalid/incorrect error message on many
dynamic loading errors. This is not something Squid itself can fix.

On Unix, one can use environment variables like LD_DEBUG=ALL and
LD_WARN=1 to see why the dynamic loader is unhappy with the adapter
library. I do not know whether something like that works on Windows.

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users