scheme48-1.8 and --as-needed, DESTDIR, -D_GNU_SOURCE

Hi scheme48's developers,

 Recently, in gentoo, after upgrading to glibc-2.8, we experienced some
bugs in compilation time of scheme48-1.8. The first had to do with
headers: 

<cut>
i686-pc-linux-gnu-gcc -c  -DHAVE_CONFIG_H
-D__COMPILING_SCHEME48_ITSELF__
-DS48_HOST_ARCHITECTURE=\"i686-pc-linux-gnu\" -I ./c -I./c -I./c/bibop
-O2 -march=i686 -pipe -pthread -o c/unix/socket.o c/unix/socket.c
c/unix/socket.c: In function ‘gethostbyname_thread’:
c/unix/socket.c:354: error: ‘struct hostent’ has no member named
‘h_addr’
c/unix/socket.c: In function ‘s48_get_host_by_name’:
c/unix/socket.c:385: error: ‘struct hostent’ has no member named
‘h_addr’
make: *** [c/unix/socket.o] Error 1
make: *** Waiting for unfinished jobs....
</cut>

This happens because the new header /usr/include/netdb.h does now:

#if defined __USE_MISC || defined __USE_GNU
# define        h_addr  h_addr_list[0] /* Address, for backward
# compatibility.*/
#endif

and to be __USE_GNU defined, "-D_GNU_SOURCE" must be added to the
default $(DEFS). 
(Continue reading)

Michael Sperber | 1 Jul 08:40

Re: scheme48-1.8 and --as-needed, DESTDIR, -D_GNU_SOURCE


Thanks for the report!

Panagiotis Christopoulos <pchrist <at> gentoo.org> writes:

> The third bug is a bit weird, and has to do with a failure that happens
> when --as-needed is used in our LD_FLAGS, and gets solved when: 

Could you briefly explain what --as-needed does, and why it's in
Gentoo's LDFLAGS?  Should we add it generally?

--

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

Re: scheme48-1.8 and --as-needed, DESTDIR, -D_GNU_SOURCE

Hi Mike,

On 08:40 Tue 01 Jul     , Michael Sperber wrote:
> Thanks for the report!
:)

> Could you briefly explain what --as-needed does, and why it's in
> Gentoo's LDFLAGS?  Should we add it generally?
From GNU linker's man page:
<cut>
--as-needed
--no-as-needed
This  option affects ELF DT_NEEDED tags for dynamic libraries mentioned
on the command line after the --as-needed option.  Normally, the linker
will add a DT_NEEDED tag for each dynamic library mentioned on the
command line, regardless of whether the library is actually needed.
--as-needed causes DT_NEEDED tags to only be  emitted  for  libraries
that satisfy some symbol reference from regular objects which is
undefined at the point that the library was linked.  --no-as-needed
restores the default behaviour.
</cut>

 In reality, it is an experimental flag, used by some of our fellow users, and
from time to time, we fix bugs related with linker failures when it is
used. But it is not considered safe, for production use and it's buggy in
earlier versions of binutils. However, theoritically, the idea behind it,
is not bad (the use of the --as-needed flag allows the linker to avoid
linking extra libraries in a binary.) For more information, you can read
our documentation about this issue.
(http://www.gentoo.org/proj/en/qa/asneeded.xml)
(Continue reading)

Michael Sperber | 5 Jul 17:59

Re: scheme48-1.8 and --as-needed, DESTDIR, -D_GNU_SOURCE


Panagiotis Christopoulos <pchrist <at> gentoo.org> writes:

> This happens because the new header /usr/include/netdb.h does now:
>
> #if defined __USE_MISC || defined __USE_GNU
> # define        h_addr  h_addr_list[0] /* Address, for backward
> # compatibility.*/
> #endif
>
> and to be __USE_GNU defined, "-D_GNU_SOURCE" must be added to the
> default $(DEFS). 

This should go away by itself in a future version, as the networking
code has been rewritten already in the development version to not even
make use of it.

> The second issue is the lack of DESTDIR in config_script,
> something I think you have fixed in your stable development branch as I
> can see in
> http://www.deinprogramm.de/cgi-bin/hgs48-stable.cgi/rev/1f349e4f8f3b , so
> this is just a reminder:)

Yes, this will automatically go into the next release.

> The third bug is a bit weird, and has to do with a failure that happens
> when --as-needed is used in our LD_FLAGS, and gets solved when: 
> <cut>
> -$(LIBOBJS) $(LIBS)\
> -$(EXTERNAL_OBJECTS)
(Continue reading)


Gmane