Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 487950 - =dev-util/perf-3.8-r1[unwind] - Fails to compile with error: ‘UNW_X86_EAX’ undeclared on amd64
Summary: =dev-util/perf-3.8-r1[unwind] - Fails to compile with error: ‘UNW_X86_EAX’ un...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Naohiro Aota
URL:
Whiteboard: Last paragraph of description
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-10-14 01:23 UTC by Richard Grenville
Modified: 2013-11-17 04:53 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,180.03 KB, text/plain)
2013-10-14 01:25 UTC, Richard Grenville
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Grenville 2013-10-14 01:23:52 UTC
dev-util/perf-3.8-r1[unwind] fails to compile with those errors under amd64:

----
arch/x86/util/unwind.c:80:7: error: ‘UNW_X86_EDX’ undeclared (first use in this function)
  case UNW_X86_EDX:
       ^
arch/x86/util/unwind.c:83:7: error: ‘UNW_X86_ECX’ undeclared (first use in this function)
  case UNW_X86_ECX:
       ^
arch/x86/util/unwind.c:86:7: error: ‘UNW_X86_EBX’ undeclared (first use in this function)
  case UNW_X86_EBX:
       ^
arch/x86/util/unwind.c:89:7: error: ‘UNW_X86_ESI’ undeclared (first use in this function)
  case UNW_X86_ESI:
       ^
arch/x86/util/unwind.c:92:7: error: ‘UNW_X86_EDI’ undeclared (first use in this function)
  case UNW_X86_EDI:
       ^
arch/x86/util/unwind.c:95:7: error: ‘UNW_X86_EBP’ undeclared (first use in this function)
  case UNW_X86_EBP:
       ^
arch/x86/util/unwind.c:98:7: error: ‘UNW_X86_ESP’ undeclared (first use in this function)
  case UNW_X86_ESP:
       ^
arch/x86/util/unwind.c:101:7: error: ‘UNW_X86_EIP’ undeclared (first use in this function)
  case UNW_X86_EIP:
       ^
make: *** [arch/x86/util/unwind.o] Error 1
----

./arch/x86/util/unwind.c relies on a macro ARCH_X86_64 to determine if it's on amd64 or x86, which is in turn defined according to the ARCH variable passed to make. Unfortunately, the ebuild uses ARCH="$(tc-arch-kernel)" to determine the ARCH passed to make, and tc-arch-kernel() returns "x86" on amd64 systems, leading to the build failure. I did a quick test to change $(tc-arch-kernel) to x86_64, and it works. You guys may have better ways to resolve it, by, for example, creating another tc-arch-kernel function that does the sane thing.

Reproducible: Always
Comment 1 Richard Grenville 2013-10-14 01:25:24 UTC
Created attachment 360838 [details]
build.log
Comment 2 Jaak Ristioja 2013-11-12 10:05:28 UTC
For the impatient, setting ARCH="x86_64" in the ebuild instead of ARCH="$(tc-arch-kernel)" seems to work.
Comment 3 Richard Grenville 2013-11-12 12:35:51 UTC
By the way, this is the workaround I use personally:

--- /usr/portage/dev-util/perf/perf-3.8-r1.ebuild	2013-10-09 06:46:22.000000000 +0800
+++ /usr/local/portage/dev-util/perf/perf-3.8-r1.ebuild	2013-11-08 22:16:34.780105803 +0800
@@ -123,12 +123,16 @@
 
 puse() { usex $1 "" no; }
 perf_make() {
+	local myhost=${CTARGET:-${CHOST}}
+	local myarch="$(tc-arch-kernel)"
+	[[ "${myhost}" == x86_64* ]] && myarch=x86_64
+
 	emake -j1 V=1 \
 		CC="$(tc-getCC)" AR="$(tc-getAR)" \
 		prefix="/usr" bindir_relative="sbin" \
 		CFLAGS_OPTIMIZE="${CFLAGS}" \
 		LDFLAGS_OPTIMIZE="${LDFLAGS}" \
-		ARCH="$(tc-arch-kernel)" \
+		ARCH="${myarch}" \
 		NO_DEMANGLE=$(puse demangle) \
 		NO_LIBAUDIT=$(puse audit) \
 		NO_LIBPERL=$(puse perl) \
Comment 4 Naohiro Aota gentoo-dev 2013-11-17 04:53:07 UTC
Fix added to the tree.