Subject: pkg/29684: flac fails to build on Solaris with some compiler flags
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 03/13/2005 03:24:00
>Number:         29684
>Category:       pkg
>Synopsis:       flac fails to build on Solaris with some compiler flags
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 13 03:24:00 +0000 2005
>Originator:     Simon Kuhn
>Release:        pkgsrc-current
Case Western Reserve University
SunOS reducto 5.9 Generic_117171-13 sun4u sparc SUNW,Sun-Fire-V240 Solaris

flac from pkgsrc-current does not build, failing with this error:

if /bin/ksh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../..   -I/usr/local/include   -I../.. -I./include -I../../include -O2 -DNDEBUG -O3 -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__ -O2 -mcpu=ultrasparc -mvis -I/usr/local/include -MT seekable_stream_encoder.lo -MD -MP -MF ".deps/seekable_stream_encoder.Tpo" -c -o seekable_stream_encoder.lo seekable_stream_encoder.c; \
then mv -f ".deps/seekable_stream_encoder.Tpo" ".deps/seekable_stream_encoder.Plo"; else rm -f ". gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/pkg/obj/audio/flac/work.reducto/.buildlink/include -I./include -I../../include -O2 -DNDEBUG -O3 -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__ -O2 -mcpu=ultrasparc -MT seekable_stream_encoder.lo -MD -MP -MF .deps/seekable_stream_encoder.Tpo -c seekable_stream_encoder.c  -fPIC -DPIC -o .libs/seekable_stream_encoder.o
seekable_stream_encoder.c: In function `metadata_callback_':
seekable_stream_encoder.c:943: error: unable to find a register to spill in class `I64_REGS'
seekable_stream_encoder.c:943: error: this is the insn:
(insn 510 456 465 22 febe2870 (parallel [
            (set (reg:DI 343)
                (lshiftrt:DI (reg:DI 16 %l0 [325])
                    (const_int 48 [0x30])))
            (clobber (scratch:SI))
        ]) 219 {lshrdi3_v8plus} (insn_list 456 (nil))
    (expr_list:REG_UNUSED (scratch:SI)
seekable_stream_encoder.c:943: confused by earlier errors, bailing out
gmake[4]: *** [seekable_stream_encoder.lo] Error 1
gmake[4]: Leaving directory `/usr/pkg/obj/audio/flac/work.reducto/flac-1.1.2/src/libFLAC'
gmake[3]: *** [all-recursive] Error 1

Compile flac-1.1.2 from pkgsrc-current on a Solaris 9 system using gcc-3.3.5 and other tools from pkgsrc-current with CFLAGS=-O2 -mcpu=ultrasparc -mvis

Probably impacts all operating systems on SPARC. Probably occurs with -mcpu=v9 as well as -mcpu=ultrasparc, since they're almost synonymous.
Add to flac/Makefile:

BUILDLINK_TRANSFORM+=   rm:-mcpu=ultrasparc

I suppose I could remove these from CFLAGS, but these flags have worked fine for pretty much every other pkgsrc package.