Opened 5 years ago

Closed 4 years ago

#60399 closed defect (fixed)

R @3.6.3_1 fails building on 10.5.8

Reported by: udbraumann Owned by: i0ntempest
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: leopard Cc: kjell.konis@…, szf1234@…
Port: R

Description

While upgrading R from 3.6.1_0 to 3.6.3_1 building stopped here:

...
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H    -fPIC  -pipe -Os -arch ppc  -c arithmetic.c -o arithmetic.o
:info:build arithmetic.c:185: error: initializer element is not constant
:info:build make[3]: *** [arithmetic.o] Error 1
...

My first attempt was to try MacPorts gcc6instead of the Xcode gcc-4.2, however, basically the same error occurred, whereas some explanation is given:

...
:info:build /opt/local/bin/gcc-mp-6 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H    -fPIC  -pipe -Os -arch ppc  -c arithmetic.c -o arithmetic.o
:info:build arithmetic.c:185:26: error: initializer element is not constant
:info:build  static LDOUBLE q_1_eps = 1 / LDBL_EPSILON;
:info:build                           ^
:info:build make[3]: *** [arithmetic.o] Error 1
...

Any hints? This is the portion of arithmetic.c where the error occurs at line 185:

    180 #if HAVE_LONG_DOUBLE && (SIZEOF_LONG_DOUBLE > SIZEOF_DOUBLE)
    181 # ifdef __PPC64__
    182  // PowerPC 64 (when gcc has -mlong-double-128) fails constant folding with LDOUBLE
    183 #  define q_1_eps (1 / LDBL_EPSILON)
    184 # else
    185 static LDOUBLE q_1_eps = 1 / LDBL_EPSILON;
    186 # endif
    187 #else
    188 static double  q_1_eps = 1 / DBL_EPSILON;
    189 #endif

Attachments (1)

main.log (137.4 KB) - added by udbraumann 5 years ago.

Download all attachments as: .zip

Change History (9)

Changed 5 years ago by udbraumann

Attachment: main.log added

comment:1 Changed 5 years ago by i0ntempest

Related: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=946836 Seems it's fixed in upstream and will come down in the next version. I don't have a ppc so I unfortunately can't test it.

comment:2 Changed 5 years ago by kencu (Ken)

FYI, long double constant folding is broken for powerpc with gcc. <https://gcc.gnu.org/bugzilla//show_bug.cgi?id=19779>, both 32 bit and 64bit, for years now...never fixed, for whatever reason.

So the fix indeed should be just to change that _PPC64__ to something more general, like __powerpc__, as the debian report suggests.

comment:3 Changed 5 years ago by mf2k (Frank Schima)

Owner: set to i0ntempest
Status: newassigned

comment:4 Changed 5 years ago by i0ntempest

I've opened a PR to update to 4.0.0, can you try to see if it builds? If it does I'll close this in that PR.

comment:5 Changed 5 years ago by udbraumann

I would, if you could give me some brief instructions how to do so. Sorry for my newbieness.

comment:6 Changed 5 years ago by i0ntempest

Get this portfile https://github.com/macports/macports-ports/raw/75629961b8c14c31db2419cfb84e0d8458cbf5a8/math/R/Portfile and put it in place (running port dir r will give you the portfile location), then try port destroot r and see if it finishes. Running port selfupdate will restore the old file.

comment:7 Changed 5 years ago by udbraumann

Thanks a lot, I managed to follow your hints (the only pitfall were the existing installation files, I had to run a sudo port clean --all R at first, i.e. --all was essential). Well, unfortunately still the same problem is persistent:

...
:info:build make[3]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_R/R/work/R-4.0.0/src/main'
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c CommandLineArgs.c -o CommandLineArgs.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c Rdynload.c -o Rdynload.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c Renviron.c -o Renviron.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c RNG.c -o RNG.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c agrep.c -o agrep.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c altclasses.c -o altclasses.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c altrep.c -o altrep.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c apply.c -o apply.o
:info:build /usr/bin/gcc-4.2 -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include -I/opt/local/include -I/opt/local/include -I../../src/nmath -DHAVE_CONFIG_H
 -fPIC  -pipe -Os -arch ppc  -c arithmetic.c -o arithmetic.o
:info:build arithmetic.c:186: error: initializer element is not constant
:info:build make[3]: *** [arithmetic.o] Error 1
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_R/R/work/R-4.0.0/src/main'
:info:build make[2]: *** [R] Error 2
...

The relevant modified code inside arithmetic.c presently looks like this:

    180 #if HAVE_LONG_DOUBLE && (SIZEOF_LONG_DOUBLE > SIZEOF_DOUBLE)
    181 # ifdef __powerpc__
    182  // PowerPC 64 (when gcc has -mlong-double-128) fails constant folding with LDOUBLE
    183  // Debian Bug#946836 shows it is needed also for 32-bit ppc, not just __PPC64__
    184 #  define q_1_eps (1 / LDBL_EPSILON)
    185 # else
    186 static LDOUBLE q_1_eps = 1 / LDBL_EPSILON;
    187 # endif
    188 #else
    189 static double  q_1_eps = 1 / DBL_EPSILON;
    190 #endif

That means __powerpc__ is not defined on my 32bit PPC!?

comment:8 Changed 4 years ago by i0ntempest

Resolution: fixed
Status: assignedclosed

4.0.2 now builds on 10.5_ppc buildbot, closing

Note: See TracTickets for help on using tickets.