Opened 16 years ago
Closed 16 years ago
#3481 closed bug (fixed)
libio.h troubles on gcc4 Haiku
Reported by: | scottmc | Owned by: | stippi |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | - General | Version: | R1/pre-alpha1 |
Keywords: | Cc: | planche2k@…, eric.petit@… | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
As posted on the HaikuPorts dev mailing list by Blub: http://lists.ports.haiku-files.org/pipermail/haikuports-devs-ports.haiku-files.org/2009-February/000262.html
It seems that the libio.h header has some flaws, in gnutls (which atm fails installing for me due to failing texi-references, so I'll try with gtk-doc support) and in expat I ran into some problems with _IO_{putc,peekc,getc}_unlocked defined multiple times, I then copied /boot/develop/headers/posix/libio.h into ./lib/, and made those functions static since they were inlined anyway.
If there's some other fix for that let me know please, if not, have a look at those files:
Attachments (3)
Change History (20)
by , 16 years ago
Attachment: | libio_h.diff added |
---|
comment:1 by , 16 years ago
Cc: | added |
---|
comment:2 by , 16 years ago
If we define them as static, we can drop the initial definitions.
expat is still happy then.
comment:3 by , 16 years ago
Cc: | added |
---|
#3537 "gcc4 issues with extern inlines and -std=gnu99" is a duplicate of this issue.
Grepping /boot/develop/headers for extern inlines, it seems libio.h would be the only file that requires patching.
comment:4 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 16 years ago
Attachment: | stdio.h.diff added |
---|
Alternative stdio.h patch that keeps the semantics.
follow-up: 6 comment:5 by , 16 years ago
Thanks to the references given in #3537, I came up with the above patch. The difference is that the behaviour is maintained when compiling with -std99 or -gnu99. Could you please apply this and tell me if that solves the issues? Thanks!
comment:6 by , 16 years ago
I do not believe we need to maintain the behavior: none of Haiku's code overrides the _IO_{putc,peekc,getc}_unlocked functions, and no code should ever assume they can be (look at Linux's libio.h, it just #defines them as macros).
I'm for simplicity, so making them static inlines regardless of what we are building (c89/c99/c++) would be my choice :)
comment:7 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Ok, I commited a simplified version of blub's patch in hrev29471. Thanks for the feedback.
comment:9 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
follow-up: 11 comment:10 by , 16 years ago
Ingo, can you please check with hrev29558? I committed my original patch which should only fix the actual problem without changing any semantics.
comment:11 by , 16 years ago
comment:12 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks. I consider it fixed then.
comment:13 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Nope, still with us: Building expat with gcc 4.3 continues to complain about multiple definitions of the functions.
The following workaround fixes the expat build for me:
- Comment out the initial declarations of the three affected functions.
- After the
__INLINE
wizardry, simply define__INLINE
tostatic inline
.
Could it be that this error is caused by the GCC 4.3 special handling section in libio.h? No special options for c99 or gnu99 are being passed afaict.
comment:14 by , 16 years ago
If you want you can extract a correct patch for libio.h from TiltOS' patch http://svn.gna.org/viewcvs/pingwinek/trunk/projects/tiltos/tiltos.patch It is based on a newer code from glibc.
comment:15 by , 16 years ago
Extracted kaliber's suggested patch from TiltOS and attached it here, as libio.patch.
The resulting libio.h at least allows to compile rsync on gcc4, which failed before, too. The patch requires testing with gcc2, though.
comment:16 by , 16 years ago
patch seems to work on gcc2 as well, at least I was able to build expat cvs head with the patched libio.h in place.
Blub's suggested patch