Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Failed to build gem native extension under linux #10

ruanwz opened this Issue Aug 2, 2010 · 2 comments


None yet
2 participants

ruanwz commented Aug 2, 2010

when installing from git source, it gets the following error:

gcc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DRUBY18 -DHAVE_RB_DURING_GC -D_FILE_OFFSET_BITS=64 -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c perftools.c
perftools.c: In function ‘uc_get_ip’:
perftools.c:314: error: ‘REG_RIP’ undeclared (first use in this function)
perftools.c:314: error: (Each undeclared identifier is reported only once
perftools.c:314: error: for each function it appears in.)

To fix this error, I changed the perftools.c as following:

+#define __USE_GNU

-return (void**)&uc->uc_mcontext.gregs[REG_RIP];

+return (void**)&uc->uc_mcontext.gregs[REG_EIP];

Then, the tool can be installed and run successfully under ubuntu linux 10.04.


tmm1 commented Aug 19, 2010

can you try this patch:

diff --git a/ext/perftools.c b/ext/perftools.c
index 4226c64..c641fb9 100644
--- a/ext/perftools.c
+++ b/ext/perftools.c
@@ -319,7 +319,11 @@ uc_get_ip(ucontext_t *uc) {
 #     define program_counter uc_mcontext->__ss.__eip
 #   endif
 # else
-#  define program_counter uc_mcontext.gregs[REG_RIP]
+#    ifdef REG_RIP
+#      define program_counter uc_mcontext.gregs[REG_RIP]
+#    else
+#      define program_counter uc_mcontext.gregs[REG_EIP]
+#    endif
 # endif
   return (char**)&uc->program_counter;

ruanwz commented Aug 19, 2010

The latest commit fixed this issue. Thanks!

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment