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

Fix gcc6 issues - add explicit c++98 compile and link flag #116

Merged

Conversation

mateidavid
Copy link
Contributor

As per https://gcc.gnu.org/gcc-6/changes.html , the default C++ dialect in GCC 6 is updated from GNU++98 all the way to GNU++14. This causes compile errors for C++ programs that are not C++14 (or C++11) compliant, and do not request a specific dialect. As pointed out in #115 , such issues prevent BamTools from being built with GCC 6.

This pull request explicitly adds -std=c++98 to both compile and link flags (i.e., to CXXFLAGS), which is one way of allowing BamTools 2.4.0 to be built with GCC 6.0.0.

The caveat of doing this is that the libraries produced will (if I understand correctly) use the C++98 ABI, and they might get used in a system based on the C++14 ABI. Some ABI differences are explained here: https://gcc.gnu.org/wiki/Cxx11AbiCompatibility (I couldn't find a similar document regarding C++14). A quick glance suggests libbamtools.{a,so} do not use any problematic symbols, but this is not a guarantee, and compatibility might be broken in the future.

An alternative way of making BamTools more GCC 6 friendly would be to address dialect differences, one by one.

@mateidavid
Copy link
Contributor Author

Here is a Dockerfile based on Debian Experimental using GCC 6.0.0 demonstrating the build (thanks @mr-c):

# BamTools version 2.4.0 on Debian Experimental (gcc 6.0.0)
#
FROM debian:experimental

# install g++, make
RUN apt-get update && apt-get install -y -t experimental build-essential

# install other build tools
RUN apt-get update && apt-get install -y cmake git zlib1g-dev

# download sources
RUN mkdir /src && \
    cd /src && \
    git clone --branch add-c++98-compile-and-link-flag --depth 1 https://github.com/mateidavid/bamtools.git
#    git clone --branch v2.4.0 --depth 1 https://github.com/pezmaster31/bamtools.git

# build and install
RUN mkdir -p /src/bamtools/build && \
    cd /src/bamtools/build && \
    cmake .. && \
    make && \
    make install

@mr-c
Copy link
Contributor

mr-c commented Feb 4, 2016

@mateidavid Happy to help! Yes, specifying -std=c++98 is how I was going to patch the source if it wasn't incorporated here or otherwise addressed.

@pezmaster31 pezmaster31 merged commit 4f0f36a into pezmaster31:master Jun 29, 2016
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

Successfully merging this pull request may close these issues.

None yet

3 participants