openbmc / sdbusplus

C++ bindings for systemd dbus APIs
Apache License 2.0
104 stars 82 forks source link

Compilation failed #40

Closed wilhelmy closed 4 years ago

wilhelmy commented 4 years ago

Trying to compile git master via openbmc/yocto using libsystemd 241 results in the following compilation error:

| arm-openbmc-linux-gnueabi-g++  -march=armv6 -marm -mtune=arm1176jz-s --sysroot=/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/recipe-sysroot -std=c++17 -DHAVE_CONFIG_H -I. -I../../../../../../../workspace/sources/sdbusplus/example -I..     -I../../../../../../../workspace/sources/sdbusplus -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1=/usr/src/debug/sdbusplus/1.0+git999-r1                      -fdebug-prefix-map=/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1=/usr/src/debug/sdbusplus/1.0+git999-r1                      -fdebug-prefix-map=/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/recipe-sysroot=                      -fdebug-prefix-map=/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/recipe-sysroot-native=  -fvisibility-inlines-hidden -Wall -Werror -MT net/poettering/Calculator/calculator_server-error.o -MD -MP -MF net/poettering/Calculator/.deps/calculator_server-error.Tpo -c -o net/poettering/Calculator/calculator_server-error.o `test -f 'net/poettering/Calculator/error.cpp' || echo '../../../../../../../workspace/sources/sdbusplus/example/'`net/poettering/Calculator/error.cpp
| mv -f net/poettering/Calculator/.deps/calculator_server-error.Tpo net/poettering/Calculator/.deps/calculator_server-error.Po
| In file included from /srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/recipe-sysroot/usr/include/systemd/sd-bus.h:113,
|                  from ../../../../../../../workspace/sources/sdbusplus/sdbusplus/sdbus.hpp:3,
|                  from net/poettering/Calculator/server.cpp:3:
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::method(const char*, const char*, const char*, sd_bus_message_handler_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:128:12: error: could not convert '{_SD_BUS_VTABLE_METHOD, flags, {{member, signature, result, handler, 0}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_METHOD(member, signature, result, handler, flags);
|             ^~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::method_o(const char*, const char*, const char*, sd_bus_message_handler_t, size_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:136:12: error: could not convert '{_SD_BUS_VTABLE_METHOD, flags, {{member, signature, result, handler, offset}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_METHOD_WITH_OFFSET(member, signature, result, handler, offset,
|             ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::signal(const char*, const char*, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:143:12: error: could not convert '{_SD_BUS_VTABLE_SIGNAL, flags, {{member, signature}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_SIGNAL(member, signature, flags);
|             ^~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property(const char*, const char*, sd_bus_property_get_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:150:12: error: could not convert '{_SD_BUS_VTABLE_PROPERTY, flags, {{member, signature, get, 0, 0}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_PROPERTY(member, signature, get, 0, flags);
|             ^~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property(const char*, const char*, sd_bus_property_get_t, sd_bus_property_set_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:158:12: error: could not convert '{_SD_BUS_VTABLE_WRITABLE_PROPERTY, flags, {{member, signature, get, set, 0}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_WRITABLE_PROPERTY(member, signature, get, set, 0, flags);
|             ^~~~~~~~~~~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property_o(const char*, const char*, size_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:164:12: error: could not convert '{_SD_BUS_VTABLE_PROPERTY, flags, {{member, signature, nullptr, 0, offset}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_PROPERTY(member, signature, nullptr, offset, flags);
|             ^~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property_o(const char*, const char*, sd_bus_property_set_t, size_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:171:12: error: could not convert '{_SD_BUS_VTABLE_WRITABLE_PROPERTY, flags, {{member, signature, nullptr, set, offset}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_WRITABLE_PROPERTY(member, signature, nullptr, set, offset,
|             ^~~~~~~~~~~~~~~~~~~~~~~~
| In file included from /srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/recipe-sysroot/usr/include/systemd/sd-bus.h:113,
|                  from ../../../../../../../workspace/sources/sdbusplus/sdbusplus/exception.hpp:3,
|                  from ./net/poettering/Calculator/error.hpp:3,
|                  from ../../../../../../../workspace/sources/sdbusplus/example/calculator-server.cpp:2:
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::method(const char*, const char*, const char*, sd_bus_message_handler_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:128:12: error: could not convert '{_SD_BUS_VTABLE_METHOD, flags, {{member, signature, result, handler, 0}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_METHOD(member, signature, result, handler, flags);
|             ^~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::method_o(const char*, const char*, const char*, sd_bus_message_handler_t, size_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:136:12: error: could not convert '{_SD_BUS_VTABLE_METHOD, flags, {{member, signature, result, handler, offset}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_METHOD_WITH_OFFSET(member, signature, result, handler, offset,
|             ^~~~~~~~~~~~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::signal(const char*, const char*, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:143:12: error: could not convert '{_SD_BUS_VTABLE_SIGNAL, flags, {{member, signature}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_SIGNAL(member, signature, flags);
|             ^~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property(const char*, const char*, sd_bus_property_get_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:150:12: error: could not convert '{_SD_BUS_VTABLE_PROPERTY, flags, {{member, signature, get, 0, 0}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_PROPERTY(member, signature, get, 0, flags);
|             ^~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property(const char*, const char*, sd_bus_property_get_t, sd_bus_property_set_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:158:12: error: could not convert '{_SD_BUS_VTABLE_WRITABLE_PROPERTY, flags, {{member, signature, get, set, 0}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_WRITABLE_PROPERTY(member, signature, get, set, 0, flags);
|             ^~~~~~~~~~~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property_o(const char*, const char*, size_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:164:12: error: could not convert '{_SD_BUS_VTABLE_PROPERTY, flags, {{member, signature, nullptr, 0, offset}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_PROPERTY(member, signature, nullptr, offset, flags);
|             ^~~~~~~~~~~~~~~
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp: In function 'constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property_o(const char*, const char*, sd_bus_property_set_t, size_t, uint64_t)':
| ../../../../../../../workspace/sources/sdbusplus/sdbusplus/vtable.hpp:171:12: error: could not convert '{_SD_BUS_VTABLE_WRITABLE_PROPERTY, flags, {{member, signature, nullptr, set, offset}}}' from '<brace-enclosed initializer list>' to 'sdbusplus::vtable::vtable_t' {aka 'sd_bus_vtable'}
|      return SD_BUS_WRITABLE_PROPERTY(member, signature, nullptr, set, offset,
|             ^~~~~~~~~~~~~~~~~~~~~~~~
| Makefile:577: recipe for target 'calculator_server-calculator-server.o' failed
| make[3]: *** [calculator_server-calculator-server.o] Error 1
| make[3]: *** Waiting for unfinished jobs....
| Makefile:591: recipe for target 'net/poettering/Calculator/calculator_server-server.o' failed
| make[3]: *** [net/poettering/Calculator/calculator_server-server.o] Error 1
| mv -f .deps/list_users-list-users.Tpo .deps/list_users-list-users.Po
| make[3]: Leaving directory '/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/sdbusplus-1.0+git999/example'
| Makefile:452: recipe for target 'all' failed
| make[2]: *** [all] Error 2
| make[2]: Leaving directory '/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/sdbusplus-1.0+git999/example'
| Makefile:805: recipe for target 'all-recursive' failed
| make[1]: *** [all-recursive] Error 1
| make[1]: Leaving directory '/srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/sdbusplus-1.0+git999'
| Makefile:554: recipe for target 'all' failed
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| WARNING: /srv/build/mw/openbmc-private/poky/bitbake/lib/bb/build.py:570: ResourceWarning: unclosed file <_io.TextIOWrapper name='/srv/build/mw/openbmc-private/build/workspace/sources/sdbusplus/singletask.lock' mode='a+' encoding='UTF-8'>
|   exec_func(task, localdata)
| 
| ERROR: Function failed: do_compile (log file is located at /srv/build/mw/openbmc-private/build/tmp/work/armv6-openbmc-linux-gnueabi/sdbusplus/1.0+git999-r1/temp/log.do_compile.19889)
wilhelmy commented 4 years ago

If I revert to the commit just before the vtables CI commit (4212292b), it builds again.

williamspatrick commented 4 years ago

Thanks for reporting @wilhelmy. @mine260309 can you take a look at this?

mine260309 commented 4 years ago

@wilhelmy May I ask how exactly do you build sdbuplus with openbmc/yocto using libsystemd 241, e.g. the steps or the revisions?

btbroot commented 4 years ago

It fails exactly like this on pure Debian 10 (libsystemd0:amd64 241-7~deb10u3)

al@deli:~/sdbusplus$ (master %=) ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking whether make sets $(MAKE)... (cached) yes
checking for a Python interpreter with version >= 2.7... python
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/dist-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/dist-packages
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for SYSTEMD... yes
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking systemd/sd-bus.h usability... yes
checking systemd/sd-bus.h presence... yes
checking for systemd/sd-bus.h... yes
checking whether g++ supports C++17 features by default... no
checking whether g++ supports C++17 features with -std=c++17... yes
configure: WARNING: C++17 is not yet standardized, so the checks may change in incompatible ways anytime
checking whether C++ compiler accepts -Wall... yes
checking whether C++ compiler accepts -Werror... yes
checking whether C++ compiler accepts -Wall... (cached) yes
checking whether C++ compiler accepts -Werror... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E -std=c++17
checking for ld used by g++ -std=c++17... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ -std=c++17 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ -std=c++17 option to produce PIC... -fPIC -DPIC
checking if g++ -std=c++17 PIC flag -fPIC -DPIC works... yes
checking if g++ -std=c++17 static flag -static works... yes
checking if g++ -std=c++17 supports -c -o file.o... yes
checking if g++ -std=c++17 supports -c -o file.o... (cached) yes
checking whether the g++ -std=c++17 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking how to run the C preprocessor... gcc -E
checking for GTEST... no
checking for GMOCK... no
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... no
checking gtest/gtest.h usability... no
checking gtest/gtest.h presence... no
checking for gtest/gtest.h... no
checking gmock/gmock.h usability... no
checking gmock/gmock.h presence... no
checking for gmock/gmock.h... no
checking for main in -lgtest... no
checking for main in -lgmock... no
checking for valgrind... valgrind
checking for Valgrind tool memcheck... yes
checking whether to build with code coverage support... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating test/Makefile
config.status: creating tools/Makefile
config.status: creating tools/setup.py
config.status: creating example/Makefile
config.status: creating sdbusplus.pc
config.status: creating sdbusplus/bus.hpp
config.status: creating sdbusplus/server.hpp
config.status: creating tools/sdbusplus/templates/interface.mako.server.cpp
config.status: creating tools/sdbusplus/templates/method.mako.prototype.hpp
config.status: creating tools/sdbusplus/templates/property.mako.prototype.hpp
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
al@deli:~/sdbusplus$ (master %=) make
make  all-recursive
make[1]: вход в каталог «/home/al/sdbusplus»
Making all in .
make[2]: вход в каталог «/home/al/sdbusplus»
make[2]: выход из каталога «/home/al/sdbusplus»
Making all in tools
make[2]: вход в каталог «/home/al/sdbusplus/tools»
running build
make[2]: выход из каталога «/home/al/sdbusplus/tools»
Making all in example
make[2]: вход в каталог «/home/al/sdbusplus/example»
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    interface server-header net.poettering.Calculator > net/poettering/Calculator/server.hpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    interface server-cpp net.poettering.Calculator > net/poettering/Calculator/server.cpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    error exception-header net.poettering.Calculator > net/poettering/Calculator/error.hpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    error exception-cpp net.poettering.Calculator > net/poettering/Calculator/error.cpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    interface markdown net.poettering.Calculator > calculator.md
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    error markdown net.poettering.Calculator >> calculator.md
make  all-am
make[3]: вход в каталог «/home/al/sdbusplus/example»
  CXX      list_users-list-users.o
  CXXLD    list-users
  CXX      calculator_server-calculator-server.o
In file included from /usr/include/systemd/sd-bus.h:113,
                 from ../sdbusplus/exception.hpp:3,
                 from ./net/poettering/Calculator/error.hpp:3,
                 from calculator-server.cpp:2:
../sdbusplus/vtable.hpp: In function ‘constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::method(const char*, const char*, const char*, sd_bus_message_handler_t, uint64_t)’:
../sdbusplus/vtable.hpp:128:12: error: could not convert ‘{_SD_BUS_VTABLE_METHOD, flags, {{member, signature, result, handler, 0}}}’ from ‘<brace-enclosed initializer list>’ to ‘sdbusplus::vtable::vtable_t’ {aka ‘sd_bus_vtable’}
     return SD_BUS_METHOD(member, signature, result, handler, flags);
            ^~~~~~~~~~~~~
../sdbusplus/vtable.hpp: In function ‘constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::method_o(const char*, const char*, const char*, sd_bus_message_handler_t, size_t, uint64_t)’:
../sdbusplus/vtable.hpp:136:12: error: could not convert ‘{_SD_BUS_VTABLE_METHOD, flags, {{member, signature, result, handler, offset}}}’ from ‘<brace-enclosed initializer list>’ to ‘sdbusplus::vtable::vtable_t’ {aka ‘sd_bus_vtable’}
     return SD_BUS_METHOD_WITH_OFFSET(member, signature, result, handler, offset,
            ^~~~~~~~~~~~~~~~~~~~~~~~~
../sdbusplus/vtable.hpp: In function ‘constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::signal(const char*, const char*, uint64_t)’:
../sdbusplus/vtable.hpp:143:12: error: could not convert ‘{_SD_BUS_VTABLE_SIGNAL, flags, {{member, signature}}}’ from ‘<brace-enclosed initializer list>’ to ‘sdbusplus::vtable::vtable_t’ {aka ‘sd_bus_vtable’}
     return SD_BUS_SIGNAL(member, signature, flags);
            ^~~~~~~~~~~~~
../sdbusplus/vtable.hpp: In function ‘constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property(const char*, const char*, sd_bus_property_get_t, uint64_t)’:
../sdbusplus/vtable.hpp:150:12: error: could not convert ‘{_SD_BUS_VTABLE_PROPERTY, flags, {{member, signature, get, 0, 0}}}’ from ‘<brace-enclosed initializer list>’ to ‘sdbusplus::vtable::vtable_t’ {aka ‘sd_bus_vtable’}
     return SD_BUS_PROPERTY(member, signature, get, 0, flags);
            ^~~~~~~~~~~~~~~
../sdbusplus/vtable.hpp: In function ‘constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property(const char*, const char*, sd_bus_property_get_t, sd_bus_property_set_t, uint64_t)’:
../sdbusplus/vtable.hpp:158:12: error: could not convert ‘{_SD_BUS_VTABLE_WRITABLE_PROPERTY, flags, {{member, signature, get, set, 0}}}’ from ‘<brace-enclosed initializer list>’ to ‘sdbusplus::vtable::vtable_t’ {aka ‘sd_bus_vtable’}
     return SD_BUS_WRITABLE_PROPERTY(member, signature, get, set, 0, flags);
            ^~~~~~~~~~~~~~~~~~~~~~~~
../sdbusplus/vtable.hpp: In function ‘constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property_o(const char*, const char*, size_t, uint64_t)’:
../sdbusplus/vtable.hpp:164:12: error: could not convert ‘{_SD_BUS_VTABLE_PROPERTY, flags, {{member, signature, nullptr, 0, offset}}}’ from ‘<brace-enclosed initializer list>’ to ‘sdbusplus::vtable::vtable_t’ {aka ‘sd_bus_vtable’}
     return SD_BUS_PROPERTY(member, signature, nullptr, offset, flags);
            ^~~~~~~~~~~~~~~
../sdbusplus/vtable.hpp: In function ‘constexpr sdbusplus::vtable::vtable_t sdbusplus::vtable::property_o(const char*, const char*, sd_bus_property_set_t, size_t, uint64_t)’:
../sdbusplus/vtable.hpp:171:12: error: could not convert ‘{_SD_BUS_VTABLE_WRITABLE_PROPERTY, flags, {{member, signature, nullptr, set, offset}}}’ from ‘<brace-enclosed initializer list>’ to ‘sdbusplus::vtable::vtable_t’ {aka ‘sd_bus_vtable’}
     return SD_BUS_WRITABLE_PROPERTY(member, signature, nullptr, set, offset,
            ^~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [Makefile:577: calculator_server-calculator-server.o] Ошибка 1
make[3]: выход из каталога «/home/al/sdbusplus/example»
make[2]: *** [Makefile:452: all] Ошибка 2
make[2]: выход из каталога «/home/al/sdbusplus/example»
make[1]: *** [Makefile:805: all-recursive] Ошибка 1
make[1]: выход из каталога «/home/al/sdbusplus»
make: *** [Makefile:554: all] Ошибка 2
btbroot commented 4 years ago

I can confirm, as @wilhelmy pointed, building from f8bbf17 succeeds:

al@deli:~/sdbusplus$ ((f8bbf17...) %) ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking whether make sets $(MAKE)... (cached) yes
checking for a Python interpreter with version >= 2.7... python
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/dist-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/dist-packages
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for SYSTEMD... yes
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking systemd/sd-bus.h usability... yes
checking systemd/sd-bus.h presence... yes
checking for systemd/sd-bus.h... yes
checking whether g++ supports C++17 features by default... no
checking whether g++ supports C++17 features with -std=c++17... yes
configure: WARNING: C++17 is not yet standardized, so the checks may change in incompatible ways anytime
checking whether C++ compiler accepts -Wall... yes
checking whether C++ compiler accepts -Werror... yes
checking whether C++ compiler accepts -Wall... (cached) yes
checking whether C++ compiler accepts -Werror... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E -std=c++17
checking for ld used by g++ -std=c++17... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ -std=c++17 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ -std=c++17 option to produce PIC... -fPIC -DPIC
checking if g++ -std=c++17 PIC flag -fPIC -DPIC works... yes
checking if g++ -std=c++17 static flag -static works... yes
checking if g++ -std=c++17 supports -c -o file.o... yes
checking if g++ -std=c++17 supports -c -o file.o... (cached) yes
checking whether the g++ -std=c++17 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking how to run the C preprocessor... gcc -E
checking for GTEST... no
checking for GMOCK... no
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... no
checking gtest/gtest.h usability... no
checking gtest/gtest.h presence... no
checking for gtest/gtest.h... no
checking gmock/gmock.h usability... no
checking gmock/gmock.h presence... no
checking for gmock/gmock.h... no
checking for main in -lgtest... no
checking for main in -lgmock... no
checking for valgrind... valgrind
checking for Valgrind tool memcheck... yes
checking whether to build with code coverage support... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating test/Makefile
config.status: creating tools/Makefile
config.status: creating tools/setup.py
config.status: creating example/Makefile
config.status: creating sdbusplus.pc
config.status: creating sdbusplus/bus.hpp
config.status: creating sdbusplus/server.hpp
config.status: creating tools/sdbusplus/templates/interface.mako.server.cpp
config.status: creating tools/sdbusplus/templates/method.mako.prototype.hpp
config.status: creating tools/sdbusplus/templates/property.mako.prototype.hpp
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
al@deli:~/sdbusplus$ ((f8bbf17...) %) make
make  all-recursive
make[1]: вход в каталог «/home/al/sdbusplus»
Making all in .
make[2]: вход в каталог «/home/al/sdbusplus»
  CXX      sdbusplus/libsdbusplus_la-exception.lo
  CXX      sdbusplus/libsdbusplus_la-sdbus.lo
  CXXLD    libsdbusplus.la
make[2]: выход из каталога «/home/al/sdbusplus»
Making all in tools
make[2]: вход в каталог «/home/al/sdbusplus/tools»
running build
make[2]: выход из каталога «/home/al/sdbusplus/tools»
Making all in example
make[2]: вход в каталог «/home/al/sdbusplus/example»
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    interface server-header net.poettering.Calculator > net/poettering/Calculator/server.hpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    interface server-cpp net.poettering.Calculator > net/poettering/Calculator/server.cpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    error exception-header net.poettering.Calculator > net/poettering/Calculator/error.hpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    error exception-cpp net.poettering.Calculator > net/poettering/Calculator/error.cpp
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    interface markdown net.poettering.Calculator > calculator.md
../tools/sdbus++ \
    -r . -t ../tools/sdbusplus/templates \
    error markdown net.poettering.Calculator >> calculator.md
make  all-am
make[3]: вход в каталог «/home/al/sdbusplus/example»
  CXX      list_users-list-users.o
  CXXLD    list-users
  CXX      calculator_server-calculator-server.o
  CXX      net/poettering/Calculator/calculator_server-server.o
  CXX      net/poettering/Calculator/calculator_server-error.o
  CXXLD    calculator-server
make[3]: выход из каталога «/home/al/sdbusplus/example»
make[2]: выход из каталога «/home/al/sdbusplus/example»
Making all in test
make[2]: вход в каталог «/home/al/sdbusplus/test»
make[2]: Цель «all» не требует выполнения команд.
make[2]: выход из каталога «/home/al/sdbusplus/test»
make[1]: выход из каталога «/home/al/sdbusplus»
madscientist159 commented 4 years ago

Just hit this on Debian Buster. Please remember that this library is required by host-side utilities, such as the IPMI firmware update tool, and cannot hard-require a Yocto environment to build.

mine260309 commented 4 years ago

Verified that the issue happens on Debian Buster. It is more a GCC issue instead of related to libsystemd.

The issue could be simplified as below code snippet:

#include <cstddef>

struct sd_bus_vtable {
        union {
                struct {
                        size_t element_size;
                } start;
                struct {
                        const char *member;
                        const char *signature;
                } signal;
        } x;
};

sd_bus_vtable get()
{
#ifndef WORKAROUND
    return {
        .x = {
            .signal = {
                .member = "",
                .signature= "",
            }
        }
    };
#else
    struct sd_bus_vtable t = {
        .x = {
            .signal = {
                .member = "",
                .signature= "",
            }
        }
    };
    return t;
#endif
}

Without -DWORKAROUND, the code compiles fine on GCC 9.2.0 and clang 5/6, but fails on GCC 8.3.0, that is the version on Debian Buster.

The workaround could be to construct a sd_bus_vtable manually in the functions and return it. But that makes the code looks not clean.

I posted the question at SO https://stackoverflow.com/questions/60273556/return-brace-enclosed-initializer-list-as-struct, let's see what exactly is wrong.

williamspatrick commented 4 years ago

Neither of these are valid C++ so I’m not surprised it fails to compile. Designated initializers are not added to C++ until C++20 (but they have been in C since C99).

mine260309 commented 4 years ago

Fixed with https://gerrit.openbmc-project.xyz/c/openbmc/sdbusplus/+/29476