Alabate / docker-clang-tools

Simple docker image that contains clang-format and git
MIT License
2 stars 0 forks source link

Header files not found #1

Open Resisty opened 7 years ago

Resisty commented 7 years ago

Hello,

First of all, thanks for your docker image; I was hoping to find a docker image to do linting against c++ projects!

However, I'm running into a lot of errors, more than I'd expect, when I run:

brian@local ~/project/src/code 🍔  docker run -it -v $PWD:/code \
-w /code \
alabate/clang-tidy \
/usr/bin/clang-format *.cpp \
-checks=boost-*,cppcoreguidelines-*,clang-analyzer-*

For example:

/code/file1.cpp:28:10: error: 'string' file not found [clang-diagnostic-error]
#include <string>
         ^
/code/file1.cpp:28:10: error: 'string.h' file not found [clang-diagnostic-error]
#include <string.h>
         ^

I found some references to g++/libstdc++ at https://stackoverflow.com/questions/26333823/clang-doesnt-see-basic-headers but I'm not sure how to apply it to a docker image. Any help or tips are much appreciated, thanks!

Alabate commented 7 years ago

Maybe that's because those headers are not inside the image. If you try to run this inside the container before running your test, does that fix your problem ?

apt-get install build-essential
Resisty commented 7 years ago

Hey, thanks for your reply! I talked to some folks after the fact and the project relies on devtoolset-6 being installed. Since that limits it to CentOS, I’m going to have to try and figure out how to get clang-tidy on a centos container. You can close this issue (I’m replying via email), but thanks again! On Fri, Oct 20, 2017 at 00:47 Aurélien Labate notifications@github.com wrote:

Maybe that's because those headers are not inside the image. If you try to run this inside the container before running your test, does that fix your problem ?

apt-get install build-essential

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Alabate/docker-clang-tools/issues/1#issuecomment-338132242, or mute the thread https://github.com/notifications/unsubscribe-auth/AFFaoBBtYNygkk_B00Zs3t6dKA3mg7GOks5suFAogaJpZM4P__Bm .

mastereuclid commented 5 years ago

I needed to sudo apt-get install libstdc++-9-dev