http://bugs.winehq.org/show_bug.cgi?id=20474
Summary: Wine can't be built with GCC in C99 mode Product: Wine Version: unspecified Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: build-env AssignedTo: wine-bugs@winehq.org ReportedBy: yann@droneaud.fr
For multiple reason, wine can't be built by GCC in C99 mode ( --std=c99 ).
In particular, wine rely on GCC behavor regarding to extern inline.
It produces errors regarding asm construct conflicting with extern inline symbols.
It produces errors with multiple defination of inline function in object files.
According to this, it seems that wine is not compatible with C99, but rely a lot on GCC specific behavor.
See also bug #20306
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #1 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:10:57 --- Created an attachment (id=24365) --> (http://bugs.winehq.org/attachment.cgi?id=24365) build log for interlocked.c
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #2 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:11:39 --- Created an attachment (id=24366) --> (http://bugs.winehq.org/attachment.cgi?id=24366) Preprocessed output of interlocked.c
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #3 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:12:21 --- Created an attachment (id=24367) --> (http://bugs.winehq.org/attachment.cgi?id=24367) Compiler output (assembler) from interlocked.s
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #4 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:12:54 --- Created an attachment (id=24368) --> (http://bugs.winehq.org/attachment.cgi?id=24368) linker output for libwine
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #5 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:13:23 --- Created an attachment (id=24369) --> (http://bugs.winehq.org/attachment.cgi?id=24369) Build log for ldt.c
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #6 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:13:46 --- Created an attachment (id=24370) --> (http://bugs.winehq.org/attachment.cgi?id=24370) Preprocessed output of ldt.c
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #7 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:14:10 --- Created an attachment (id=24371) --> (http://bugs.winehq.org/attachment.cgi?id=24371) Compiler output (assembler) from ltd.c
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #8 from Yann Droneaud yann@droneaud.fr 2009-10-26 10:17:16 --- In C99, not all POSIX, XOPEN features are available by default. Sources file should use some defined. For example
#define _ISOC99_SOURCE
#define _POSIX_SOURCE #define _POSIX_C_SOURCE 200112L
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE_EXTENDED
BTW, this could be added to CPPFLAG or in config.h
http://bugs.winehq.org/show_bug.cgi?id=20474
Yann Droneaud yann@droneaud.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- Depends on| |20476
http://bugs.winehq.org/show_bug.cgi?id=20474
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |nerv@dawncrow.de Ever Confirmed|0 |1
--- Comment #9 from André H. nerv@dawncrow.de 2009-10-26 13:14:19 --- confirming in wine 1.1.32
http://bugs.winehq.org/show_bug.cgi?id=20474
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.1.32
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #10 from Yann Droneaud yann@droneaud.fr 2009-10-27 05:47:45 --- Created an attachment (id=24387) --> (http://bugs.winehq.org/attachment.cgi?id=24387) Ugly patch to allow some parts of wine to be built in GCC C99 mode
Here's an ugly patch to allow wine to be partially built with gcc in C99 mode The main trick is to use LDFLAGS=-Wl,--allow-multiple-definition to workaround extern inline problem, until a proper fix is proposed. Usage of typeof() is a real pain to fix as it is used to declare function pointer used to load dynamic libraries. Nameless union is disable (hardcoded) More and more #include "config.h" have to be added in order to fully compile wine.
-Wl,--allow-multiple-definition is used in winegcc/winebuild (yes, this patch is really ugly).
With this patch, compilation stops in dlls/imm32.
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #11 from Yann Droneaud yann@droneaud.fr 2009-10-27 05:57:11 --- (In reply to comment #10)
Created an attachment (id=24387)
--> (http://bugs.winehq.org/attachment.cgi?id=24387) [details]
Ugly patch to allow some parts of wine to be built in GCC C99 mode
Apply the patch, run autoconf, then ./configure CFLAGS="--std=c99" LDFLAGS="-Wl,--allow-multiple-definition"
You would also use make LDFLAGS+="-Wl,--allow-multiple-definition" instead. But --std=c99 should be added at configure time.
http://bugs.winehq.org/show_bug.cgi?id=20474
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source CC| |austinenglish@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #12 from Austin English austinenglish@gmail.com 2012-06-24 23:33:52 CDT --- Still present in 1.5.7.
https://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #13 from André H. nerv@dawncrow.de --- Still present in wine-1.7.29-7-g9a26f0f FWIW: -std=c89 doesn't compile -std=c99 doesn't compile -std=c11 doesn't compile -std=gnu89 compiles, runs -std=gnu99 compiles, runs -std=gnu11 compiles, runs (which is good for upcoming gcc 5.0)
Tested with gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
https://bugs.winehq.org/show_bug.cgi?id=20474
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |super_man@post.com
--- Comment #14 from super_man@post.com --- Still valid.
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
winegcc.c: In function ‘get_temp_file’: gcc -m32 -c -o pe.o pe.c -I. -I../../include -D__WINESRC__ -Wall -pipe -fno-strict-aliasing \ -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits \ -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op \ -fno-omit-frame-pointer --std=c99 winegcc.c:273:30: error: ‘signal_mask’ undeclared (first use in this function) sigprocmask( SIG_BLOCK, &signal_mask, &old_set );
I think that was 1st problem it encountered.
https://bugs.winehq.org/show_bug.cgi?id=20474
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #15 from winetest@luukku.com --- For testing purpose I didnt add any patch and I used this command
./configure CFLAGS="--std=c99" LDFLAGS="-Wl,--allow-multiple-definition"
The strange thig is that after configure finishes it complains that it cant find xrandr related development files. And it doesnt compile either.
But if I just do ./configure it doesnt complain about missing xrandr related files.
https://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #16 from André H. nerv@dawncrow.de --- I think we are supposed to use a gnu standard, most popular software won't work with pure c standard afaik. Last time I tested gnu89, gnu99 and gnu11 worked. Maybe this bug should be closed wontfix?
https://bugs.winehq.org/show_bug.cgi?id=20474
Saulius K. saulius2@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |saulius2@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #17 from Saulius K. saulius2@gmail.com --- (In reply to André H. from comment #16)
I think we are supposed to use a gnu standard, most popular software won't work with pure c standard afaik. Last time I tested gnu89, gnu99 and gnu11 worked.
André, how does using gnu standard relate to this statement, please? https://wiki.winehq.org/Code_Hygiene#Constants_as_Character_Arrays
--- snip --- but it keeps the code standards-compliant and portable across build environments. --- snap ---
I think the project needs to express definition of the portability in direct way which I was unable to find online ATM. Any pointers?
https://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #18 from Austin English austinenglish@gmail.com --- (In reply to Saulius K. from comment #17)
(In reply to André H. from comment #16)
I think we are supposed to use a gnu standard, most popular software won't work with pure c standard afaik. Last time I tested gnu89, gnu99 and gnu11 worked.
André, how does using gnu standard relate to this statement, please? https://wiki.winehq.org/Code_Hygiene#Constants_as_Character_Arrays
I wouldn't consider that page up to date or reliable. For instance, it mentions D_FORTIFY_SOURCE, which configure explicitly disables (and has for quiet some time).
https://bugs.winehq.org/show_bug.cgi?id=20474
temp82@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |temp82@luukku.com
--- Comment #19 from temp82@luukku.com --- still valid as wine 7.10.
https://bugs.winehq.org/show_bug.cgi?id=20474
Vitaly Lipatov lav@etersoft.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |lav@etersoft.ru
https://bugs.winehq.org/show_bug.cgi?id=20474
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
https://bugs.winehq.org/show_bug.cgi?id=20474
--- Comment #20 from Fabian Maurer dark.shadow4@web.de --- IMHO it doesn't make sense limiting yourself to c99 unless you have a compiler that really doesn't have the extensions that Wine needs. Is this the case for anyone here?