google / certificate-transparency

Auditing for TLS certificates.
https://certificate.transparency.dev
Apache License 2.0
869 stars 283 forks source link

Code Compilation Error #1404

Closed Sanghyun-Hong closed 6 years ago

Sanghyun-Hong commented 7 years ago

I tried to compile the source code by following the README file, and I faced the error below. Can I expect to know how I clear this issue?

$ make -C certificate-transparency check
make: Entering directory '/home/my_home/certificate-transparency/certificate-transparency'
make  check-am
make[1]: Entering directory '/home/my_home/certificate-transparency/certificate-transparency'
  CXX      cpp/log/leveldb_db.o
cpp/log/leveldb_db.cc: In member function ‘virtual cert_trans::ReadOnlyDatabase::LookupResult cert_trans::LevelDB::NodeId(std::__cxx11::string*)’:
cpp/log/leveldb_db.cc:357:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1plus: all warnings being treated as errors
Makefile:3191: recipe for target 'cpp/log/leveldb_db.o' failed
make[1]: *** [cpp/log/leveldb_db.o] Error 1
make[1]: Leaving directory '/home/my_home/certificate-transparency/certificate-transparency'
Makefile:3917: recipe for target 'check' failed
make: *** [check] Error 2
make: Leaving directory '/home/my_home/certificate-transparency/certificate-transparency'

Thanks.

Martin2112 commented 7 years ago

Hi,

It's because the compiler hasn't realized that Log(FATAL) at line 357 terminates the program.

Are you definitely building the code with a recent version of clang and did you follow the steps in the "Build Quick Start" instructions?

Martin

On 17 June 2017 at 18:20, HONG, SANGHYUN notifications@github.com wrote:

I tried to compile the source code by following the README file, and I faced the error below. Can I expect to know how I clear this issue?

$ make -C certificate-transparency check make: Entering directory '/home/my_home/certificate-transparency/certificate-transparency' make check-am make[1]: Entering directory '/home/my_home/certificate-transparency/certificate-transparency' CXX cpp/log/leveldb_db.o cpp/log/leveldb_db.cc: In member function ‘virtual cert_trans::ReadOnlyDatabase::LookupResult cert_trans::LevelDB::NodeId(std::__cxx11::string*)’: cpp/log/leveldb_db.cc:357:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1plus: all warnings being treated as errors Makefile:3191: recipe for target 'cpp/log/leveldb_db.o' failed make[1]: [cpp/log/leveldb_db.o] Error 1 make[1]: Leaving directory '/home/my_home/certificate-transparency/certificate-transparency' Makefile:3917: recipe for target 'check' failed make: [check] Error 2 make: Leaving directory '/home/my_home/certificate-transparency/certificate-transparency'

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/certificate-transparency/issues/1404, or mute the thread https://github.com/notifications/unsubscribe-auth/AMv2T-gpZ8XT7ihJJO3jTqDCJx06WL7iks5sFArHgaJpZM4N9SCd .

pphaneuf commented 7 years ago

You would need to follow a variant of the instructions in the "Compiler Warnings/Errors" section of the README:

https://github.com/google/certificate-transparency/blob/master/README.md#compiler-warningserrors

Specifically, add something like -Wno-error=return-type to CXXFLAGS (make sure you have at least the -O2, as well!).

Sanghyun-Hong commented 7 years ago

Hi @pphaneuf, I've been using the CXXFLAGS options as you recommended at the command line like:

$CXXFLAGS="-O2 -Wno-error=unused-variable -Wno-error=unused-local-typedefs -Wno-error=return-type" gclient sync

And it seems that the CXXFLAGS were not passed correctly to the each compilation process. I could see this message:

./configure --prefix=/home/dct/certificate-transparency/install --disable-minidebuginfo --disable-shared --enable-static _CXXFLAGS="-fPIC"_ CFLAGS="-fPIC"

In addition, the entire process has stopped with the following error:

make -C python
make[2]: Entering directory '/home/dct/certificate-transparency/certificate-transparency/python'
/home/dct/certificate-transparency/install/bin/protoc ct/proto/client.proto -I/usr/include/ -I/usr/local/include -I/home/dct/certificate-transparency/install/include -I. --python_out=.
google/protobuf/descriptor.proto:388:3: Expected "required", "optional", or "repeated".
google/protobuf/descriptor.proto:388:12: Expected field name.
ct/proto/tls_options.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
ct/proto/tls_options.proto:89:8: "google.protobuf.FieldOptions" is not defined.
ct/proto/tls_options.proto:94:8: "google.protobuf.EnumOptions" is not defined.
ct/proto/client.proto: Import "ct/proto/tls_options.proto" was not found or had errors.
Makefile:8: recipe for target 'ct/proto/client_pb2.py' failed
make[2]: *** [ct/proto/client_pb2.py] Error 1
make[2]: Leaving directory '/home/dct/certificate-transparency/certificate-transparency/python'
Makefile:4101: recipe for target 'all-local' failed
make[1]: *** [all-local] Error 2
make[1]: Leaving directory '/home/dct/certificate-transparency/certificate-transparency'
Makefile:3917: recipe for target 'check' failed
make: *** [check] Error 2
make: Leaving directory '/home/dct/certificate-transparency/certificate-transparency'

I couldn't understand why it's not passing or why this error caused... :(

00theway commented 6 years ago

in the file cpp/log/leveldb_db.cc on line 357 missing a return value. on line 1248 in the makefile there was a -Wall parameter,remove it everything will pass.

pphaneuf commented 6 years ago

Ah, you might have an older version of the glog library. The LOG(FATAL) will never return, and older versions of that library were missing an attribute to indicate this, which caused the compiler to think the function was missing a return value.