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

Build error with protobuf branch 3.10.x #1

Closed
cwlseu opened this issue Mar 27, 2020 · 3 comments
Closed

Build error with protobuf branch 3.10.x #1

cwlseu opened this issue Mar 27, 2020 · 3 comments

Comments

@cwlseu
Copy link

cwlseu commented Mar 27, 2020

CXX google/protobuf/text_format.lo
google/protobuf/text_format.cc: In member function ‘virtual void google::protobuf::TextFormat::FastFieldValuePrinter::PrintFloat(float, google::protobuf::TextFormat::BaseTextGenerator*) const’:
google/protobuf/text_format.cc:1623:27: error: ‘__builtin_isnan’ is not a member of ‘std’
generator->PrintString(!std::isnan(val) ? SimpleFtoa(val) : "nan");
^
google/protobuf/text_format.cc:1623:27: note: suggested alternative:
: note: ‘__builtin_isnan’
google/protobuf/text_format.cc: In member function ‘virtual void google::protobuf::TextFormat::FastFieldValuePrinter::PrintDouble(double, google::protobuf::TextFormat::BaseTextGenerator*) const’:
google/protobuf/text_format.cc:1627:27: error: ‘__builtin_isnan’ is not a member of ‘std’
generator->PrintString(!std::isnan(val) ? SimpleDtoa(val) : "nan");
^
google/protobuf/text_format.cc:1627:27: note: suggested alternative:
: note: ‘__builtin_isnan’
Makefile:4019: recipe for target 'google/protobuf/text_format.lo' failed
make[1]: *** [google/protobuf/text_format.lo] Error 1
make[1]: Leaving directory '/home/xxxx/Repo/graph-learn/third_party/protobuf/protobuf/src'
Makefile:1723: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1

@cwlseu
Copy link
Author

cwlseu commented Mar 27, 2020

I have fix the compile error with the solution following, but I don't know why the two line result to the compile error, anyone know why? thanks.

diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc
index 8fc197a..be8231d 100644
--- a/src/google/protobuf/text_format.cc
+++ b/src/google/protobuf/text_format.cc
@@ -35,7 +35,7 @@
 #include <google/protobuf/text_format.h>

 #include <float.h>
-#include <math.h>
+#include <cmath>
 #include <stdio.h>

 #include <algorithm>

or update deps https://github.com/protocolbuffers/protobuf/tree/3.11.x

@cwlseu cwlseu changed the title Build error Build error with protobuf branch 3.10.x Mar 27, 2020
@jackonan
Copy link
Collaborator

Your OS and g++ version? It seems some error with your environment. Try to just build protobuf from source code may be a help.

@baoleai baoleai closed this as completed Mar 30, 2020
@cwlseu
Copy link
Author

cwlseu commented Apr 1, 2020

My OS is ubuntu 16.04 and g++ version is 5.4. The g++ version is build from source and In my system installed g++-4.9 & g++-5.5 concurrently. I think the problem may result from complex compiler envirnment. The problem isn't exist in a pure ubuntu16.04 with gcc 5.4 envirnment. Thanks.

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

3 participants