Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot compile libdatadog common.h on gcc 4.9.2 #47

Closed
ivoanjo opened this issue Aug 31, 2022 · 1 comment
Closed

[BUG] Cannot compile libdatadog common.h on gcc 4.9.2 #47

ivoanjo opened this issue Aug 31, 2022 · 1 comment

Comments

@ivoanjo
Copy link
Member

ivoanjo commented Aug 31, 2022

Describe the bug

While upgrading the Ruby profiler to use libdatadog 0.8.0, I ran into the following issue:

In file included from /usr/local/bundle/gems/libdatadog-0.8.0.1.0-x86_64-linux/vendor/libdatadog-0.8.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/profiling.h:11:0,
                 from ../../../../ext/ddtrace_profiling_native_extension/collectors_stack.h:3,
                 from ../../../../ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.c:4:
/usr/local/bundle/gems/libdatadog-0.8.0.1.0-x86_64-linux/vendor/libdatadog-0.8.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/common.h:24:52: error: missing binary operator before token "("
 #elif (defined(__has_attribute) && (__has_attribute(warn_unused_result))) || \
                                                    ^
Makefile:237: recipe for target 'collectors_cpu_and_wall_time.o' failed
make: *** [collectors_cpu_and_wall_time.o] Error 1

Looking through the gcc docs this issue seems to be documented in https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html and we seem to be using defined(__has_atribute) incorrectly.

This issue seems to be introduced in #24

To Reproduce

Steps to reproduce the behavior:

Use the ivoanjo/docker-library:ddtrace_rb_2_2_10 docker image to get a suitable old version of gcc:

$ docker run --network=host -ti -v `pwd`:/working ivoanjo/docker-library:ddtrace_rb_2_2_10 /bin/bash
root@docker-desktop:/app# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10+deb8u1' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --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.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Debian 4.9.2-10+deb8u1)

and try to compile anything that includes that header.

Expected behavior

Compiling libdatadog on this gcc version should ideally still be possible.

Errors or warnings received

(See above)

How does libdatadog help you?

There's quite a lot of code on the Ruby profiler that I'll be able to delete soon ;)

@ivoanjo
Copy link
Member Author

ivoanjo commented Sep 29, 2022

Fixed by #48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant