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

Preprocess fails #9

Closed
myrgy opened this issue Aug 16, 2018 · 5 comments
Closed

Preprocess fails #9

myrgy opened this issue Aug 16, 2018 · 5 comments

Comments

@myrgy
Copy link
Contributor

myrgy commented Aug 16, 2018

Hi,

When I'm trying to use pre-process, I'm getting this error:

// Generated by: /opt/gcc8/bin/g++ -I/home/user/Workspace/test/src/utils/include -I/home/user/Workspace/test/src/utils/include/utils -I/home/user/Workspace/test/src/core/include -I/home/user/Workspace/test/src/core/include/core -I/home/user/Workspace/test/src/core/include/core/v1 -I/home/user/Workspace/test/src/ttt/include -I/home/user/Workspace/test/include -I/home/user/Workspace/test/src -I/home/user/Workspace/test/vendor/spdlog/include/spdlog/fmt -I/home/user/Workspace/test/vendor/spdlog/include -I/home/user/Workspace/test/vendor/json/. -I/home/user/Workspace/test/vendor/MPMCQueue/include -I/home/user/Workspace/test/build/src/ttt/cboe -I/home/user/Workspace/test/vendor/HashMap/include -I/home/user/Workspace/test/vendor/CharConv/include -g -std=c++1z -fvisibility=hidden -Wall -Wextra -Wpedantic -Wno-unused-parameter -g -Werror -fPIC -c /home/user/Workspace/test/src/ttt/src/CFEBOEGateway.cpp -resource-dir=/home/user/Projects/ccls/Release/clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04/lib/clang/6.0.1 -working-directory=/home/user/Workspace/test/build/src/ttt -Wno-unknown-warning-optiong++: error: unrecognized command line option ‘-resource-dir=/home/user/Projects/ccls/Release/clang+llvm-6.0.1-x86_64-linux-gnu-ubuntu-16.04/lib/clang/6.0.1’
g++: error: unrecognized command line option ‘-working-directory=/home/user/Workspace/test/build/src/ttt’

I assume that issue is caused by fact, that I use gcc, while ccls convert compile_commands to clang.
I think it might be great to have ability to fetch original compile command and use it to perform preprocessing.

Thank you in advance!

@MaskRay
Copy link
Member

MaskRay commented Aug 18, 2018

-working-directory and -resource-dir are clang-specific options not known to GCC. When the first argument (compiler driver) is gcc, there might be some unavoidable processing to make up a runnable command line, but I'm not sure how this should be done.

@myrgy
Copy link
Contributor Author

myrgy commented Aug 18, 2018

I think there are 2 options - use gcc with original command line or perform call using clang, embedded into ccls.
UPD: here is rtags solution: https://github.com/Andersbakken/rtags/blob/4747d5b695bee40c3b0a2e3591ac8897571edd66/src/Preprocessor.cpp

@MaskRay
Copy link
Member

MaskRay commented Aug 30, 2018

This may be a somewhat ugly solution:

(nbutlast (gethash "args" (ccls-file-info)) 3)

But -working-directory= is also important. It gives the "directory": ... information.

@myrgy
Copy link
Contributor Author

myrgy commented Aug 31, 2018

Better than nothing! will give a try! Thanks!

@MaskRay
Copy link
Member

MaskRay commented Dec 22, 2018

Since this can be easily fixed I am closing this

@MaskRay MaskRay closed this as completed Dec 22, 2018
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