[BUG]: API compile request claims it can't find external header file
See original GitHub issueDescribe the bug
On this location: https://github.com/compiler-explorer/compiler-explorer/blob/main/docs/API.md#post-apicompilercompiler-idcompile---perform-a-compilation-1 it is described how one can use the API to trigger a build.
Indeed, this:
curl 'https://godbolt.org/api/compiler/g63/compile?options=-Wall' --data-binary $'#include <iostream> \n int main() {}'
works fine (please note the usage of the $'text\ntext'
to get the required EOL)
However, when attempting to do the same using an external header file, it fails, claiming it can’t access the file (although the path is perfectly fine). For example, this fails:
curl 'https://godbolt.org/api/compiler/g63/compile?options=-Wall' --data-binary $'#include "https://raw.githubusercontent.com/skramm/homog2d/master/homog2d.hpp"\nint main() {}'
Output:
# Compilation provided by Compiler Explorer at https://godbolt.org/
<Compilation failed>
# Compiler exited with result code 1
Standard error:
<source>:1:79: fatal error: https://raw.githubusercontent.com/skramm/homog2d/master/homog2d.hpp: No such file or directory
#include "https://raw.githubusercontent.com/skramm/homog2d/master/homog2d.hpp"
^
compilation terminated.
Steps to reproduce
Steps to reproduce: 1: run this in a (Linux) shell:
curl 'https://godbolt.org/api/compiler/g63/compile?options=-Wall' --data-binary $'#include "https://raw.githubusercontent.com/skramm/homog2d/master/homog2d.hpp"\nint main() {}'
Direct link to the file, for conveniency: https://raw.githubusercontent.com/skramm/homog2d/master/homog2d.hpp
Expected behavior
- expected result: build starts and curl returns some data
- observed result: curl return a message from CE, claiming it can not access the file.
Reproduction link
Not applicable
Screenshots
Not applicable
Operating System
Ubuntu 20.04.5
Browser version
No response
Issue Analytics
- State:
- Created 9 months ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Compile errors for external headers - Visual Studio Feedback
Basically, moving the two headers included with the ZIP file out of the project folder and into a folder in the include path...
Read more >Top 10 C++ header file mistakes and how to fix them
Recommendation: Check your header filies by compiling them in isolation via a testMain.cpp that includes nothing but the header file under test.
Read more >Where does Visual Studio look for C++ header files?
Visual Studio looks for headers in this order: In the current source directory. In the Additional Include Directories in the project properties (Project ......
Read more >CLion fails to find some of my headers. Where does it search ...
CLion searches through the same places CMake does. Set the include_directories variable in CMake to provide the headers path to the IDE.
Read more >Cannot find header files defined in compile_command that is ...
Create a header file in another directory that is not a parent of the project directory. Generate compile_command.json to have the header file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
(Leaving this open until we fix the docs yes)
Thanks for taking the time to file the original report with such detail btw, really appreciated 😃
It’s not likely as that will need to be maintained separately without us actually using it. It would involve simulating what the frontend does on a compile (“compile this as this human intended” - which is not obvious in the encoding of shortlinks - plus needing to implement the download for url includes and all other things we do) and then having to return an array of compilations instead of just 1.