[Freewx-maint] Bug#738849: Please enable webview support for wx3.0

Olly Betts olly at survex.com
Wed Apr 30 22:32:47 UTC 2014


On Wed, Apr 30, 2014 at 07:34:03PM +0100, costamagnagianfranco at yahoo.it wrote:
> > Il Mercoledì 30 Aprile 2014 12:39, Olly Betts <olly at survex.com> ha scritto:
> > > On Wed, Apr 30, 2014 at 08:45:47AM +0100, Gianfranco Costamagna wrote:
> >>  Isn't the "-Wl,--as-needed" automatically passed by dh 
> > system? are you
> >>  overriding LDFLAGS somewhere?
> > 
> > I don't believe either is true.  Passing it unconditionally wouldn't be
> > a good plan, as it breaks some cases (as I mentioned above).
> > 
> > Are you perhaps thinking of "-Wl,-z,relro" (which is related to
> > hardening)?
> 
> ok can it be that ubuntu enables them by default and debian not?
> https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wl.2C--as-needed

I don't follow Ubuntu development these days, but possibly.

> ubuntu is using them since three years, and why should removing a not
> used library be a problem?
> I mean if no symbols are used we can drop safely right?

It isn't always safe to do so - you can get a clean build but hit
problems at runtime.  For example a program might use dlsym() to look up
a symbol from a library it was linked against, but if there aren't any
references at link time, the library won't be there if --as-needed is
used:

olly at gemse:~$ cat asneeded.c 
#include <dlfcn.h>
#include <stdio.h>

int main(int argc, char ** argv) {
    void * handle = dlopen(NULL, RTLD_NOW);   
    if (!handle) {
	fprintf(stderr, "dlopen failed: %s\n", dlerror());
	return 1;
    }
    (void)argc;
    while (*++argv) {
	printf("%s=%p\n", *argv, dlsym(handle, *argv));
    }
    return 0;
}
olly at gemse:~$ gcc -Wall -W -O2 asneeded.c -ldl -lz -o asneeded
olly at gemse:~$ ./asneeded zlibVersion
zlibVersion=0x7fc6e04a9fc0
olly at gemse:~$ gcc -Wall -W -O2 -Wl,--as-needed asneeded.c -ldl -lz -o asneeded 
olly at gemse:~$ ./asneeded zlibVersion
zlibVersion=(nil)

> Can we safely leave them inside?
> 
> The patch is so ugly, but the libraries are not there anymore
> https://github.com/LocutusOfBorg/wx/commit/e18d875c355096e458371d7f83910d02c926c294

A much cleaner way is just to add this to debian/rules instead of the
above changes:

export DEB_LDFLAGS_APPEND=-Wl,--as-needed

> Attached the log of the new debdiffs

Great, that looks much better to me.  Thanks for all your work on this.

Cheers,
    Olly



More information about the Freewx-maint mailing list