Closed wililupy closed 8 years ago
Some more context:
[ 13%] Building CXX object CMakeFiles/fboss_agent.dir/fboss/agent/hw/bcm/BcmAPI.cpp.o
In file included from /home/wililupy/fboss-snap/parts/fboss/src/fboss/agent/hw/bcm/BcmError.h:13:0,
from /home/wililupy/fboss-snap/parts/fboss/src/fboss/agent/hw/bcm/BcmAPI.cpp:12:
/home/wililupy/fboss-snap/parts/fboss/src/fboss/agent/hw/bcm/BcmSwitch.h:15:59: fatal error: fboss/agent/hw/bcm/gen-cpp2/packettrace_types.h: No such file or directory
compilation terminated.
CMakeFiles/fboss_agent.dir/build.make:709: recipe for target 'CMakeFiles/fboss_agent.dir/fboss/agent/hw/bcm/BcmAPI.cpp.o' failed
make[2]: *** [CMakeFiles/fboss_agent.dir/fboss/agent/hw/bcm/BcmAPI.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/fboss_agent.dir/all' failed
make[1]: *** [CMakeFiles/fboss_agent.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
This directory and file should be generated by thrift. I'll take a look at this failure later today.
I went back and tried to build all the dependencies manually, and I still get the same error as above. I did see some interresting errors during the thrift build:
.
.
.
async/TEventConnection.cpp: In member function ‘void apache::thrift::async::TEventConnection::readNextRequest()’:
async/TEventConnection.cpp:181:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (readersActive_ >= kMaxReadsPerLoop) {
^
async/TEventConnection.cpp: In member function ‘void apache::thrift::async::TEventConnection::handleAsyncTaskComplete(bool)’:
async/TEventConnection.cpp:301:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (responseBytes > largestWriteBufferSize_) {
^
.
.
.
async/TEventServer.cpp: In member function ‘void apache::thrift::async::TEventServer::setupWorkers()’:
async/TEventServer.cpp:87:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (uint32_t n = 0; n < nWorkers_; ++n) {
^
.
.
.
async/TEventWorker.cpp: In member function ‘virtual void apache::thrift::async::TEventWorker::connectionAccepted(int, const folly::SocketAddress&)’:
async/TEventWorker.cpp:107:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
maxNumActiveConnections_ <= activeConnectionList_.size()) {
^
.
.
.
protocol/TJSONProtocol.cpp: In member function ‘uint32_t apache::thrift::protocol::TJSONProtocol::readJSONBool(bool&)’:
protocol/TJSONProtocol.cpp:891:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; i < kJSONTrue.length(); ++i) {
^
protocol/TJSONProtocol.cpp:897:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; i < kJSONFalse.length(); ++i) {
^
.
.
.
transport/TSocketPool.cpp: In member function ‘virtual void apache::thrift::transport::TSocketPool::open()’:
transport/TSocketPool.cpp:218:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < numServersToTry; ++i) {
^
transport/TSocketPool.cpp:229:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
bool isLastServer = alwaysTryLast_ ? (i == numServersToTry - 1) : false;
^
.
.
.
transport/TBufferTransports.cpp: In member function ‘virtual bool apache::thrift::transport::TFramedTransport::readFrame(uint32_t)’:
transport/TBufferTransports.cpp:242:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (sz > static_cast(rBufSize_)) {
^
.
.
.
transport/THeader.cpp: In static member function ‘static folly::Optional apache::thrift::transport::THeader::analyzeFirst32bit(uint32_t)’:
transport/THeader.cpp:178:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((w & TBinaryProtocol::VERSION_MASK) == TBinaryProtocol::VERSION_1) {
^
transport/THeader.cpp: In static member function ‘static CLIENT_TYPE apache::thrift::transport::THeader::analyzeSecond32bit(uint32_t)’:
transport/THeader.cpp:193:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((w & TBinaryProtocol::VERSION_MASK) == TBinaryProtocol::VERSION_1) {
^
transport/THeader.cpp: In static member function ‘static std::unique_ptr apache::thrift::transport::THeader::untransform(std::unique_ptr, std::vector&)’:
transport/THeader.cpp:585:19: warning: unused variable ‘src’ [-Wunused-variable]
const char *src = (const char *)buf->data();
^
transport/THeader.cpp:586:14: warning: unused variable ‘length’ [-Wunused-variable]
size_t length = buf->length();
^
In file included from /usr/include/c++/5/cassert:43:0,
from transport/THeader.cpp:40:
transport/THeader.cpp: In member function ‘std::unique_ptr apache::thrift::transport::THeader::addHeader(std::unique_ptr, apache::thrift::transport::THeader::StringToStringMap&, bool)’:
transport/THeader.cpp:982:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
assert(pkt - pktStart <= header->capacity());
.
.
.
util/VarintUtils.cpp: In function ‘uint32_t apache::thrift::util::writeVarint32(uint32_t, uint8_t*)’:
util/VarintUtils.cpp:97:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < wsize; i++) {
.
.
.
transport/TZlibTransport.cpp: In member function ‘uint32_t apache::thrift::transport::TZlibTransport::read(uint8_t*, uint32_t)’:
transport/TZlibTransport.cpp:163:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (need < len && rstream_->avail_in == 0) {
^
In file included from /usr/include/c++/5/cassert:43:0,
from transport/TZlibTransport.cpp:22:
transport/TZlibTransport.cpp: In member function ‘void apache::thrift::transport::TZlibTransport::verifyChecksum()’:
transport/TZlibTransport.cpp:393:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
assert(rstream_->avail_out < urbuf_size_);
.
.
.
However thrift does completely build and I can install it with sudo make install. Don't know if this will help or not, or if they can be safely ignored. Please let me know.
Thanks, Luke
It looks like we're just not generating thrift code for fboss/agent/hw/bcm/packettrace.thrift
Ahh, I see.
So I ran
thrift -o . --gen cpp packettrace.thrift
in the fboss/agent/hw/bcm directory and it build the .h files. However it put them in gen-cpp so I renamed that directory to gen-cpp2 and it made it past the first error, but now I'm seeing the following:
[ 2%] Building CXX object CMakeFiles/fboss_agent.dir/fboss/agent/hw/bcm/BcmHost.cpp.o
In file included from /home/wililupy/fboss-source/fboss/fboss/agent/hw/bcm/BcmHost.cpp:20:0:
/home/wililupy/fboss-source/fboss/fboss/agent/hw/bcm/BcmPort.h:137:54: error: ‘facebook::stats::ExportedHistogramMap::LockableHistogra’ has not been declared
stats::ExportedHistogramMap::LockableHistogram* hist,
^
/home/wililupy/fboss-source/fboss/fboss/agent/hw/bcm/BcmPort.h:181:27: error: ‘LockableStat’ in ‘class facebook::stats::ExportedStatMa’ does not name a type
stats::ExportedStatMap::LockableStat outQueueLen_;
^
/home/wililupy/fboss-source/fboss/fboss/agent/hw/bcm/BcmPort.h:182:32: error: ‘LockableHistogram’ in ‘class facebook::stats::ExportedHistogramMap’ does not name a type
stats::ExportedHistogramMap::LockableHistogram inPktLengths_;
^
/home/wililupy/fboss-source/fboss/fboss/agent/hw/bcm/BcmPort.h:183:32: error: ‘LockableHistogram’ in ‘class facebook::stats::ExportedHistogramMap’ does not name a type
stats::ExportedHistogramMap::LockableHistogram outPktLengths_;
^
CMakeFiles/fboss_agent.dir/build.make:757: recipe for target 'CMakeFiles/fboss_agent.dir/fboss/agent/hw/bcm/BcmHost.cpp.o' failed
make[2]: *** [CMakeFiles/fboss_agent.dir/fboss/agent/hw/bcm/BcmHost.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/fboss_agent.dir/all' failed
make[1]: *** [CMakeFiles/fboss_agent.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Thanks for all your help on this so far.
For cpp2, you need to generate it with the Python code, but this seems to have worked well enough. In any case, the issue you're running into now is with some missing stubs for the facebook-internal stats generation code.
I found the command to do that in the build.make file, so I did that (export PYTHONPATH=/home/wililupy/fboss-source/fboss/external/fbthrift/thrift/.python-local/lib/python/; /usr/bin/python -mthrift_compiler.main -I /home/wililupy/fboss-source/fboss --gen cpp2: -o /home/wililupy/fboss-source/fboss/fboss/agent/hw/bcm /home/wililupy/fboss-source/fboss/fboss/agent/hw/bcm/packettrace.thrift
) however I still have the same issue. It almost looks like something not being built right in folly which in turn breaks fbthrift, which when I run cmake, it doesn't see the correct parameters and never adds it to the build.make file.
Do you have any idea why I have to do this manually? It almost looks like when cmake build the build.make file, it is missing these steps...
Yes, the CMakeLists.txt is slightly out of date, as is common/stats; I'm working on fixes right now.
FYI, you can try out my fork of this (https://github.com/oridb/fboss), which has a couple of fixes that I'll be merging in to the internal code base in the next day or so.
So close...
With your fork, I was able to build everything, but at the very end, after it said Linking CXX executable wedge_agent
I got the following error:
[100%] Linking CXX executable wedge_agent
libfboss_agent.a(RouteUpdateLogger.cpp.o): In function `facebook::fboss::RouteUpdateLogger::RouteUpdateLogger(facebook::fboss::SwSwitch*)':
RouteUpdateLogger.cpp:(.text+0xc6): undefined reference to `facebook::fboss::RouteUpdateLogger::getDefaultV6RouteLogger()'
RouteUpdateLogger.cpp:(.text+0xd2): undefined reference to `facebook::fboss::RouteUpdateLogger::getDefaultV4RouteLogger()'
../external/fbthrift/thrift/lib/cpp2/.libs/libthriftcpp2.so: undefined reference to `numa_tonode_memory'
../external/fbthrift/thrift/lib/cpp2/.libs/libthriftcpp2.so: undefined reference to `numa_set_preferred'
../external/fbthrift/thrift/lib/cpp2/.libs/libthriftcpp2.so: undefined reference to `numa_max_node'
../external/fbthrift/thrift/lib/cpp2/.libs/libthriftcpp2.so: undefined reference to `numa_run_on_node'
../external/fbthrift/thrift/lib/cpp2/.libs/libthriftcpp2.so: undefined reference to `numa_available'
collect2: error: ld returned 1 exit status
CMakeFiles/wedge_agent.dir/build.make:261: recipe for target 'wedge_agent' failed
make[2]: *** [wedge_agent] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/wedge_agent.dir/all' failed
make[1]: *** [CMakeFiles/wedge_agent.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
And I cannot find fboss_agent or wedge_agent anywhere in the build directories.
Thank you so much for you help on this!
Ok, it looks like you just need to add libnuma to cmakelists.txt; Added that to my fork, although I can't test it -- My current machine is unhappy with some interaction between boost, enums, and std::distance.
Well, no longer getting the numa errors, but still getting the RouteUpdateLogger errors:
[100%] Linking CXX executable wedge_agent
libfboss_agent.a(RouteUpdateLogger.cpp.o): In function `facebook::fboss::RouteUpdateLogger::RouteUpdateLogger(facebook::fboss::SwSwitch*)':
RouteUpdateLogger.cpp:(.text+0xc6): undefined reference to `facebook::fboss::RouteUpdateLogger::getDefaultV6RouteLogger()'
RouteUpdateLogger.cpp:(.text+0xd2): undefined reference to `facebook::fboss::RouteUpdateLogger::getDefaultV4RouteLogger()'
collect2: error: ld returned 1 exit status
CMakeFiles/wedge_agent.dir/build.make:262: recipe for target 'wedge_agent' failed
make[2]: *** [wedge_agent] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/wedge_agent.dir/all' failed
make[1]: *** [CMakeFiles/wedge_agent.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Almost there.
Thank you soo much.
That says to me that there are files missing in CMakeLists.txt -- greo for the files that provide those symbols, and put them in.
I ran grep -rnw '/home/wililupy/fboss-source/fboss/' -e "facebook::fboss::RouteUpdateLogger::RouteUpdateLogger"
to try to find the cpp file that had these symbols in it to no avail. I even manually ran cmake against the wedge_agent.dir/link.txt file to see if it spit out more information, but nothing useful was presented. Any other idea?
It's rare in C++ to use a fully qualified namespace like that; if you just grep for RouteUpdateLogger, you'd find it in fbcode/fboss/agent/RouteUpdateLogger.cpp, and fbcode/fboss/agent/oss/RouteUpdateLogger.cpp
(There may be a few other files missing from CMakeLists.txt)
I found those files and looked through the includes in that, and in each of the header files that they are being called out in it. I did see something interesting in the Range.h for folly being called from folly/IPAddress.h in the fboss/agent/RouteUpdateLogger.h about std::pair. I don't see anything in cmake for std, but I assume that is standard since it is included with libstdc++ and gcc.
Just looking at RouteUpdateLogger.cpp and .h all those includes are in showing on the build system. Not sure what else to look for.
Looking through some of the header files, I noticed that in the fboss/agent/SwSwitch.h there is an include fboss/agent/gen-cpp/switch_config_types.h and in the fboss/agent directory there is no gen-cpp/switch_config_types.h file. I ran into this error before and you corrected it. I'm wondering if what ever you did needs to be done to this header file as well?
I noticed that in the build/gen/fboss/agent directory the missing header files are there. Should I update the header file SwSwitch.h to point to this location?
Yes, I've already mentioned what needs to be done a few times: The missing files need to be added to CMakeLists.txt in the root of the repository.
I got what you mean now.
I added include_directories(${CMAKE_BINARY_DIR}/gen/fboss/agent/gen-cpp)
the the CMakeList.txt. I would that that just have gen in the include list should have worked. I am re-running cmake .. and make and I'll let you know how it goes.
Thanks.
Er, it's finding the headers just fine; It's just missing some source files in this section:
add_library(fboss_agent STATIC
$HONKING_BIG_LIST_OF_SOURCES
)
Oh boy. That could be interesting to try and figure which one is missing.
On a side note, I got the same error, so I'm going to remove my line and start looking through the list...
It's not so bad -- the ones that are missing are the ones that provide the symbols that can't be found. So, eg, for the specific error you had, grepping points to two files related to it:
fbcode/fboss/agent/RouteUpdateLogger.cpp
fbcode/fboss/agent/oss/RouteUpdateLogger.cpp
Only the first of those two are in CMakeLists.txt, implying that the second one is missing. Rinse, repeat, and if you can send a pull request to add the last couple of files, I'd appreciate it.
Thanks!
It built! I added fbcode/fboss/agent/oss/RouteUpdateLogger.cpp to CMakeList.txt and re-ran cmake and then make and it built, but there is not fboss_agent, even though it said it built it. There is a wedge_agent and it did create the static library libfoss_agent.a but no fboss_agent in my build directory. I look at the Makefile and the build.make and everything looks good. I forked your fboss and made the changes and uploaded them to my fork at https://github.com/wililupy/fboss.
When building FBOSS Agent, I get the following error: fatal error: fboss/agent/hw/bcm/gen-cpp2/packettrace_types.h: No such file or directory
Sure enough, looking in that directory, the gen-cpp2 directory does not exist. What header should I be using in place of this?