Opened 3 years ago
Closed 3 years ago
#64355 closed defect (worksforme)
gcc10 @10.3.0_1: fixincludes math.h missing for Intel hardware on Mac OS X 10.7 Lion
Reported by: | johnrosshunt | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | lion i386 x86_64 | Cc: | |
Port: | gcc10 |
Description
Programs that include math.h fail to build using gcc10 on Intel hardware.
In file included from /opt/local/include/LegacySupport/math.h:79, from /opt/local/include/libavutil/common.h:36, from /opt/local/include/libavutil/avutil.h:296, from /opt/local/include/libavutil/samplefmt.h:24, from /opt/local/include/libavcodec/avcodec.h:31, from /opt/local/include/libavformat/avformat.h:312, from src/libav.h:26, from src/main.c:70: /opt/local/lib/gcc10/gcc/x86_64-apple-darwin11/10.3.0/include-fixed/math.h:37:10: fatal error: architecture/i386/math.h: No such file or directory 37 | #include <architecture/i386/math.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
The header file from above contains the following snippet of code:
#if (defined(__ppc__) || defined(__ppc64__)) #include <architecture/ppc/math.h> #elif (defined (__i386__) || defined( __x86_64__ )) #include <architecture/i386/math.h> #elif defined(__arm__) #include <architecture/arm/math.h> #else #error Unknown architecture #endif
There is a corresponding header file for PPC architecture, but not for Intel and ARM. As a workaround, programs compile fine if you create the missing directory and symlink /usr/include/architecture/i386/math.h to math.h. But, headers should probably be generated during the build. I took a peek at gcc11 and it appears the same headers are missing from that port as well.
Change History (4)
comment:1 Changed 3 years ago by kencu (Ken)
comment:2 Changed 3 years ago by kencu (Ken)
see #48004
suggestion is to rebuild gmp, so I guess I can try that
comment:3 Changed 3 years ago by kencu (Ken)
Rebuilding gmp on this machine from source fixed the ICE. So now all works well:
$ cat mathtest.c #include <math.h> #include <stdio.h> int main(int argc, char* argv[]) { int i = 1000; double b = log2(i); printf("%f \n",b); double d = log2(2.3456789f); printf("%f \n",d); return 0; } $ /opt/local/bin/gcc-mp-10 mathtest.c $ ./a.out 9.965784 1.230005
No problem with any missing header files noted.
comment:4 Changed 3 years ago by kencu (Ken)
Resolution: | → worksforme |
---|---|
Status: | new → closed |
John, I'm going to close this as a "worksforme" as I think the issue lies on your machine based on mine working fine.
Please reinstall the command line tools for 10.7, and try your previously failed build again. Perhaps also try the test program I have outlined above.
If reinstalling your command line tools fails to fix you up, and you still get errors related to
#include <architecture/i386/math.h>
being missing on your machine, please re-open this ticket, with a full log for the failed build, and we'll see if we can get you sorted out properly.
I seem to have that file as part of my standard kit:
I presume you have the command line tools installed, of course.
However, even once you figure out where your standard headers went (I presume reinstalling your command line tools is what is needed there) all does not seem to be well with the macports gcc versions I have installed on 10.7:
So -- something is just hosed here, whether it is something on my specific system (could be, can't promise it is not) or whether it is a general MP problem I don't know at present.