Https://issues.apache.org/jira/browse/THRIFT-1824
Background:
When thrift is used, if our code is also compiled in automake mode, config exists. h file conflict, because thrift's thread. when an H file is included, there is no directory modification.
Config. h:
After thrift is compiled, a config. h file is generated in the thrift directory. This file is actually generated by automake, as shown below:
> Ls Thrift
Async config. h protocol server tdispatchprocessor. h tlogging. h transport
Concurrency processor QT tapplicationexception. h thrift. h tprocessor. h treflectionlocal. h
Concurrency/thread. h:
In thread. the H header file contains this header file. Unfortunately, it is thread. H is an external public file, that is, thrift will directly see it, and config. H is included without any directory modification, which is the reason for receiving a large number of compilation warnings.
# Ifdef have_config_h
# Include <config. h>
# Endif
Error message:
You only need to comment out the # include <config. h> in thread. H, and a large number of compilation warnings can be sent, and thrift compilation is no problem.
Make [2]: Entering directory '@_@'
If G ++-dhave_config_h-I. -I. -I .. /.. -I .. /.. -I .. /.. /.. /third-party/Boost/include-I .. /.. /.. /third-party/thrift/include-I .. /.. /.. /third-party/SQLite/include-I .. /.. /.. /third-party/gflags/include-I .. /.. /.. /third-party/glog/include-I .. /.. /.. /third-party/libevent/include
-I .. /.. /.. /third-party/MySQL/include-d_gnu_source-rdynamic-wall-FPIC-g-MT executorservice_server.skeleton.o-MD-MP-MF ". deps/executorservice_server.skeleton.tpo "-c-o executorservice_server.skeleton.o 'test-F '. /executorservice_server.skeleton.cpp'
| Echo './'./executorservice_server.skeleton.cpp ;\
Then MV-F ". deps/executorservice_server.skeleton.tpo" ". deps/executorservice_server.skeleton.po"; else Rm-F ". deps/timeout"; Exit 1; FI
In file encoded ded from.../third-party/thrift/include/thrift/concurrency/thread. h: 28,
From.../third-party/thrift/include/thrift/Server/tserver. h: 26,
From.../third-party/thrift/include/thrift/Server/tsimpleserver. h: 23,
From./executorservice_server.skeleton.cpp: 6:
.../../Config. h: 44: 1: Warning: "package" redefined
In File sorted ded from.../third-party/thrift/include/thrift/tlogging. h: 24,
From.../third-party/thrift/include/thrift. h: 51,
From.../third-party/thrift/include/thrift/transport/tTransport. h: 23,
From.../third-party/thrift/include/thrift/protocol/tprotocol. h: 23,
From.../third-party/thrift/include/thrift/tprocessor. h: 24,
From.../third-party/thrift/include/thrift/tdispatchprocessor. h: 22,
From./executorservice. h: 10,
From./executorservice_server.skeleton.cpp: 4:
.../Third-party/thrift/include/thrift/config. h: 263: 1: Warning: this is the location of the previous definition
In file encoded ded from.../third-party/thrift/include/thrift/concurrency/thread. h: 28,
From.../third-party/thrift/include/thrift/Server/tserver. h: 26,
From.../third-party/thrift/include/thrift/Server/tsimpleserver. h: 23,
From./executorservice_server.skeleton.cpp: 6:
.../../Config. h: 47: 1: Warning: "package_bugreport" redefined
In File sorted ded from.../third-party/thrift/include/thrift/tlogging. h: 24,
From.../third-party/thrift/include/thrift. h: 51,
From.../third-party/thrift/include/thrift/transport/tTransport. h: 23,
From.../third-party/thrift/include/thrift/protocol/tprotocol. h: 23,
From.../third-party/thrift/include/thrift/tprocessor. h: 24,
From.../third-party/thrift/include/thrift/tdispatchprocessor. h: 22,
From./executorservice. h: 10,
From./executorservice_server.skeleton.cpp: 4:
.../Third-party/thrift/include/thrift/config. h: 266: 1: Warning: this is the location of the previous definition
In file encoded ded from.../third-party/thrift/include/thrift/concurrency/thread. h: 28,
From.../third-party/thrift/include/thrift/Server/tserver. h: 26,
From.../third-party/thrift/include/thrift/Server/tsimpleserver. h: 23,
From./executorservice_server.skeleton.cpp: 6:
.../../Config. h: 50: 1: Warning: "package_name" redefined
In File sorted ded from.../third-party/thrift/include/thrift/tlogging. h: 24,
From.../third-party/thrift/include/thrift. h: 51,
From.../third-party/thrift/include/thrift/transport/tTransport. h: 23,
From.../third-party/thrift/include/thrift/protocol/tprotocol. h: 23,
From.../third-party/thrift/include/thrift/tprocessor. h: 24,
From.../third-party/thrift/include/thrift/tdispatchprocessor. h: 22,
From./executorservice. h: 10,
From./executorservice_server.skeleton.cpp: 4:
.../Third-party/thrift/include/thrift/config. h: 269: 1: Warning: this is the location of the previous definition
In file encoded ded from.../third-party/thrift/include/thrift/concurrency/thread. h: 28,
From.../third-party/thrift/include/thrift/Server/tserver. h: 26,
From.../third-party/thrift/include/thrift/Server/tsimpleserver. h: 23,
From./executorservice_server.skeleton.cpp: 6:
.../../Config. h: 53: 1: Warning: "package_string" redefined
In File sorted ded from.../third-party/thrift/include/thrift/tlogging. h: 24,
From.../third-party/thrift/include/thrift. h: 51,
From.../third-party/thrift/include/thrift/transport/tTransport. h: 23,
From.../third-party/thrift/include/thrift/protocol/tprotocol. h: 23,
From.../third-party/thrift/include/thrift/tprocessor. h: 24,
From.../third-party/thrift/include/thrift/tdispatchprocessor. h: 22,
From./executorservice. h: 10,
From./executorservice_server.skeleton.cpp: 4:
.../Third-party/thrift/include/thrift/config. h: 272: 1: Warning: this is the location of the previous definition
In file encoded ded from.../third-party/thrift/include/thrift/concurrency/thread. h: 28,
From.../third-party/thrift/include/thrift/Server/tserver. h: 26,
From.../third-party/thrift/include/thrift/Server/tsimpleserver. h: 23,
From./executorservice_server.skeleton.cpp: 6:
.../../Config. h: 56: 1: Warning: "package_tarname" redefined
In File sorted ded from.../third-party/thrift/include/thrift/tlogging. h: 24,
From.../third-party/thrift/include/thrift. h: 51,
From.../third-party/thrift/include/thrift/transport/tTransport. h: 23,
From.../third-party/thrift/include/thrift/protocol/tprotocol. h: 23,
From.../third-party/thrift/include/thrift/tprocessor. h: 24,
From.../third-party/thrift/include/thrift/tdispatchprocessor. h: 22,
From./executorservice. h: 10,
From./executorservice_server.skeleton.cpp: 4:
.../Third-party/thrift/include/thrift/config. h: 275: 1: Warning: this is the location of the previous definition
In file encoded ded from.../third-party/thrift/include/thrift/concurrency/thread. h: 28,
From.../third-party/thrift/include/thrift/Server/tserver. h: 26,
From.../third-party/thrift/include/thrift/Server/tsimpleserver. h: 23,
From./executorservice_server.skeleton.cpp: 6:
.../../Config. h: 59: 1: Warning: "package_version" redefined
In File sorted ded from.../third-party/thrift/include/thrift/tlogging. h: 24,
From.../third-party/thrift/include/thrift. h: 51,
From.../third-party/thrift/include/thrift/transport/tTransport. h: 23,
From.../third-party/thrift/include/thrift/protocol/tprotocol. h: 23,
From.../third-party/thrift/include/thrift/tprocessor. h: 24,
From.../third-party/thrift/include/thrift/tdispatchprocessor. h: 22,
From./executorservice. h: 10,
From./executorservice_server.skeleton.cpp: 4:
.../Third-party/thrift/include/thrift/config. h: 281: 1: Warning: this is the location of the previous definition
In file encoded ded from.../third-party/thrift/include/thrift/concurrency/thread. h: 28,
From.../third-party/thrift/include/thrift/Server/tserver. h: 26,
From.../third-party/thrift/include/thrift/Server/tsimpleserver. h: 23,
From./executorservice_server.skeleton.cpp: 6:
.../../Config. h: 65: 1: Warning: "version" redefined
In File sorted ded from.../third-party/thrift/include/thrift/tlogging. h: 24,
From.../third-party/thrift/include/thrift. h: 51,
From.../third-party/thrift/include/thrift/transport/tTransport. h: 23,
From.../third-party/thrift/include/thrift/protocol/tprotocol. h: 23,
From.../third-party/thrift/include/thrift/tprocessor. h: 24,
From.../third-party/thrift/include/thrift/tdispatchprocessor. h: 22,
From./executorservice. h: 10,
From./executorservice_server.skeleton.cpp: 4:
.../Third-party/thrift/include/thrift/config. h: 327: 1: Warning: this is the location of the previous definition