vulgatecn / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

armv7l compilation fails under -std=c++11 (works under -std=gnu++11) (was: Cant compile gproftools with armv7l) #667

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi!

I compile gpreftools and receive error:

/usr/bin/c++ -DHAVE_CONFIG_H -I. -I./src -I./src -DNO_TCMALLOC_SAMPLES 
-DNO_TCMALLOC_SAMPLES -DNO_HEAP_CHECK -pthread -DNDEBUG -Wall -Wwrite-strings 
-Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free 
-fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree 
-fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc 
-fno-builtin-pvalloc -Wno-unused-result -fno-exceptions -std=c++11 -MT 
src/libtcmalloc_minimal_internal_la-malloc_hook.lo -MD -MP -MF 
src/.deps/libtcmalloc_minimal_internal_la-malloc_hook.Tpo -c src/malloc_hook.cc 
 -fPIC -DPIC -o src/.libs/libtcmalloc_minimal_internal_la-malloc_hook.o
In file included from src/malloc_hook_mmap_linux.h:47:0,
                 from src/malloc_hook.cc:667:
src/base/linux_syscall_support.h: In function ‘pid_t sys_getpid()’:
src/base/linux_syscall_support.h:1304:33: error: expected string-literal before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2111:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getpid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘(’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2111:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getpid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected primary-expression 
before ‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2111:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getpid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘)’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2111:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getpid)
              ^
src/base/linux_syscall_support.h: In function ‘pid_t sys_getppid()’:
src/base/linux_syscall_support.h:1304:33: error: expected string-literal before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2112:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getppid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘(’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2112:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getppid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected primary-expression 
before ‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2112:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getppid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘)’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2112:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   getppid)
              ^
src/base/linux_syscall_support.h: In function ‘pid_t sys__gettid()’:
src/base/linux_syscall_support.h:1304:33: error: expected string-literal before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2113:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   _gettid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘(’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2113:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   _gettid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected primary-expression 
before ‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2113:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   _gettid)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘)’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2113:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(pid_t,   _gettid)
              ^
src/base/linux_syscall_support.h: In function ‘int sys_sched_yield()’:
src/base/linux_syscall_support.h:1304:33: error: expected string-literal before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2143:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(int,     sched_yield)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘(’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2143:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(int,     sched_yield)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected primary-expression 
before ‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2143:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(int,     sched_yield)
              ^
src/base/linux_syscall_support.h:1304:33: error: expected ‘)’ before 
‘:’ token
                                 : "lr", "memory");                            \
                                 ^
src/base/linux_syscall_support.h:1310:9: note: in expansion of macro 
‘LSS_BODY’
         LSS_BODY(type, name);                                                 \
         ^
src/base/linux_syscall_support.h:2143:14: note: in expansion of macro 
‘_syscall0’
   LSS_INLINE _syscall0(int,     sched_yield)
              ^

configure options:
./configure CXX=/usr/bin/c++ CC=/usr/bin/cc CXXFLAGS="-std=c++11" 
--enable-minimal --disable-debugalloc --enable-static=no

g++ -v
Using built-in specs.
COLLECT_GCC=/usr/bin/g++-4.8.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 
4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs 
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.8 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls 
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap 
--disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib 
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf/jre --enable-java-home 
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf 
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-armhf 
--with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar 
--enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions 
--with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb 
--disable-werror --enable-checking=release --build=arm-linux-gnueabihf 
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.8.2 (Ubuntu/Linaro 4.8.2-19ubuntu1)

Original issue reported on code.google.com by php...@gmail.com on 21 Jan 2015 at 5:04

GoogleCodeExporter commented 9 years ago
Weird. Everything works on my arm chromebook (though I run debian sid). Please 
list the following to help me:

* cat /proc/cpuinfo

* your dpkg arch: dpkg --version and dpkg --print-architecture

* and your version of gperftools

* what is your ubuntu version

* also please double-check that c++ is g++. I.e. by running c++ -v

Original comment by alkondratenko on 21 Jan 2015 at 6:26

GoogleCodeExporter commented 9 years ago
gperftools version: 2.4

Additional information:

root@odroid-1:/tmp# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 1 (v7l)
processor   : 0
BogoMIPS    : 3.27

processor   : 1
BogoMIPS    : 3.27

processor   : 2
BogoMIPS    : 3.27

processor   : 3
BogoMIPS    : 3.27

Features    : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xc05
CPU revision    : 1

Hardware    : ODROIDC
Revision    : 000a
Serial      : 1b00000000000000

root@odroid-1:/tmp# dpkg --version
Debian `dpkg' package management program version 1.17.5 (armhf).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.

root@odroid-1:/tmp# dpkg --print-architecture
armhf

root@odroid-1:/tmp# cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.1 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.1 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

root@odroid-1:/tmp# c++ -v
Using built-in specs.
COLLECT_GCC=/usr/bin/g++-4.8.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 
4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs 
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.8 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls 
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap 
--disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib 
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf/jre --enable-java-home 
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf 
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-armhf 
--with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar 
--enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions 
--with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb 
--disable-werror --enable-checking=release --build=arm-linux-gnueabihf 
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.8.2 (Ubuntu/Linaro 4.8.2-19ubuntu1)

This system is are ODROID-C1: 
http://www.hardkernel.com/main/products/prdt_info.php?g_code=G141578608433

Original comment by php...@gmail.com on 21 Jan 2015 at 7:12

GoogleCodeExporter commented 9 years ago
Thanks. I'll get myself ubuntu 14.04 and try it out. I.e. my box is also armhf 
and arm7l.

This looks very weird. Like inline assembly is not recognized.

Original comment by alkondratenko on 21 Jan 2015 at 7:15

GoogleCodeExporter commented 9 years ago
The issue is not in code but in the way you configure it.

When I change --std=c++11 to --std=gnu++11 it works. What is the purpose of 
trying to build it in --std=c++11 ?

Original comment by alkondratenko on 22 Jan 2015 at 6:31

GoogleCodeExporter commented 9 years ago
hm. it looks like __SYS_REG_LIST macro behaves differently in c++11 and gnu++11 
mode. Avoid -std=c++11 for now

Original comment by alkondratenko on 22 Jan 2015 at 6:48

GoogleCodeExporter commented 9 years ago

Original comment by alkondratenko on 22 Jan 2015 at 6:48

GoogleCodeExporter commented 9 years ago
Specifically I've verified that this:

#define __SYS_REG_LIST(regs...) [sysreg] "r" (__sysreg) , ##regs

expands to: [sysreg] "r" (__sysreg)
(no trailing comma) when regs are empty in normal mode

and to: [sysreg] "r" (__sysreg) ,
(trailing comma) when regs are empty in c++11 mode

Original comment by alkondratenko on 22 Jan 2015 at 6:52