Opened 10 months ago
Last modified 10 months ago
#69159 new defect
spice-server @0.15.2: error: expected identifier or '('
Reported by: | leeeoooooo | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.8.1 |
Keywords: | i386 snowleopard | Cc: | jeremyhu (Jeremy Huddleston Sequoia) |
Port: | spice-server, macports-libcxx, clang-11, clang-10, clang-9.0 |
Description
I was trying to install QEMU under Mac OS X 10.6.8 on my OG white polycarbonate MacBook1,1 32-bit-ONLY DualCore "Yonah" CPU. One of the dependancies for QEMU is spice-server, but the build failed, apparently due to a syntax error. Please see attached log.
Attachments (1)
Change History (6)
Changed 10 months ago by leeeoooooo
Attachment: | qemu.spice-server.main.log added |
---|
comment:1 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | snowleopard added; spice-server qemu removed |
---|---|
Port: | QEMU -> removed |
Summary: | spice-server build failed, unexpected operand… → spice-server @0.15.2: error: expected identifier or '(' |
Something has gone rather wrong when the error is occurring in a compiler header...
:info:build In file included from lines.c:56: :info:build /opt/local/include/libcxx/v1/math.h:316:8: error: expected identifier or '(' :info:build extern "C" { :info:build ^
comment:2 Changed 10 months ago by jmroot (Joshua Root)
It's somehow including a C++ header from C code.
comment:3 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
Cc: | jeremyhu added |
---|---|
Port: | macports-libcxx clang-11 clang-10 clang-9.0 added |
/opt/local/include/libcxx/v1/math.h is provided by the macports-libcxx port. math.h is supposed to be a C header. The port also helpfully installs a math.h.orig file that helps us see that originally math.h didn't contain the problematic line—which is extern "C" {
, since that line can only be used in C++ code.
The macports-libcxx port copies its files from the clang-11 port. The problematic changes are added to the math.h header by this patch:
source:macports-ports/lang/llvm-11/files/3001-Fix-missing-long-long-math-prototypes-when-using-the.patch
The problematic code only takes effect on Mac OS X versions earlier than 10.7.
The problematic patch is also in the clang-10 and clang-9.0 ports.
Is this the fix?
-
math.h
old new 313 313 314 314 # if __APPLE_BAD_MATH_H 315 315 /* These prototypes are incorrectly omitted from <math.h> on Snow Leopard despite being available */ 316 # ifdef __cplusplus 316 317 extern "C" { 318 # endif 317 319 extern long long int llrintl(long double); 318 320 extern long long int llrint(double); 319 321 extern long long int llrintf(float); … … 321 323 extern long long int llroundl(long double); 322 324 extern long long int llround(double); 323 325 extern long long int llroundf(float); 326 # ifdef __cplusplus 324 327 } 328 # endif 325 329 # endif 326 330 #endif // __APPLE__ 327 331
comment:4 follow-up: 5 Changed 10 months ago by kencu (Ken)
well, that is weird.
This never has come up since Jeremy wrote this patch up.
Is spice-server using the c++ compiler to compile “c” code?
comment:5 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to kencu:
Is spice-server using the c++ compiler to compile “c” code?
If it were, the problem wouldn't occur, since extern "C"
is valid in C++.
spice-server build log