Gentoo Archives: gentoo-hardened

From: Yannis Kontekakis <tolis@×××××××××××.gr>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] erlang fails to install on kvm guest (illegal instruction)
Date: Tue, 20 Nov 2012 18:03:39
Message-Id: 50ABAFB4.1030407@foss.teithe.gr
In Reply to: Re: [gentoo-hardened] erlang fails to install on kvm guest (illegal instruction) by Alexander Tsoy
1 On 11/20/2012 06:13 PM, Alexander Tsoy wrote:
2 > В Tue, 20 Nov 2012 17:50:36 +0200
3 > Yannis Kontekakis<tolis@×××××××××××.gr> пишет:
4 >
5 >> On 11/20/2012 05:34 PM, Alexander Tsoy wrote:
6 >>> В Tue, 20 Nov 2012 16:54:39 +0200
7 >>> Yannis Kontekakis<tolis@×××××××××××.gr> пишет:
8 >>>
9 >>>> Hello,
10 >>>>
11 >>>> I am trying to install erlang on a hardened amd64 gentoo system running
12 >>>> on a kvm guest. The use flags and version of erlang are the following:
13 >>>>
14 >>>> dev-lang/erlang-15.2 USE="hipe java kpoll odbc smp ssl -compat-ethread
15 >>>> -doc -emacs -halfword -sctp -tk -wxwidgets"
16 >>>>
17 >>>> my CFLAGS are:
18 >>>> CFLAGS="-march=core2 -O2 -pipe"
19 >>>> CXXFLAGS="${CFLAGS}"
20 >>>>
21 >>>> cat /proc/cpuinfo reports 4 cores of:
22 >>>>
23 >>>> processor : 3
24 >>>> vendor_id : AuthenticAMD
25 >>>> cpu family : 6
26 >>>> model : 2
27 >>>> model name : QEMU Virtual CPU version 1.0
28 >>>> stepping : 3
29 >>>> microcode : 0x1000065
30 >>>> cpu MHz : 2100.278
31 >>>> cache size : 512 KB
32 >>>> fpu : yes
33 >>>> fpu_exception : yes
34 >>>> cpuid level : 4
35 >>>> wp : yes
36 >>>> flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
37 >>>> pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 popcnt
38 >>>> hypervisor lahf_lm svm abm sse4a
39 >>>> bogomips : 4200.55
40 >>>> TLB size : 1024 4K pages
41 >>>> clflush size : 64
42 >>>> cache_alignment : 64
43 >>>> address sizes : 40 bits physical, 48 bits virtual
44 >>>> power management:
45 >>>>
46 >>>> the error message that emerge prints while dying:
47 >>>>
48 >>>> === Entering application hipe
49 >>>> make[3]: Entering directory
50 >>>> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/rtl'
51 >>>> (cd ../main&& make hipe.hrl)
52 >>>> make[4]: Entering directory
53 >>>> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/main'
54 >>>> sed -e "s;%VSN%;3.9;" ../../hipe/main/hipe.hrl.src>
55 >>>> ../../hipe/main/hipe.hrl
56 >>>> make[4]: Leaving directory
57 >>>> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/main'
58 >>>> erlc -W +debug_info +inline -o../ebin hipe_rtl.erl
59 >>>> make[3]: *** [../ebin/hipe_rtl.beam] Illegal instruction
60 >>>> make[3]: Leaving directory
61 >>>> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe/rtl'
62 >>>> make[2]: *** [opt] Error 2
63 >>>> make[2]: Leaving directory
64 >>>> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib/hipe'
65 >>>> make[1]: *** [opt] Error 2
66 >>>> make[1]: Leaving directory
67 >>>> `/var/tmp/portage/dev-lang/erlang-15.2/work/otp_src_R15B/lib'
68 >>>> make: *** [secondary_bootstrap_build] Error 2
69 >>>> emake failed
70 >>>> * ERROR: dev-lang/erlang-15.2 failed (compile phase):
71 >>>> * (no error message)
72 >>>> *
73 >>>> * Call stack:
74 >>>> * ebuild.sh, line 93: Called src_compile
75 >>>> * environment, line 3965: Called die
76 >>>> * The specific snippet of code:
77 >>>> * emake -j1 || die;
78 >>>> *
79 >>>>
80 >>>> And finally, dmesg reports:
81 >>>> beam.smp[27752] trap invalid opcode ip:54b49c00c4 sp:3d9f459d3f0 error:0
82 >>>> in beam.smp[54b48e4000+261000]
83 >>>>
84 >>>> Emerging erlang on my desktop(a similar hardened gentoo setup) completes
85 >>>> successfully. The only thing I can think of is that something is wrong
86 >>>> with my CFLAGS(but this is just an assumption).
87 >>>>
88 >>>> Any help would be appreciated
89 >>>>
90 >>>> Regards,
91 >>>>
92 >>>> Yannis
93 >>>>
94 >>> It seems that KVM host is and AMD-based system. I suggest you to drop
95 >>> "-march=core2" from CFLAGS. Or if you do not plan to migrate this VM
96 >>> you can also try to replace it with something like "-march=amdfam10
97 >>> -mno-3dnow". :)
98 >>>
99 >> I thought so... I now have to rebuild the whole world :) Is anyone aware
100 >> of an -march value that can be used interchangeably between 64bit intel
101 >> & amd cpus? The kvm host is not under my administration, so at any time
102 >> my guest could be switched between hosts.
103 >>
104 > Simply do not use -march:
105 > CFLAGS="-O2 -pipe"
106 > Binaries compiled with this cflags should work on any x86_64 system.
107 >
108 Thanks. I will go with it.

Replies

Subject Author
Re: [gentoo-hardened] erlang fails to install on kvm guest (illegal instruction) - solved Yannis Kontekakis <tolis@×××××××××××.gr>