crow icon indicating copy to clipboard operation
crow copied to clipboard

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

Open fangqiao opened this issue 7 years ago • 14 comments

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.

fangqiao avatar May 04 '18 08:05 fangqiao

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.

br3gan avatar May 08 '18 06:05 br3gan

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

khairy-mohamed avatar May 10 '18 13:05 khairy-mohamed

In the original issue:

Update:

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

fangqiao avatar May 11 '18 02:05 fangqiao

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

moneroexamples avatar May 13 '18 04:05 moneroexamples

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

khairy-mohamed avatar May 22 '18 23:05 khairy-mohamed

This also happens on the newest gcc 8.2.

moneroexamples avatar Aug 07 '18 23:08 moneroexamples

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

ilejn avatar Sep 27 '18 19:09 ilejn

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.

CircuitCoder avatar Nov 10 '18 22:11 CircuitCoder

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)

mwm126 avatar Nov 15 '18 20:11 mwm126

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

nicktrandafil avatar Nov 15 '18 22:11 nicktrandafil

Oh thank you, yeah that worked.

mwm126 avatar Nov 15 '18 22:11 mwm126

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

ricargoes avatar May 18 '19 14:05 ricargoes

@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.

moneroexamples avatar May 18 '19 23:05 moneroexamples

GCC 9 fixed the error on arch as well.

sdaveas avatar Jun 18 '19 16:06 sdaveas