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

Error using gcc 8.1.0 on Ubuntu 14.04 #1207

Closed
bravecorvus opened this issue Aug 21, 2018 · 6 comments
Closed

Error using gcc 8.1.0 on Ubuntu 14.04 #1207

bravecorvus opened this issue Aug 21, 2018 · 6 comments

Comments

@bravecorvus
Copy link

bravecorvus commented Aug 21, 2018

  • What is the issue you have?
    Using the default Ubuntu build environment for cpp on Travis-CI, I am getting a #unsupported GCC version despite installing gcc-8 from the ubuntu-toolchain-r-test apt repository and setting the cmake C++ compiler to use g++ 8.1.0 (by setting it in the command line options via cmake -D -CMAKE_CXX_COMPILER="/usr/bin/cpp-8").

The result of cpp-8 --version is:

cpp-8 (Ubuntu 8.1.0-5ubuntu1~14.04) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Furthermore, swapping "/usr/bin/cpp-8" with "/usr/bin/gcc-8" gives me the same error.

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
  1. Create a new Github repository and hook it up to Travis CI.
  2. Define the environment variables VIAPIKEY and VIAPITOKEN in the repository's environment variables by signing up for a free account on my company's website voiceit.io API version 2.
  3. In your repository, do the following:
wget https://raw.githubusercontent.com/voiceittech/voiceit2-cpp/master/Test.cpp
wget https://raw.githubusercontent.com/voiceittech/voiceit2-cpp/master/VoiceIt2.hpp
wget https://raw.githubusercontent.com/voiceittech/voiceit2-cpp/master/json.hpp
  1. Add a .travis.yml as follows:
language: cpp
compiler: gcc
addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - gcc-8
      - libssl-dev
      - cmake
before_script:
  - git submodule add https://github.com/whoshuu/cpr.git
  - git submodule update --init --recursive
  - echo "set (CMAKE_CXX_STANDARD 11)" > CMakeLists.txt
  - echo "project (Tests)" >> CMakeLists.txt
  - echo "cmake_minimum_required(VERSION 2.8.12)" >> CMakeLists.txt
  - echo "add_subdirectory(cpr)" >> CMakeLists.txt
  - echo "include_directories(\${CPR_INCLUDE_DIRS})" >> CMakeLists.txt
  - echo "add_executable(Tests Test.cpp)" >> CMakeLists.txt
  - echo "target_link_libraries(Tests \${CPR_LIBRARIES})" >> CMakeLists.txt
  - gcc-8 --version
  - cpp-8 --version
  - cmake -D -CMAKE_CXX_COMPILER="/usr/bin/gcc-8"
  - make
script: "./Tests"
  1. git add . && git commit -m "message" && git push origin master
    Note: The reason you aren't just going to fork the project is because Travis is kind of a pain to set up on forked repos.
  • What is the expected behavior?
    No compiler error since we are using gcc 8.1.0

  • And what is the actual behavior instead?
    error: #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"

  • Which compiler and operating system are you using? Is it a supported compiler?

cpp-8 (Ubuntu 8.1.0-5ubuntu1~14.04) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

on Ubuntu 14.04 LTS.

Also tried setting it to use gcc-8 instead of cpp-8 which is version:

gcc-8 (Ubuntu 8.1.0-5ubuntu1~14.04) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

which should be in the range of gcc 4.9 ~ gcc 8.2

  • Did you use a released version of the library or the version from the develop branch?

No I specifically used version 3.1.2 since the new 3.2.0 version increased the number of dependencies for my project (json_fwd.hpp).

check out the logs for my Travis CI build. Specifically, search the page for "gcc-8 --version" which will show the gcc version. The error might not actually show up unless you check out the raw logs.

@theodelrieu
Copy link
Contributor

FYI json_fwd.hpp was introduced in 3.1.0, there is no plan to drop the single header support, you can upgrade to newer versions without adding any other files besides json.hpp

@bravecorvus
Copy link
Author

bravecorvus commented Aug 21, 2018

I am using json.hpp as a single header file (which works well minimizing dependencies for the project I am working on). Using the latest development json.hpp version 3.2.0 from here causes the following error:

/home/travis/build/voiceittech/voiceit2-cpp/json.hpp:49:33: fatal error: nlohmann/json_fwd.hpp: No such file or directory
 #include <nlohmann/json_fwd.hpp>

Logs for the above problem is here.

I would much rather using the single file header format if possible (rather than adding more stuff to the cmake build chain).

Update:
I also looked at nlohmann/json's Travis build script for gcc-8, and modified my script to install g++-8 rather than gcc-8 to which produces the same error.

The logs to using g++-8 on nlohmann/json version 3.1.2 is here.

@bravecorvus
Copy link
Author

Ahh, but using the json.hpp version 3.2.0 from the Release section (rather than the development branch) doesn't give me the json_fwd.hpp error. However, it still is giving me the #error "unsupported GCC version error.

logs

@theodelrieu
Copy link
Contributor

There might have been a versionning scheme change from GCC which makes the compiler detection fail... I cannot check that at the moment unfortunately.

@theodelrieu
Copy link
Contributor

Could you compile a test program printing the following macro values?

__GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__

@bravecorvus
Copy link
Author

Ahh, I just had to override the CC and CXX environment variables to point to use gcc-8 and g++-8 respectively before running make. Sorry for the confusion. I assumed I would be able to pass these via command line variables. Thanks for the help!

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

2 participants