Bug 233980 - lang/smlnj: Fails to build (-m32) on poudriere on stable/12 (amd64)
Summary: lang/smlnj: Fails to build (-m32) on poudriere on stable/12 (amd64)
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Walter Schwarzenfeld
URL:
Keywords: needs-qa
Depends on: 234532
Blocks:
  Show dependency treegraph
 
Reported: 2018-12-13 14:22 UTC by Robert Cina
Modified: 2019-03-03 10:05 UTC (History)
2 users (show)

See Also:
koobs: maintainer-feedback+


Attachments
lang/smlnj poudriere build log (24.77 KB, text/plain)
2018-12-13 14:22 UTC, Robert Cina
no flags Details
Pass --32 to the assembler on amd64. Update SML/NJ to 110.84. (44.51 KB, patch)
2018-12-24 13:18 UTC, Johannes 5
koobs: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Cina 2018-12-13 14:22:44 UTC
Created attachment 200079 [details]
lang/smlnj poudriere build log

The port lang/smlnj fails to build for me in poudriere.

Below is a portion of the attached poudriere build log of the relevant error:

cc -c -O2 -pipe  -m32 -fstack-protector -fno-strict-aliasing  -DHOST_X86 -DTARGET_X86 -DOPSYS_UNIX -DOPSYS_FREEBSD -DDLOPEN  -I../objs -I../include ../mach-dep/unix-signal.c
../mach-dep/unix-signal.c:116:1: warning: control may reach end of non-void function [-Wreturn-type]
} /* end of GetSignalState. */
^
1 warning generated.
cc -c -O2 -pipe  -m32 -fstack-protector -fno-strict-aliasing  -DHOST_X86 -DTARGET_X86 -DOPSYS_UNIX -DOPSYS_FREEBSD -DDLOPEN  -I../objs -I../include ../mach-dep/unix-prof.c
cc -O2 -pipe  -m32 -fstack-protector -fno-strict-aliasing  -DHOST_X86 -DTARGET_X86 -DOPSYS_UNIX -DOPSYS_FREEBSD -DDLOPEN  -I../config -I../objs -I../include -o gen-offsets ../config/gen-offsets.c gen-common.o
./gen-offsets
cc -x assembler-with-cpp -E -P -D_ASM_ -DHOST_X86 -DTARGET_X86 -DOPSYS_UNIX -DOPSYS_FREEBSD -DDLOPEN  -I../bytecode -I../objs -I../include ../mach-dep/X86.prim.asm > prim.s
/usr/local/bin/as -o prim.o prim.s
prim.s: Assembler messages:
prim.s:89: Error: invalid instruction suffix for `pop'
prim.s:129: Error: invalid instruction suffix for `pop'
prim.s:129: Error: invalid instruction suffix for `pop'
prim.s:129: Error: invalid instruction suffix for `pop'
prim.s:129: Error: invalid instruction suffix for `pop'
prim.s:136: Error: invalid instruction suffix for `push'
prim.s:136: Error: invalid instruction suffix for `push'
prim.s:136: Error: invalid instruction suffix for `push'
prim.s:136: Error: invalid instruction suffix for `push'
prim.s:172: Error: invalid instruction suffix for `push'
prim.s:173: Error: invalid instruction suffix for `push'
prim.s:190: Error: invalid instruction suffix for `pop'
prim.s:191: Error: invalid instruction suffix for `pop'
prim.s:206: Error: invalid instruction suffix for `pop'
prim.s:207: Error: invalid instruction suffix for `pop'
prim.s:226: Error: invalid instruction suffix for `push'
prim.s:227: Error: invalid instruction suffix for `push'
prim.s:251: Error: invalid instruction suffix for `pop'
prim.s:252: Error: invalid instruction suffix for `pop'
prim.s:253: Error: operand type mismatch for `jmp'
prim.s:266: Error: invalid instruction suffix for `push'
prim.s:293: Error: invalid instruction suffix for `pop'
prim.s:294: Error: operand type mismatch for `jmp'
prim.s:296: Error: invalid instruction suffix for `pop'
prim.s:315: Error: invalid instruction suffix for `push'
prim.s:334: Error: invalid instruction suffix for `pop'
prim.s:335: Error: operand type mismatch for `jmp'
prim.s:353: Error: invalid instruction suffix for `push'
prim.s:376: Error: invalid instruction suffix for `pop'
prim.s:378: Error: operand type mismatch for `jmp'
prim.s:390: Error: invalid instruction suffix for `push'
prim.s:391: Error: invalid instruction suffix for `push'
prim.s:425: Error: invalid instruction suffix for `pop'
prim.s:426: Error: invalid instruction suffix for `pop'
prim.s:427: Error: operand type mismatch for `jmp'
prim.s:429: Error: invalid instruction suffix for `pop'
prim.s:430: Error: invalid instruction suffix for `pop'
prim.s:448: Error: operand type mismatch for `jmp'
prim.s:459: Error: operand type mismatch for `jmp'
prim.s:489: Error: invalid instruction suffix for `pop'
prim.s:494: Error: operand type mismatch for `jmp'
prim.s:508: Error: operand type mismatch for `jmp'
prim.s:511: Error: invalid instruction suffix for `push'
prim.s:526: Error: operand type mismatch for `jmp'
*** Error code 1

Stop.
make[2]: stopped in /wrkdirs/usr/ports/lang/smlnj/work/smlnj-110.77/base/runtime/objs
*** Error code 1

Stop.
make[1]: stopped in /wrkdirs/usr/ports/lang/smlnj/work/smlnj-110.77/base/runtime/objs
./config/install.sh: !!! Run-time system build failed for some reason.
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/smlnj
=>> Cleaning up wrkdir
===>  Cleaning for smlnj-110.77
build of lang/smlnj | smlnj-110.77 ended at Thu Dec 13 09:13:59 EST 2018
build time: 00:00:04
!!! build failure encountered !!!
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2018-12-14 04:41:42 UTC
What is the purpose of -m32 within the globally provided CFLAGS?

Is the issue reproducible without this flag?

Does upstream support (well/intentionally) cross compiling?

It appears CFLAGS (-m32) is insufficient (if supported). The failure is in an 'as' invocation, and (as too, at least) probably needs relevant flags
Comment 2 Johannes 5 2018-12-24 13:10:55 UTC
On Fri, 14 Dec 2018 04:41:42 +0000, Kubilay Kocak <koobs@FreeBSD.org> wrote:

> What is the purpose of -m32 within the globally provided CFLAGS?

Currently the SML/NJ runtime is only available as a 32-bit program.

> Does upstream support (well/intentionally) cross compiling?

The SML/NJ compiler does support generating 64-bit binaries, but they
can't be run until upstream has completed work on the 64-bit runtime as
well. Therefore ...

> Is the issue reproducible without this flag?

... this flag is still essential for making SML/NJ run on amd64.

> It appears CFLAGS (-m32) is insufficient (if supported). The failure
> is in an 'as' invocation, and (as too, at least) probably needs
> relevant flags

The missing assembler flag (--32) is indeed the problem with FreeBSD 12
on amd64. Using a seperate ASFLAGS variable in the port's Makefile and
passing it through the SML/NJ makefiles in base/runtime/objs fixes the
issue for me on 12-STABLE amd64. Please try the following patch:

	<ftp://offshore.free.de/pub/patch/smlnj.patch.20181220>
	MD5 (smlnj.patch.20181220) = a9067eb9a8b19d9ca6ff04911825ae62

This patch also updates lang/smlnj to the latest upstream version
110.84, which saves me some work compared to having a seperate fix for
the old version 110.77.

Please let me know if this patch also works for you. Then I'll give it
some more testing here (incl. 12-STABLE on i386) and suggest it to
be commited to the ports tree if all goes well.

Thanks!
Johannes
Comment 3 Johannes 5 2018-12-24 13:18:36 UTC
Created attachment 200454 [details]
Pass --32 to the assembler on amd64. Update SML/NJ to 110.84.

This attachment should be identical to:

<ftp://offshore.free.de/pub/patch/smlnj.patch.20181220>
MD5 (smlnj.patch.20181220) = a9067eb9a8b19d9ca6ff04911825ae62
Comment 4 Robert Cina 2018-12-24 14:38:35 UTC
After applying your patch on 12/stable the build of smlnj fails in poudriere with a patch error as follows:


MLSOURCEPATCHES=`true`  CFLAGS='-O2 -pipe  -m32 -fstack-protector -fno-strict-aliasing ' LDFLAGS=' -fstack-protector -fuse-ld=bfd '  AS='/usr/local/bin/as' ASFLAGS='--32' EXTRA_DEFS=''  ./config/install.sh
./config/install.sh: Using shell /bin/sh.
./config/install.sh: SML root is /wrkdirs/usr/ports/lang/smlnj/work/smlnj-110.84.
./config/install.sh: Installation directory is /wrkdirs/usr/ports/lang/smlnj/work/smlnj-110.84.
./config/install.sh: Installing version 110.84.
./config/install.sh: URL of source archive is http://smlnj.cs.uchicago.edu/dist/working/110.84/.
./config/install.sh: Script /wrkdirs/usr/ports/lang/smlnj/work/smlnj-110.84/bin/.arch-n-opsys reports ARCH=x86; OPSYS=freebsd; HEAP_SUFFIX=x86-bsd.
/wrkdirs/usr/ports/lang/smlnj/work/smlnj-110.84/config/unpack: Un-GZIP-ing and un-TAR-ing run-time archive.
Ignoring previously applied (or reversed) patch.
1 out of 1 hunks ignored--saving rejects to base/runtime/mach-dep/signal-sysdep.h.rej
./config/install.sh: !!! patch file /usr/ports/lang/smlnj/files/do-patch-base_runtime_mach-dep_signal-sysdep.h.orig failed to patch.
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/smlnj
=>> Cleaning up wrkdir
===>  Cleaning for smlnj-110.84
build of lang/smlnj | smlnj-110.84 ended at Mon Dec 24 09:35:42 EST 2018
build time: 00:00:03
!!! build failure encountered !!!
Comment 5 Robert Cina 2018-12-25 22:30:44 UTC
After doing as you instructed:

# cd .../lang/smlnj
# fetch -q -o - 'https://bz-attachments.freebsd.org/attachment.cgi?id=200454' | patch
# find . \( -name '*.orig' -o -size 0c \) -print -delete

I can confirm that the patch works on 12/stable now for me.  Thanks for all the great work for maintaining this port.
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2018-12-30 08:14:25 UTC
Thanks for the patch Johannes.

Can you confirm that the changes pass QA (portlint, poudriere at least).

It would also be preferable to separate the patches for fixing this issue alone, and the version update
Comment 7 Johannes 5 2018-12-30 14:21:05 UTC
On Sun, 30 Dec 2018 08:14:25 +0000, Kubilay Kocak <koobs@FreeBSD.org>
wrote:

> Thanks for the patch Johannes.
> Can you confirm that the changes pass QA (portlint, poudriere at
> least).
No, the patch above (smlnj.patch.20181220) does not. But after some
wrestling with poudriere's stage-qa I'm confident that this improved
version of the patch will make us happy:)

	<ftp://offshore.free.de/pub/patch/smlnj.patch.20181230>
	MD5 (smlnj.patch.20181220) = 98d2cf0c2436f3c4ce11dcc9db3d0cdd

There's still one portlint warning concerning the ${CHOWN} in the
Makefile (which was introduced to avoid a stage-qa warning;). But I
don't think that resolving this warning by further obfuscating the PLIST
generation in the Makefile with even more invocations of sed would be
beneficial. Please correct me if I get the priorities wrong here.

> It would also be preferable to separate the patches for fixing this
> issue alone, and the version update
I thought about that as well, but doing the QA is very tedious over
here (esp. for my prehistoric i386 equipment;). So I decided to rather
put my rare efforts into the version update (the first one after 4
years of 110.77:-(. It's not difficult to split out the ASFLAGS parts
of the patch, but I can't see sufficient reason for this because the
update patch includes them.

So I suggest that I'll finish testing smlnj.patch.20181230 today, make
the resulting poudriere testport outputs available, and submit it in a
seperate PR like "lang/smlnj: update to 110.84, unbreak on 12/amd64".

If you (dis)agree and/or find the time to check smlnj.patch.20181230 on
your fast machines, please let me know. ("Fast" is useful when testing
the port's RECOMPILE option - which also works on amd64 now!-)

Thanks!
Johannes
Comment 8 Walter Schwarzenfeld freebsd_triage 2019-03-03 10:05:25 UTC
See Comment no. 3 in bug #236070. Was an error in the poudriere ports tree of the reporter. Not a bug.