Discrepancies between building with gcc 8 on my Origin 350 vs Octodad

Unxmaal

Administrator
Feb 8, 2019
38
13
8
NOTE: This turned out to be a systemic issue with my personal Origin 350. It does not manifest on Octodad, which is the same type of hardware.

For troubleshooting, I have performed the following steps:
  • Installed 6.5.30 via booterizer about 2 weeks ago, which installs this media: https://github.com/unxmaal/booterizer/blob/master/irix.6.5.30.yml
  • Deleted /opt/local
  • Deleted ~/projects/irixports
  • From inst, uninstalled gnutoolchain tardist
  • Extracted irix-optlocal.tar.gz into /
  • git cloned irixports
  • Ran irixports/bootstrap.sh as root (which installs gnutoolchain tardist)
Quick example is gperf:

C:
/opt/local/gcc-8.2.0/bin/g++ -g -O2 -I. -I./../lib -c ./search.cc
In file included from /opt/local/gcc-8.2.0/include/c++/8.2.0/math.h:36,
                 from ./search.cc:28:
/opt/local/gcc-8.2.0/include/c++/8.2.0/cmath: In function 'constexpr int std::fpclassify(float)':
/opt/local/gcc-8.2.0/include/c++/8.2.0/cmath:538:33: error: 'FP_NAN' was not declared in this scope
   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
                                 ^~~~~~
/opt/local/gcc-8.2.0/include/c++/8.2.0/cmath:538:41: error: 'FP_INFINITE' was not declared in this scope
   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
                                         ^~~~~~~~~~~
/opt/local/gcc-8.2.0/include/c++/8.2.0/cmath:538:54: error: 'FP_NORMAL' was not declared in this scope
   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
                                                      ^~~~~~~~~
/opt/local/gcc-8.2.0/include/c++/8.2.0/cmath:539:5: error: 'FP_SUBNORMAL' was not declared in this scope
     FP_SUBNORMAL, FP_ZERO, __x); }
     ^~~~~~~~~~~~
/opt/local/gcc-8.2.0/include/c++/8.2.0/cmath:539:19: error: 'FP_ZERO' was not declared in this scope
     FP_SUBNORMAL, FP_ZERO, __x); }
                   ^~~~~~~
/opt/local/gcc-8.2.0/bin/g++ -g -O2 -I. -I./../lib -c ./output.cc
/opt/local/gcc-8.2.0/include/c++/8.2.0/cmath:539:19: note: suggested alternative: 'FD_ZERO'
     FP_SUBNORMAL, FP_ZERO, __x); }
                   ^~~~~~~
                   FD_ZERO
Any ideas?
 
Last edited:

onre

Administrator
Feb 8, 2019
59
18
8
Mhm. Sounds like an old toolchain. I really regret I didn't version it better so it'd be easy to see which version you're using. At some point I figured it did not make C99 math symbols available on C++ side and fixed that, but I can't remember which tarballs have or don't have this.
 

Unxmaal

Administrator
Feb 8, 2019
38
13
8
Mhm. Sounds like an old toolchain. I really regret I didn't version it better so it'd be easy to see which version you're using. At some point I figured it did not make C99 math symbols available on C++ side and fixed that, but I can't remember which tarballs have or don't have this.
I've uninstalled and reinstalled a fresh copy of gnutoolchain-0.1-01-irix-6.5-mips.tardist and still receive these errors.
 

Unxmaal

Administrator
Feb 8, 2019
38
13
8
I switched the compiler to gcc 4.7.4 and it worked.

However, this produces a gperf that fontconfig can't use.

The gcc file referenced is /opt/local/gcc-8.2.0/include/c++/8.2.0/cmath:
C:
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
  constexpr int
  fpclassify(float __x)
  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
                                FP_SUBNORMAL, FP_ZERO, __x); }

  constexpr int
  fpclassify(double __x)
  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
                                FP_SUBNORMAL, FP_ZERO, __x); }

  constexpr int
  fpclassify(long double __x)
  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
                                FP_SUBNORMAL, FP_ZERO, __x); }
#endif
I can see FP_NAN and pals defined in lib/gcc/mips-sgi-irix6.5/8.2.0/include-fixed/internal/math_core.h:

Code:
/* C99: 7.12 6 defines for floating point classification */

#define   FP_ZERO          1
#define   FP_SUBNORMAL     2
#define   FP_NORMAL        4
#define   FP_INFINITE      8
#define   FP_NAN           16



Any other ideas for this?
 
Last edited:

hammy

Member
Jun 1, 2019
51
21
8
UK
At a guess, one of those compilers has extra "internal defines" - that is activating (or not) sections of include files.

Try getting each of those compilers to spit out the pre-processed file contents (-E) and then diff 'em.

Looking at /usr/include/internal/math_core.h - FP_NAN is hidden behind #ifdef __c99.
 

Unxmaal

Administrator
Feb 8, 2019
38
13
8
I powered up my O2, git cloned irixports, ran the bootstrap.

I tried compiling gperf first thing, and saw the same errors.

@hammy I ran gcc -c -save-temps search.cc on both octodad and my o2.

Here's a gist of the diff between the "known good" from octodad on the left, and the failed from the o2 on the right.


It sure seems like Octo has more "stuff" than my O2 (or my Origin 350 for that matter).
 

Unxmaal

Administrator
Feb 8, 2019
38
13
8
I wiped and reinstalled my O2. I'm still unable to compile gperf without getting this same math error.

This time I
Somehow I'm either installing the wrong thing or I'm not installing everything.

What's missing?



The "selections" file:
Bash:
# Overlay
from 192.168.0.99:6.5.30/Overlay/disc1/dist
from 192.168.0.99:6.5.30/Overlay/disc2/dist
from 192.168.0.99:6.5.30/Overlay/disc3/dist
# Foundation
from 192.168.0.99:Foundation/disc1/dist
from 192.168.0.99:Foundation/disc2/dist
# Development
from 192.168.0.99:Development/devfoundations/dist
from 192.168.0.99:Development/devlibs/dist
# NFS
from 192.168.0.99:Foundation/nfs/dist
# Apps
from 192.168.0.99:6.5.30/Overlay/apps/dist
from 192.168.0.99:6.5.30/Overlay/capps/dist
# MIPSpro
from 192.168.0.99:Development/prodev/dist
from 192.168.0.99:Development/mipspro/dist
from 192.168.0.99:Development/mipspro_update/dist
from 192.168.0.99:Development/mipspro_c/CDROM/dist
from 192.168.0.99:Development/mipspro_cee/dist
from 192.168.0.99:Development/mipspro_cpp/dist
from 192.168.0.99:Development/mipspro_ap/dist
# Extras
from 192.168.0.99:Extras/perfcopilot/dist
Octodad has the following extra items installed:

Bash:
I  c++_dev.sw64         06/27/2019  C++ Software
I  c++_dev.sw64.lib     06/27/2019  C++ Libraries 64bit
I  c++_dev              09/25/2017  C++ Headers and Libraries, 7.2.1
I  c++_dev.books        09/25/2017  C++ IRIS InSight Books
I  c++_dev.books.Tlshh_RG  09/25/2017  Tools.h++ Class Reference
I  c++_dev.books.Tlshh_UG  09/25/2017  Tools.h++ User's Guide

I  c_dev.sw             06/27/2019  C Software
I  c_dev.sw.c           06/27/2019  C Driver
I  c_dev.sw.util        06/27/2019  C Utilities
I  c_dev                09/25/2017  C Headers and Libraries, 7.2.1
I  c_dev.hdr            09/25/2017  C Headers
I  c_dev.hdr.lib        09/25/2017  C Library Headers
Note the 'C Software' above is different than the 7.4.4m software.

Here's a recursive diff of my /opt/local/gcc-8.2.0 vs Octodad's:


Here's a recursive diff of my /usr/includes vs Octodad's
Code:
ansible@IRIS ~ $ diff -r /usr/include ./usr/include
diff: ./usr/include/Mrm: No such file or directory
diff: ./usr/include/Sgm: No such file or directory
diff: ./usr/include/Vk: No such file or directory
diff: ./usr/include/X11/Mrm: No such file or directory
diff: ./usr/include/X11/Sgm: No such file or directory
diff: ./usr/include/X11/Xirisw: No such file or directory
diff: ./usr/include/X11/Xm: No such file or directory
diff: ./usr/include/X11/uil: No such file or directory
diff: ./usr/include/Xm: No such file or directory
Only in ./usr/include: cpuset.h
diff: ./usr/include/gl/feed.h: No such file or directory
Only in /usr/include/sys/fs: autofs.h
Only in /usr/include/sys/fs: autofs_prot.h
Only in /usr/include/sys/fs: lofs_info.h
Only in /usr/include/sys/fs: lofs_node.h
diff: ./usr/include/uil: No such file or directory
 
Last edited:

Unxmaal

Administrator
Feb 8, 2019
38
13
8
I found that the section listed in the error is happening due to "__CORRECT_ISO_CPP11_MATH_H_PROTO_FP" not being defined.

I hand-jammed a define for that into the top of gcc 8's math.h, and now it compiles just fine.

X_X