ail-project / ail-framework

AIL framework - Analysis Information Leak framework
GNU Affero General Public License v3.0
602 stars 80 forks source link

Fix ARDB compilation issue #38

Closed gallypette closed 4 years ago

gallypette commented 4 years ago

While we work on switching to kvrocks we should patch the ARDB install script. See https://github.com/ail-project/ail-framework/issues/15

certrik commented 4 years ago

Trying to install on Debian Buster and getting this error ...

 CC       util/status.o
util/status.cc: In static member function ‘static const char* rocksdb::Status::CopyState(const char*)’:
util/status.cc:28:15: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
   std::strncpy(result, state, cch - 1);
   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
util/status.cc:19:18: note: length computed here
       std::strlen(state) + 1; // +1 for the null terminator
       ~~~~~~~~~~~^~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:1879: util/status.o] Error 1
make[2]: Leaving directory '/home/test/ail-framework/ardb/deps/rocksdb-5.14.2'
make[1]: *** [Makefile:401: /home/test/ail-framework/ardb/src/../deps/rocksdb-5.14.2/librocksdb.a] Error 2
make[1]: Leaving directory '/home/test/ail-framework/ardb/src'
make: *** [Makefile:4: all] Error 2

is this known already? @gallypette

gallypette commented 4 years ago

Hi, i've never seen this. But I guess that adding -Wno-error=stringop-truncation" to ardb/src/Makefile line 402 would do the trick, ie.

CXXFLAGS="-I${SNAPPY_PATH} -Wno-error=stringop-truncation" CFLAGS="-I${SNAPPY_PATH}" LDFLAGS="${SNAPPY_PATH}/.libs" USE_RTTI=1 $(MAKE) static_lib && \

certrik commented 4 years ago

And another one ...

statistics.cpp: In member function ‘virtual void ardb::CostTrack::Dump(void (*)(const string&, void*), void*)’:
statistics.cpp:120:44: error: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1013 [-Werror=format-truncation=]
             snprintf(tmp, sizeof(tmp) - 1, "coststat_%s_%s:calls=%" PRIu64 ",costs=%" PRIu64 ",cost_per_call=%" PRIu64 ",percents=%.4f%%", name.c_str(), range, recs[i].count,
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                ~~~~~
statistics.cpp:120:44: note: using the range [0, 18446744073709551615] for directive argument
statistics.cpp:120:44: note: assuming directive output of 6 bytes
statistics.cpp:120:21: note: ‘snprintf’ output 57 or more bytes (assuming 1083) into a destination of size 1023
             snprintf(tmp, sizeof(tmp) - 1, "coststat_%s_%s:calls=%" PRIu64 ",costs=%" PRIu64 ",cost_per_call=%" PRIu64 ",percents=%.4f%%", name.c_str(), range, recs[i].count,
             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     recs[i].cost, recs[i].cost / recs[i].count, (double(recs[i].count) / double(recs[0].count)) * 100);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:177: statistics.o] Error 1
make[1]: Leaving directory '/home/test/ail-framework/ardb/src'
make: *** [Makefile:4: all] Error 2

this seems to fail aswell. Didn't stumble into this errors when installing on Ubuntu 18.04.

gallypette commented 4 years ago

try with 8a1af2c, it should fix this hopefully.

certrik commented 4 years ago

try with 8a1af2c, it should fix this hopefully.

It did. THX.