Opened 5 years ago
Closed 5 years ago
#58726 closed defect (fixed)
libvirt @5.5.0: error: expected ';' before 'virTemporaryReturnPointer'
Reported by: | kencu (Ken) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | danchr (Dan Villiom Podlaski Christiansen) | |
Port: | libvirt |
Description
On my current system (10.6.8) libvirt 5.5.0 does not build:
libtool: compile: /opt/local/bin/clang-mp-5.0 -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib -I../gnulib/lib -I.. -I../include -I../include -I./util -I./util -DIN_LIBVIRT -Dabs_top_builddir=\"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_libvirt/libvirt/work/libvirt-5.5.0\" -Dabs_top_srcdir=\"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_libvirt/libvirt/work/libvirt-5.5.0\" -I/opt/local/include -std=gnu99 -I/opt/local/include/yajl -I/opt/local/include/libxml2 -fno-common -W -Waddress -Wall -Wattributes -Wbad-function-cast -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wcomment -Wcomments -Wcpp -Wdangling-else -Wdate-time -Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wextra -Wformat-extra-args -Wformat-security -Wformat-y2k -Wformat-zero-length -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-to-pointer-cast -Winvalid-pch -Wlogical-not-parentheses -Wmain -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnull-dereference -Wodr -Wold-style-definition -Woverflow -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-type -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wswitch -Wswitch-bool -Wtautological-compare -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wno-missing-field-initializers -Wno-sign-compare -Wswitch-enum -Wno-format-nonliteral -fexceptions -fasynchronous-unwind-tables -Wframe-larger-than=4096 -I/opt/local/include/p11-kit-1 -pipe -Os -std=c99 -arch x86_64 -MT util/libvirt_util_la-virhostdev.lo -MD -MP -MF util/.deps/libvirt_util_la-virhostdev.Tpo -c util/virhostdev.c -fno-common -DPIC -o util/.libs/libvirt_util_la-virhostdev.o util/virhostdev.c:202:5: warning: implicit declaration of function 'typeof' is invalid in C99 [-Wimplicit-function-declaration] VIR_RETURN_PTR(hostdevMgr); ^ ./internal.h:291:9: note: expanded from macro 'VIR_RETURN_PTR' typeof(ptr) virTemporaryReturnPointer = (ptr); \ ^ util/virhostdev.c:202:5: warning: this function declaration is not a prototype [-Wstrict-prototypes] ./internal.h:291:9: note: expanded from macro 'VIR_RETURN_PTR' typeof(ptr) virTemporaryReturnPointer = (ptr); \ ^ util/virhostdev.c:202:5: error: expected ';' after expression ./internal.h:291:21: note: expanded from macro 'VIR_RETURN_PTR' typeof(ptr) virTemporaryReturnPointer = (ptr); \ ^ util/virhostdev.c:202:5: error: use of undeclared identifier 'virTemporaryReturnPointer' ./internal.h:291:21: note: expanded from macro 'VIR_RETURN_PTR' typeof(ptr) virTemporaryReturnPointer = (ptr); \ ^ util/virhostdev.c:202:5: error: use of undeclared identifier 'virTemporaryReturnPointer' ./internal.h:293:16: note: expanded from macro 'VIR_RETURN_PTR' return virTemporaryReturnPointer; \ ^ util/virhostdev.c:252:5: error: expected ';' after expression VIR_RETURN_PTR(pcidevs); ^ ./internal.h:291:21: note: expanded from macro 'VIR_RETURN_PTR' typeof(ptr) virTemporaryReturnPointer = (ptr); \ ^ util/virhostdev.c:252:5: error: use of undeclared identifier 'virTemporaryReturnPointer' ./internal.h:291:21: note: expanded from macro 'VIR_RETURN_PTR' typeof(ptr) virTemporaryReturnPointer = (ptr); \ ^ util/virhostdev.c:252:5: error: use of undeclared identifier 'virTemporaryReturnPointer' ./internal.h:293:16: note: expanded from macro 'VIR_RETURN_PTR' return virTemporaryReturnPointer; \ ^ 2 warnings and 6 errors generated.
I tried building it with clang-5.0, clang-8.0, and gcc6, and all failed similarly. Logs attached.
Attachments (2)
Change History (14)
Changed 5 years ago by kencu (Ken)
Attachment: | libvirt-10.6.8-clang-5.0-libcxx-build-fail.log added |
---|
Changed 5 years ago by kencu (Ken)
Attachment: | libvirt-10.6.8-gcc-6-build-fail.log added |
---|
comment:1 Changed 5 years ago by kencu (Ken)
comment:2 Changed 5 years ago by kencu (Ken)
this works:
configure.cflags-append -std=gnu99
-std=c11
did not work.
This page <https://clang.llvm.org/docs/UsersManual.html> suggests clang supports the typeof
keyword with any gnu*
standard.
The parser recognizes “asm” and “typeof” as keywords in gnu* modes; the variants “__asm__” and “__typeof__” are recognized in all modes.
comment:3 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)
I am aware of this problem, which is why I filed that upstream ticket. The developers declined to fix it because it affects only very old systems.
I had tried -std=c99
which didn't work. I didn't consider that -std=gnu99
might have a different effect. If that fixes it, feel free to commit that.
comment:4 Changed 5 years ago by kencu (Ken)
I'm curious how this built successfully on 10.7+ as it was.
Apple's clang must allow the typeof keyword by default, I guess, whereas the llvm clang version does not...
comment:5 Changed 5 years ago by kencu (Ken)
The port will not build on Mojave with -std=c99
set in the Portfile:
/bin/sh ../libtool --tag=CC --mode=compile /usr/bin/clang -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib -I../gnulib/lib -I.. -I../include -I../include -I./util -I./util -DIN_LIBVIRT -Dabs_top_builddir="\"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_libvirt/libvirt/work/libvirt-5.5.0\"" -Dabs_top_srcdir="\"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_libvirt/libvirt/work/libvirt-5.5.0\"" -I/opt/local/include -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/opt/local/include/yajl -I/opt/local/include/libxml2 -fno-common -W -Waddress -Wall -Wattributes -Wbad-function-cast -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wcomment -Wcomments -Wcpp -Wdangling-else -Wdate-time -Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wextra -Wformat-extra-args -Wformat-security -Wformat-y2k -Wformat-zero-length -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-to-pointer-cast -Winvalid-pch -Wlogical-not-parentheses -Wmain -Wmemset-transposed-args -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnull-dereference -Wodr -Wold-style-definition -Woverflow -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-type -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wswitch -Wswitch-bool -Wtautological-compare -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wno-sign-compare -Wswitch-enum -Wno-format-nonliteral -fexceptions -fasynchronous-unwind-tables -Wframe-larger-than=4096 -I/opt/local/include/p11-kit-1 -pipe -Os -std=c99 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -arch x86_64 -MT util/libvirt_util_la-virmodule.lo -MD -MP -MF util/.deps/libvirt_util_la-virmodule.Tpo -c -o util/libvirt_util_la-virmodule.lo `test -f 'util/virmodule.c' || echo './'`util/virmodule.c util/virhostdev.c:202:5: warning: implicit declaration of function 'typeof' is invalid in C99 [-Wimplicit-function-declaration] VIR_RETURN_PTR(hostdevMgr);
If -std=c99
is removed, and no standard is set, then the port builds again on Mojave. So Apple's clang does accept the typeof
keyword by default, as opposed to llvm's clang, which does not.
Using -std=gnu99
the port does build with Mojave using the default clang, and also builds with llvm's clang (5 and 8 tested).
So that appears to be a safe fix.
Upstream could consider using __typeof__
instead of typeof
and then we would not need to worry about C standards at all.
comment:6 Changed 5 years ago by ken-cunningham-webuse
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Using -std=gnu99
hasn't allowed this port to build on 10.6 any more than -std=c99
did.
comment:9 Changed 5 years ago by kencu (Ken)
I think we just need to find the oldest clang that works.
comment:10 follow-up: 11 Changed 5 years ago by kencu (Ken)
/usr/bin/clang
from 10.7 works; /usr/bin/clang
from 10.6 does not. New PR in place.
comment:11 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to kencu:
/usr/bin/clang
from 10.7 works;
I suspect it depends on which version of clang, i.e. which version of Xcode. The last Xcode for 10.7 had clang 425, and your PR blacklists all older than that, so that should work. I don't know whether any versions older than that might still work.
comment:12 Changed 5 years ago by ken-cunningham-webuse
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Hmmm. This is <https://bugzilla.redhat.com/show_bug.cgi?id=1728944> it looks like, and is mentioned in the portfile. Will see if I can figure out how to fix it.