Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 160627 - Building qemu with gcc 4 (x86)
Summary: Building qemu with gcc 4 (x86)
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Luca Barbato
URL:
Whiteboard:
Keywords:
: 231182 285824 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-07 03:46 UTC by Hanno Böck
Modified: 2010-11-09 06:24 UTC (History)
16 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
qemu-gcc4 patch (qemu-gcc4,34.74 KB, patch)
2007-01-07 03:47 UTC, Hanno Böck
Details | Diff
patch from upstream to autodetect gcc3 "backported" to 0.8.2 (qemu-0.8.2-detect-gcc3.patch,2.28 KB, patch)
2007-01-17 09:41 UTC, Carlo Marcelo Arenas Belon
Details | Diff
gentoo specific patch to add autodetection of gcc3 (qemu-0.8.2-detect-gentoo-gcc3.patch,427 bytes, patch)
2007-01-17 09:46 UTC, Carlo Marcelo Arenas Belon
Details | Diff
patch to ebuild for app-emulation/qemu-softmmu-0.8.2-r1 (detect-gcc3-ebuild.patch,2.12 KB, patch)
2007-01-17 09:55 UTC, Carlo Marcelo Arenas Belon
Details | Diff
my "qemu-softmmu-0.9.0-r1.ebuild" (qemu-softmmu-0.9.0-r1.ebuild,3.13 KB, text/plain)
2007-03-09 16:02 UTC, abo junghichi
Details
Fix gcc4 builds for arm pxa270 emulation (qemu-cvs.patch,33.38 KB, text/plain)
2008-02-26 19:34 UTC, Dmitry Bilunov
Details
Fix gcc4 builds for arm pxa270 emulation (qemu-cvs.patch,33.38 KB, patch)
2008-02-26 19:34 UTC, Dmitry Bilunov
Details | Diff
qemu-0.9.1-gcc4-hacks.patch writen from 0.8.0-hacks (qemu-0.9.1-gcc4-hacks.patch,4.32 KB, patch)
2009-02-28 03:16 UTC, abo junghichi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hanno Böck gentoo-dev 2007-01-07 03:46:37 UTC
I'll attach a patch to let qemu work with gcc4.

You'd need to:
a) add qemu-gcc4 to qemu-softmmu-0.8.2-r1 ebuild and remove the gcc4-check.
b) replace qemu-gcc4-hacks.patch in qemu-user-0.8.2 with qemu-gcc4 (same patch for both) and remove gcc4-check.

Runs fine here.
Comment 1 Hanno Böck gentoo-dev 2007-01-07 03:47:09 UTC
Created attachment 105759 [details, diff]
qemu-gcc4 patch
Comment 2 Luca Barbato gentoo-dev 2007-01-07 04:48:42 UTC
this patch seems to work just on x86...
Comment 3 Patrizio Bassi 2007-01-07 13:49:18 UTC
i do agree, on amd64 i still get seg faults.
Comment 4 Carlo Marcelo Arenas Belon 2007-01-13 22:52:41 UTC
qemu uses gcc for the generation of the application binaries which works with gcc4 if you can browse to the gazillion warnings and still feel comfortable running the binary, and for the opcode generation that won't work in gcc 4 because it is dependent on the way the object code is generated for the compiler to disassemble  the instructions in the host CPU and translate between guest and host CPU opcodes, and that format was changed in gcc4 due to improvements in the optimizations.

so to make it short, you can compile qemu with gcc4 for the application (i have a patch that does just that), but you still need gcc3 for the opcode generation, and unless qemu finishes their own generator to replace gcc3 or embed gcc3 in their package that means you have to have gcc3 installed in your host anyway so why bother? 
Comment 5 Mathias Plichta 2007-01-16 12:45:58 UTC
Would it be possible to have the ebuild automatically use gcc 3.x if available, then? Using gcc-config before and after emerging qemu (which might be part of a system update) is a bit tedious (and potentially dangerous if you forget to switch it back after the emerge).
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2007-01-16 13:20:55 UTC
(In reply to comment #5)
> Would it be possible to have the ebuild automatically use gcc 3.x if available,
> then? Using gcc-config before and after emerging qemu (which might be part of a
> system update) is a bit tedious (and potentially dangerous if you forget to
> switch it back after the emerge).

No, it wouldn't... As you've noted, it can pretty much crash lots of stuff.
Comment 7 Patrizio Bassi 2007-01-17 07:41:21 UTC
i do agree with no forcing.
i talked with devs they told me a 0.8.3 release is coming between jan and feb (but 90% won't fix gcc4 problem) but 0.8.4 will have gcc4 full support.
Comment 8 Carlo Marcelo Arenas Belon 2007-01-17 08:21:33 UTC
upstream already includes an option to autodetect gcc3 which will be available in qemu-0.8.3 (won't work as-is for gentoo though)

http://cvs.savannah.nongnu.org/viewcvs/qemu/configure?root=qemu&r1=1.112&r2=1.113

is this is an acceptable "solution"? (at least it is what is supported upstream)
Comment 9 Carlo Marcelo Arenas Belon 2007-01-17 09:41:37 UTC
Created attachment 107252 [details, diff]
patch from upstream to autodetect gcc3 "backported" to 0.8.2
Comment 10 Carlo Marcelo Arenas Belon 2007-01-17 09:46:24 UTC
Comment on attachment 107252 [details, diff]
patch from upstream to autodetect gcc3 "backported" to 0.8.2

kept AS-IS from upstream
Comment 11 Carlo Marcelo Arenas Belon 2007-01-17 09:46:38 UTC
Created attachment 107255 [details, diff]
gentoo specific patch to add autodetection of gcc3

needs to be applied on top of the previous patch from attachment 107252 [details, diff] and should have all possible gcc3 binary names in the system in order of preference.

tested in amd64 and x86 stable, will need most likely more names added depending on the currently active build chains / architectures
Comment 12 Carlo Marcelo Arenas Belon 2007-01-17 09:55:55 UTC
Created attachment 107257 [details, diff]
patch to ebuild for app-emulation/qemu-softmmu-0.8.2-r1

considering that comment 8 is valid and that the two previous patches (or some other versions of them) are applied and copied to "files", this patch changes the ebuild logic so that it can still build in a system that uses gcc4 primarily using gcc3 if autodetected
Comment 13 Jan K 2007-02-06 14:52:06 UTC
There was Qemu-0.9.0 released, the new sources compile using gcc 3, but the compilation doesn,t cause already probelems, because qemu uses the "correct" gcc, you need only to have program like gcc32 installed.

I'm waiting till qemu 0.9 will be in portage!
Comment 14 abo junghichi 2007-03-09 16:02:09 UTC
Created attachment 112722 [details]
my "qemu-softmmu-0.9.0-r1.ebuild"

In my system,
the patches for gcc4
qemu-0.8.0-gcc4-opts.patch
qemu-0.8.0-gcc4-hacks.patch
work well for qemu-0.9.0, too .
And I can input japanese-words at windows in qemu!
Comment 15 Johan Andersson 2007-03-22 00:12:53 UTC
Where can i get qemu-0.8.0-gcc4-opts.patch and  qemu-0.8.0-gcc4-hacks.patch ?

(In reply to comment #14)
> Created an attachment (id=112722) [edit]
> my "qemu-softmmu-0.9.0-r1.ebuild"
> 
> In my system,
> the patches for gcc4
> qemu-0.8.0-gcc4-opts.patch
> qemu-0.8.0-gcc4-hacks.patch
> work well for qemu-0.9.0, too .
> And I can input japanese-words at windows in qemu!
> 

Comment 16 abo junghichi 2007-04-03 15:16:48 UTC
(In reply to comment #15)
> Where can i get qemu-0.8.0-gcc4-opts.patch and  qemu-0.8.0-gcc4-hacks.patch ?

They are in the portage-tree ${PORTDIR}/app-emulation/qemu-softmmu/
which need for qemu-softmmu-0.8.1-r1.ebuild .
Or may have attached in this page to write qemu-softmmu-0.8.1-r1.ebuild . 
Comment 18 Renato Caldas 2007-11-19 15:41:58 UTC
It seems that qemu-softmmu 0.9.0-r1 in portage compiles fine with gcc-4 now. So the gcc4 test in the portage ebuild is useless, please remove it.

As for the amd64 segfaults, that seems to be a different issue.
Comment 19 Alexander van der Meij 2007-11-22 00:07:31 UTC
Qemu-softmmu-0.9.0-r1 does _not_ compile fine with gcc4. The original ebuild still has the gcc4 check. Without hacking the ebuild as described in the comments above, the compile will not commence. 
Comment 20 Alexander van der Meij 2007-11-22 00:08:53 UTC
Ahh, excuse me. I think I must have misinterpreted your comment the wrong way. 
Comment 21 Patrizio Bassi 2007-11-22 08:29:20 UTC
Luca, i confirm removing gcc3 check it compiles.

can you remove it from portage?
Comment 22 Luca Barbato gentoo-dev 2007-11-22 08:51:03 UTC
but does it work once built? last time I tried that isn't the case =/
Comment 23 Patrizio Bassi 2007-11-22 09:21:08 UTC
not really stable on amd64 last time i tried but i have several strange patches.

but this bug says: "building" so check removed and bug can go fixed.

for other issues, upstream :)
Comment 24 Sergey Zolotorev 2007-12-02 21:32:44 UTC
Yeah! Eventually I have get qemu compiling working on my x86 system with attached ebuild. So I with to comfirm http://bugs.gentoo.org/attachment.cgi?id=112722 with qemu-0.8.0-gcc4-opts.patch and qemu-0.8.0-gcc4-hacks.patch is working ebuild only for me (all other gcc4 patches I have tried and even gcc-3.4.x does not get worked qemu).
Comment 25 Luca Barbato gentoo-dev 2007-12-02 21:39:20 UTC
again: does it work once built?
Comment 26 Patrizio Bassi 2007-12-03 17:48:26 UTC
no doesn't always seg. fault (on x86_64)
Comment 27 Patrizio Bassi 2007-12-03 17:49:20 UTC
Luca, however this bug was: "Building"

this is closed, it self.

the running should go upstream or in a different bug.
Comment 28 Dmitry Bilunov 2008-02-26 19:34:33 UTC
Created attachment 144692 [details]
Fix gcc4 builds for arm pxa270 emulation

Here is another patch, that allows to build qemu-cvs with gcc4 and have a working PXA270 ARM emulation.
Comment 29 Dmitry Bilunov 2008-02-26 19:34:40 UTC
Created attachment 144694 [details, diff]
Fix gcc4 builds for arm pxa270 emulation

Here is another patch, that allows to build qemu-cvs with gcc4 and have a working PXA270 ARM emulation.
Comment 30 Carsten Lohrke (RETIRED) gentoo-dev 2008-07-08 15:19:00 UTC
*** Bug 231182 has been marked as a duplicate of this bug. ***
Comment 31 Xake 2009-01-22 07:36:15 UTC
Maybe time to mark this as upstream until someone produces a working patch or a SVN-snapshot as it seems like most targets have been ported away from dyngen and should work with gcc4 nowdays.
But still maybe that is something for an overlay more then portage?
Comment 32 abo junghichi 2009-02-28 03:16:04 UTC
Created attachment 183445 [details, diff]
qemu-0.9.1-gcc4-hacks.patch writen from 0.8.0-hacks

I wrote this patch by manual-patching qemu-0.8.0-gcc4-hacks.patch to qemu-0.9.1 source.
In my environment(using gcc4), I cannot compile qemu-0.9.1 with this patch.
Because some code in qemu-0.9.1 fails compile.
To avoid it, I add "--target-list=i386-softmmu" option for configuere to limit compile code. Then I can finish compiling, and WindowsXP in disk image file worked well.
Comment 33 Xake 2009-03-01 11:54:26 UTC
(In reply to comment #32)
> Created an attachment (id=183445) [edit]
> qemu-0.9.1-gcc4-hacks.patch writen from 0.8.0-hacks
> 
> I wrote this patch by manual-patching qemu-0.8.0-gcc4-hacks.patch to qemu-0.9.1
> source.
> In my environment(using gcc4), I cannot compile qemu-0.9.1 with this patch.
> Because some code in qemu-0.9.1 fails compile.
> To avoid it, I add "--target-list=i386-softmmu" option for configuere to limit
> compile code. Then I can finish compiling, and WindowsXP in disk image file
> worked well.
> 

Better use an SVN-snap or even better wait about one month and see if the release they have speaked of during Feb at least have made it into rc, as that version will be possible to compile qemu with GCC4, run qemu with GCC4 (as they have ditched dyngen and have something new/better).

Patching QEMU-0.9.1 which is using (very) old code, with many bugs that is fixed upstream a long time ago and possible introducing new unsupported bugs are something I think people should not even consider.
Comment 34 Xake 2009-03-05 07:34:04 UTC
So qemu-0.10.0 is released, supposed to work with gcc4 and so on.

So is it time to close this bug as wontfix/upstream/whatever, if new qemu does not show up in portage in a couple of days (no zero-day bump-bugs) start a new bug and try to produce a working ebuild for it?
Comment 35 Sebastian Luther (few) 2009-09-22 16:35:38 UTC
*** Bug 285824 has been marked as a duplicate of this bug. ***