Description of problem: Compilation fails when using c89 mode, which is the default for gcc 4.2, which is the default compiler on Mac OS X 10.6. Version-Release number of selected component (if applicable): 5.5.0 How reproducible: Always Steps to Reproduce: 1. Compile libvirt 5.5.0 using -std=c89 in CFLAGS or using an old compiler that defaults to c89 mode. Actual results: In file included from remote/remote_daemon.c:55: In file included from ./access/viraccessmanager.h:32: ./conf/virnetworkportdef.h:35:35: error: redefinition of typedef 'virNetworkPortDef' is invalid in C [-Wtypedef-redefinition] typedef struct _virNetworkPortDef virNetworkPortDef; ^ In file included from remote/remote_daemon.c:54: In file included from ./locking/lock_manager.h:25: In file included from ./locking/lock_driver.h:25: ./conf/domain_conf.h:3562:35: note: previous definition is here typedef struct _virNetworkPortDef virNetworkPortDef; ^ In file included from remote/remote_daemon.c:55: In file included from ./access/viraccessmanager.h:32: ./conf/virnetworkportdef.h:36:28: error: redefinition of typedef 'virNetworkPortDefPtr' is invalid in C [-Wtypedef-redefinition] typedef virNetworkPortDef *virNetworkPortDefPtr; ^ In file included from remote/remote_daemon.c:54: In file included from ./locking/lock_manager.h:25: In file included from ./locking/lock_driver.h:25: ./conf/domain_conf.h:3563:28: note: previous definition is here typedef virNetworkPortDef *virNetworkPortDefPtr; ^ Expected results: Successful build Additional info: This is a new problem for 5.5.0. 5.4.0 built fine.
I should have looked into it a little more before hitting that Submit button... In fact, I was not building with gcc-4.2; I was building with clang, which uses c99 mode by default. Nevertheless, the very old version of clang included with Mac OS X 10.6 evidently does not like type redefinitions. If the type redefinition cannot be avoided, I can use a newer compiler. Here is a full build log, in case it's of interest: https://build.macports.org/builders/ports-10.6_x86_64_legacy-builder/builds/107102/steps/install-port/logs/stdio
I'm afraid we don't support building with such an old version of OS-X. Officially we only target the current shipping OS-X version (see https://libvirt.org/platforms.html ) though to best of my knowledge there shouldn't be any problems with the last 3-4 releases before that at least. Going all the way back to 10.6 though, is simply too far for us to justify investing our limited dev resources in.
FYI we did some fixes upstream which should fix this: commit 412cc0f4038875aa1b0a3c176c309a7e777e9c3f Author: Daniel P. Berrangé <berrange> Date: Tue Oct 8 15:37:11 2019 +0100 build: stop clang complaining about redefined typedefs Clang's gnu99 mode is not quite the same as GCC's. It will complain about redefined typedefs being a C11 feature, while GCC does not complain and allows them in gnu99 mode. Reviewed-by: Fabiano Fidêncio <fidencio> Signed-off-by: Daniel P. Berrangé <berrange> Note that libvirt explicitl requests -std=gnu99 now too commit 23605f58bfd5c47d0f6fbd2aa57a8bda15e720df Author: Daniel P. Berrangé <berrange> Date: Mon Oct 7 14:07:28 2019 +0100 build: ask for -std=gnu99 explicitly We previously got -std=gnu99 secretly enabled as a side-effect of requesting the 'stdarg' gnulib module. We rely on some extensions from c99/gnu99 and while RHEL-7 supports this, it still defaults to gnu89. RHEL-7 also supports some newer standards but declares them experimental/incomplete, so sticking with gnu99 is best bet for now & matches historical usage. Reviewed-by: Fabiano Fidêncio <fidencio> Signed-off-by: Daniel P. Berrangé <berrange>