I tried to send the following w/ an attachment, but it got bounced. So here it is w/ the attachment inlined:
The attached patch for configure.ac allowed for a normal compile w/ mingw-w64 w/ --enabled-shared. It's really only a stopgap since you would need to do something more intelligent when you detect --enable-shared and then dynamically adjust hogweed's link options.
Do you think it would be possible to add libtool and pkg-config support?
Thanks, - David Hoyt
--- configure.ac Sun Jul 25 12:30:13 2010 +++ configure.ac Thu Sep 16 12:48:51 2010 @@ -233,6 +233,19 @@ SHLIBCFLAGS="$CCPIC"
case "$host_os" in + mingw32*) + LIBNETTLE_FORLINK='libnettle-$(LIBNETTLE_MAJOR)-$(LIBNETTLE_MINOR).dll' + LIBNETTLE_SONAME='' + LIBNETTLE_FILE='libnettle.dll.a' + LIBNETTLE_LINK='$(CC) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBNETTLE_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive' + LIBNETTLE_LIBS='-Wl,--no-whole-archive $(LIBS)' + + LIBHOGWEED_FORLINK='libhogweed-$(LIBHOGWEED_MAJOR)-$(LIBHOGWEED_MINOR).dll' + LIBHOGWEED_SONAME='' + LIBHOGWEED_FILE='libhogweed.dll.a' + LIBHOGWEED_LINK='$(CC) $(LDFLAGS) -shared -Wl,--out-implib=$(LIBHOGWEED_FILE) -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive' + LIBHOGWEED_LIBS='-Wl,--no-whole-archive $(LIBS) libnettle.dll.a' + ;; cygwin*) LIBNETTLE_FORLINK='cygnettle-$(LIBNETTLE_MAJOR)-$(LIBNETTLE_MINOR).dll' LIBNETTLE_SONAME=''
"Hoyt, David" hoyt6@llnl.gov writes:
The attached patch for configure.ac allowed for a normal compile w/ mingw-w64 w/ --enabled-shared.
Thanks for looking into this. Patch applied.
It's really only a stopgap since you would need to do something more intelligent when you detect --enable-shared and then dynamically adjust hogweed's link options.
Can you be a bit more concrete about what you think is needed? What are the different cases, and what should the link options be in each case? (I've read you earlier mail with some other issues, I hope to reply to it reasonably soon).
Do you think it would be possible to add libtool and pkg-config support?
Libtool: No. I think libtool is a reasonable idea, but I consider the current way it's implemented (a shell script of 9000+ lines invoked for each file being compiled) as way too awful. I strongly prefer the autoconf way, to select suitable compile and link flags during *configure*, and just substitute the right things in the Makefile. It makes it a *lot* easier to track down problems. Ideally, I'd prefer a libtool-ish autofonf macro which defines a set of autoconf substitutions, and nothing more.
pkg-config: Possibly, but I'm not so familiar with it. Do you want nettle's configure to use pkg-config to pick up gmp, or do you want nettle to install pkg-config stuff so others can use it to pick up nettle and hogweed?
Regards, /Niels
It's really only a stopgap since you would need to do something more intelligent when you detect --enable-shared and then dynamically adjust hogweed's link options.
Can you be a bit more concrete about what you think is needed? What are the different cases, and what should the link options be in each case? (I've read you earlier mail with some other issues, I hope to reply to it reasonably soon).
The problem w/ my patch is the use case where the user specified --disable-shared. In that case, it would build the static libs, but my patch looks explicitly to link against the shared lib: libnettle.dll.a. I explicitly used libnettle.dll.a b/c it built both the static lib and the shared lib and I was unsure which one it would choose to link against (shared or static lib).
Libtool: No. I think libtool is a reasonable idea, but I consider the current way it's implemented (a shell script of 9000+ lines invoked for each file being compiled) as way too awful. I strongly prefer the autoconf way, to select suitable compile and link flags during *configure*, and just substitute the right things in the Makefile. It makes it a *lot* easier to track down problems. Ideally, I'd prefer a libtool-ish autofonf macro which defines a set of autoconf substitutions, and nothing more.
Have you considered using dolt (dolt.freedesktop.org)?
pkg-config: Possibly, but I'm not so familiar with it. Do you want nettle's configure to use pkg-config to pick up gmp, or do you want nettle to install pkg-config stuff so others can use it to pick up nettle and hogweed?
I'm more looking at nettle to install pkg-config so others can pick it up.
"Hoyt, David" hoyt6@llnl.gov writes:
The problem w/ my patch is the use case where the user specified --disable-shared. In that case, it would build the static libs, but my patch looks explicitly to link against the shared lib: libnettle.dll.a. I explicitly used libnettle.dll.a b/c it built both the static lib and the shared lib and I was unsure which one it would choose to link against (shared or static lib).
I'm not sure I follow you. In the case that shared libaries are built (--enable-shared), the hogweed dll should be dynamically linked with the nettle dll (and linked statically or dynamically to gmp, depending on what's available). I don't see any urgent need to make that configurable, to make it possible to build a shared hogweed dll linked statically with nettle.
And in the case only static libraries are built, the various LIBHOGWEED_* variables in the patch are not used, and the static libraries libnettle.a and libhogweed.a are not linked to anything, they're just archives of object files.
Have you considered using dolt (dolt.freedesktop.org)?
No, I haven't heard about it before. It looks like a step in the right direction. Even though I'd prefer not to have any wrapper script at all, just make sure that the Makefile uses the right flags when compiling and linking.
I'm more looking at nettle to install pkg-config so others can pick it up.
Sounds reasonable. I'm not going to give it a high priority, but I'll happily take patches, assuming they're not too difficult to understand and maintain.
Regards, /Niels
The problem w/ my patch is the use case where the user specified --disable-shared. In that case, it would build the static libs, but my patch looks explicitly to link against the shared lib: libnettle.dll.a. I explicitly used libnettle.dll.a b/c it built both the static lib and the shared lib and I was unsure which one it would choose to link against (shared or static lib).
I'm not sure I follow you. In the case that shared libaries are built (--enable-shared), the hogweed dll should be dynamically linked with the nettle dll (and linked statically or dynamically to gmp, depending on what's available). I don't see any urgent need to make that configurable, to make it possible to build a shared hogweed dll linked statically with nettle.
That wasn't happening because nettle wasn't being added to the link options (-lnettle) for hogweed. Part of my patch was so it wouldn't link statically against nettle and also b/c it was failing to build because -lnettle wasn't being added at link time.
And in the case only static libraries are built, the various LIBHOGWEED_* variables in the patch are not used, and the static libraries libnettle.a and libhogweed.a are not linked to anything, they're just archives of object files.
I didn't know that. Hopefully it's not a problem then.
I'm more looking at nettle to install pkg-config so others can pick it up.
Sounds reasonable. I'm not going to give it a high priority, but I'll happily take patches, assuming they're not too difficult to understand and maintain.
Sounds reasonable. I don't have time to integrate pkg-config, just thought it might be good to have since a lot of packages are going that route these days, it seems.
nettle-bugs@lists.lysator.liu.se