Code Monkey home page Code Monkey logo

Comments (9)

wilhelmy avatar wilhelmy commented on August 28, 2024

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

from sdbusplus.

williamspatrick avatar williamspatrick commented on August 28, 2024

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

from sdbusplus.

mine260309 avatar mine260309 commented on August 28, 2024

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

from sdbusplus.

btbroot avatar btbroot commented on August 28, 2024

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

from sdbusplus.

btbroot avatar btbroot commented on August 28, 2024

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»

from sdbusplus.

madscientist159 avatar madscientist159 commented on August 28, 2024

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.

from sdbusplus.

mine260309 avatar mine260309 commented on August 28, 2024

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.

from sdbusplus.

williamspatrick avatar williamspatrick commented on August 28, 2024

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).

from sdbusplus.

mine260309 avatar mine260309 commented on August 28, 2024

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

from sdbusplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.