ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.47k stars 888 forks source link

amalgamate/crow_all.h:9551:14: internal compiler error: in write_expression, with gcc 7.3 on Fedora 28 #303

Open fangqiao opened 6 years ago

fangqiao commented 6 years ago

Recently I am working on a project using crow to expose some REST api.

It used to compile well on archlinux and centos with gcc 7.3.

Now I tested it on fedora 28. With gcc 8 coming with Fedora 28 and then gcc 7.3 I manually installed, such compilation error occured:

amalgamate/crow_all.h:9551:14: internal compiler error: in write_expression, at cp/mangle.c:3047
         auto route(std::string&& rule)
              ^~~~~
Please submit a full bug report,
with preprocessed source if appropriate.

I understand it is most likely a gcc bug on Fedora 28 environment but I can't wait for a fix from gcc. Is there any idea how to quickly fix this problem from crow code ?

Thanks,

Update:

Using clang compilation passed. It is indeed a gcc bug. I leave the issue here for reference.

br3gan commented 6 years ago

Same on Arch since GCC 8.1.0 update.

Edit: GCC 8.1.1 update did not fix the issue. I guess we will have to wait.

If clang is not an option, you can still install GCC 7.3.0 from AUR (you can find it under the name gcc-7) and use it explicitly for your compilation. Worked for me.

khairy-mohamed commented 6 years ago

same problem on arch . any solution !!!!??

fangqiao commented 6 years ago

In the original issue:

Update:

Using clang compilation passed. It is indeed a gcc bug. I leave the issue here for reference.

moneroexamples commented 6 years ago

Using clang (6.0.0) on Arch also works. Have to wait till gcc 8.1 gets fixed.

khairy-mohamed commented 6 years ago

for someone if need to solve this issue :: https://stackoverflow.com/questions/7031126/switching-between-gcc-and-clang-llvm-using-cmake

moneroexamples commented 6 years ago

This also happens on the newest gcc 8.2.

ilejn commented 5 years ago

Is amalgamation required condition to observe this issue? IOW, is anyone who does not use amalgamation seeing this?

CircuitCoder commented 5 years ago

For anyone who is using gcc 8 and met this issue, and is willing to use c++1y features, you may change the definition of the route function to use auto return type deduction, and remove the trailing return type.

template <uint64_t Tag>
auto& route(std::string&& rule)
{
  //...
}

Then it should compile with gcc.

mwm126 commented 5 years ago

Did you get it to build with the above workaround? I am getting an error after removing the trailing return type as suggested above:

/usr/bin/c++ --version
c++ (Ubuntu 8.2.0-7ubuntu1) 8.2.0
/usr/bin/c++   -Icrow/include  -std=c++11 -o foo.o -c foo.cpp
In file included from crow/include/crow.h:23,
                 from crow/crowmfix.h:1,
                 from crowmfix.cpp:13:
crow/include/crow/app.h:62:38: error: ‘route’ function uses ‘auto’ type specifier without trailing return type
         auto& route(std::string&& rule)
nicktrandafil commented 5 years ago

@mwm126 You should use -std=c++1y, but not -std=c++11

mwm126 commented 5 years ago

Oh thank you, yeah that worked.

ricargoes commented 5 years ago

I had the same problem a while ago and I froze the gcc version I was using. However, I just tried compiling with gcc 9.1.0 and it worked

moneroexamples commented 5 years ago

@ricargoes

Good it worked. Though it does not change the fact that crow is pretty much dead at this point. The last commit was in 2017.

sdaveas commented 5 years ago

GCC 9 fixed the error on arch as well.