Closed GaryN4 closed 3 years ago
Provide output from CC=.... ./configure
and config.log
Env appears to be centos 7 (which has default gcc 4.8.5 with devtoolset8 installed). Ref: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/ On first look may appear to be an effect of the build env, rather then the Kafka build
Using these steps with a basic C program has the same effect.
Example main.c program
#include <stdio.h>
void main(int argc,char** argv)
{
printf("hello\n");
}
With centos 7 and devtoolset-8, run
scl enable devtoolset-8 bash
gcc main.c -o main
strings main | grep -i gcc | grep -i GNU
See similar output to original issue:
GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-39)
GCC: (GNU) 8.3.1 20190311 (Red Hat 8.3.1-3)
Reference Dockerfile env (remembering to run scl enable devtoolset-8 bash when inside container to switch to devtoolset env)
FROM centos:7
RUN yum -y install centos-release-scl && \
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ && \
yum -y install autoconf automake libtool && \
yum -y install gcc gcc-c++ && \
yum -y install cmake make && \
yum -y install wget file && \
yum -y install vim
RUN yum clean all
RUN mkdir -p /source/kafka && cd /source/kafka && wget https://github.com/edenhill/librdkafka/archive/v1.4.2.tar.gz && tar xvf v1.4.2.tar.gz --strip-components=1
WORKDIR /source/kafka
CMD ["/bin/bash"]
docker build -f Dockerfile.build -t kafkadevtools . docker run --rm -it kafkadevtools /bin/bash -c "scl enable devtoolset-8 bash"
Thanks for the repro Dockerfile.
librdkafka itself seems to be built with the proper toolchain:
[root@3f598871858e kafka]# strings src/librdkafka.so.1 | grep -i gcc | grep -i gnu
GCC GXX PKGCONFIG INSTALL GNULD LIBDL PLUGINS HDRHISTOGRAM SYSLOG SNAPPY SOCKEM CRC32C_HW
GCC: (GNU) 8.3.1 20190311 (Red Hat 8.3.1-3)
But applications will be statically linked with something that is built with an older toolchain, such as crt0, which I guess is not all that surprising:
[root@3f598871858e kafka]# strings examples/producer | grep -i gcc | grep -i gnu
GCC GXX PKGCONFIG INSTALL GNULD LIBDL PLUGINS HDRHISTOGRAM SYSLOG SNAPPY SOCKEM CRC32C_HW
GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-39)
GCC: (GNU) 8.3.1 20190311 (Red Hat 8.3.1-3)
Apologies about the delay in replying. That makes sense, thank you.
Description
I have tried to compiling librdkafka with gcc 8 (c++17, abi=1) and it is successful, but when I check strings I see the following:
$ find . -name "*" -print | xargs strings --print-file-name | grep -i gcc | grep 4.8.5 | grep -i GNU ./lib/librdkafka.so.1: GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./lib/librdkafka.so: GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/rdkafka_example: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/rdkafka_performance: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/rdkafka_complex_consumer_example: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/rdkafka_example_cpp: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/producer: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/rdkafka_complex_consumer_example_cpp: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/consumer: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/idempotent_producer: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/examples/kafkatest_verifiable_client: "SGCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/src/librdkafka.so.1: GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36) ./source_subfolder/src/librdkafka.so: GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36)
It appears that it is hardcoded in some where in the code to use the default gcc and ignore CC & CXX env vars.
How to reproduce
Set:
CC=/opt/rh/devtoolset-8/root/usr/bin/gcc CXX=/opt/rh/devtoolset-8/root/usr/bin/g++
compile check strings output:find . -name "*" -print | xargs strings --print-file-name | grep -i gcc | grep 4.8.5 | grep -i GNU
Checklist
IMPORTANT: We will close issues where the checklist has not been completed.
Please provide the following information:
1.3.0
N/A
N/A
auto.reset.offset=earliest, ..>`CentOS 7.5.1804 (x64)