OpenDB icon indicating copy to clipboard operation
OpenDB copied to clipboard

compile faild with Alpine linux (GCC 9)

Open ic-starter opened this issue 4 years ago • 3 comments

Scanning dependencies of target opendb [ 48%] Building CXX object src/db/CMakeFiles/opendb.dir/dbBTerm.cpp.o In file included from /usr/include/limits.h:8, from /root/temp/opendb/include/opendb/odb.h:37, from /root/temp/opendb/include/opendb/ZException.h:35, from /root/temp/opendb/src/db/dbAttrTable.h:35, from /root/temp/opendb/src/db/dbCore.h:47, from /root/temp/opendb/src/db/dbBTerm.h:37, from /root/temp/opendb/src/db/dbBTerm.cpp:33: /root/temp/opendb/src/db/dbAttrTable.h:51:21: error: expected unqualified-id before numeric constant 51 | static const uint PAGE_SIZE; | ^~~~~~~~~ /root/temp/opendb/src/db/dbAttrTable.h:162:28: error: expected unqualified-id before numeric constant 162 | const uint dbAttrTable<T>::PAGE_SIZE = 32; | ^~~~~~~~~ /root/temp/opendb/src/db/dbAttrTable.h: In function 'odb::dbOStream& odb::operator<<(odb::dbOStream&, const odb::dbAttrTable<T>&)': /root/temp/opendb/src/db/dbAttrTable.h:254:39: error: expected unqualified-id before numeric constant 254 | for (j = 0; j < dbAttrTable<T>::PAGE_SIZE; ++j)

cmake information:

[root@cec0efcfcea7 build]$ cmake .. -Wno-dev -- The CXX compiler identification is GNU 9.3.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ - works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Tclsh: /usr/bin/tclsh (found version "8.6") -- Found TCL: /usr/lib/libtcl8.6.so
-- Found TCLTK: /usr/lib/libtcl8.6.so
-- Found TK: /usr/lib/libtk8.6.so
-- Found Boost: /usr/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found version "1.72.0")
-- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- leflib_home: /root/temp/opendb/src/lef -- Found BISON: /usr/bin/bison (found version "3.6.2") -- Found ZLIB: /lib/libz.so (found version "1.2.11") -- Found Boost: /usr/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found version "1.72.0") found components: unit_test_framework -- Found SWIG: /usr/bin/swig (found suitable version "4.0.1", minimum required is "3.0") -- Found Python3: /usr/lib/libpython3.8.so (found version "3.8") found components: Development -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Configuring done -- Generating done -- Build files have been written to: /root/temp/opendb/build

ic-starter avatar Nov 25 '20 06:11 ic-starter

problem maybe caused by PAGE_SIZE definition both inside of : src/db/dbAttrTable.h src/db/dbPageVector.h rename each PAGE_SIZE by add a prefix, e.,g C_PAGE_SIZE and V_PAGE_SIZE
the problem is gone in my case.

ic-starter avatar Dec 04 '20 04:12 ic-starter

@ic-starter Hi there and sorry for the late reply. The problem is that Alpine linux is based on musl which already defines PAGE_SIZE as a macro. This means that you cannot use PAGE_SIZE as a variable name, because the pre-processor replaces any "PAGE_SIZE" with its predefined value (it does not understand that it is not the same scope). For now, using the docker should always work fine. @maliberty if we want to support misc distribution, we need to rename PAGE_SIZE.

osamahammad21 avatar Jan 11 '21 11:01 osamahammad21

@osamahammad21 yuck. Let's rename to page_size & page_shift.

maliberty avatar Jan 11 '21 14:01 maliberty