Bug 232936 - lang/scm fails to build with GCC 8
Summary: lang/scm fails to build with GCC 8
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Mikhail Teterin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-03 14:47 UTC by Gerald Pfeifer
Modified: 2018-12-07 12:14 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (mi)


Attachments
scm.diff (348 bytes, patch)
2018-11-07 06:28 UTC, Tobias Kortkamp
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gerald Pfeifer freebsd_committer 2018-11-03 14:47:54 UTC
Among others this blocks a pending update of the default version of GCC
to GCC 8.

Cf. http://package22.nyi.freebsd.org/data/112amd64-default-PR231590/2018-10-29_06h48m05s/logs/errors/scm-5f2_7.log

;ERROR: "/wrkdirs/usr/ports/lang/scm/work/slib/lineio.scm": read-char: Wrong type in arg1 #f
; in expression: (#@apply #@read-char #@port)
; in scope:
;   port  procedure read-line
; defined by load: "/wrkdirs/usr/ports/lang/scm/work/slib/lineio.scm"
Comment 1 w.schwarzenfeld freebsd_triage 2018-11-03 20:32:46 UTC
In scm/build.scm:

line 1634:
"gcc49" "-O2 -pipe  -Wall -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wcast-qual -Wno
-unused-label -Wno-uninitialized -fstack-protector -Wl,-rpath=/usr/local/lib/gcc49 -fno-strict-aliasing " "-c"

and
line 1655:
parms "gcc49" "-O2 -pipe  -Wall -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wcast-qua
l -Wno-unused-label -Wno-uninitialized -fstack-protector -Wl,-rpath=/usr/local/lib/gcc49 -fno-strict-aliasing " "-fPI
C" "-c"

rpath is set to gcc49.
Comment 2 w.schwarzenfeld freebsd_triage 2018-11-03 21:40:22 UTC
I am always too fast. gcc49 is on my box cause of GCC=any. If I change it, it builds fine.
Comment 3 Tobias Kortkamp freebsd_committer 2018-11-07 06:28:41 UTC
Created attachment 199040 [details]
scm.diff

The port builds fine with GCC 8 when compiled WITH_DEBUG.  Removing
-O2 from CFLAGS seems to work as well.
Comment 4 Gerald Pfeifer freebsd_committer 2018-11-11 12:32:18 UTC
(In reply to Tobias Kortkamp from comment #3)
> Created attachment 199040 [details]
>
> The port builds fine with GCC 8 when compiled WITH_DEBUG.  Removing
> -O2 from CFLAGS seems to work as well.

Thanks for the digging into this and the patch, Tobias!

Would it be sufficient to change to -O1 instead of disabling 
optimizations?


Mikhail, your take as maintainer?
Comment 5 Tobias Kortkamp freebsd_committer 2018-11-16 09:44:40 UTC
(In reply to Gerald Pfeifer from comment #4)
> Would it be sufficient to change to -O1 instead of disabling 
> optimizations?

No, that doesn't work.

I guess we can land this with maintainer timeout after tomorrow.  Unless
someone has a better idea?

Should the CFLAGS hack be made conditional on the GCC version?
Not exactly sure how to add such a check though given that the port
uses USE_GCC=any vs USE_GCC=yes.
Comment 6 Tobias Kortkamp freebsd_committer 2018-11-16 09:45:56 UTC
(In reply to Tobias Kortkamp from comment #5)
s/tomorrow/Wednesday/
Comment 7 Gerald Pfeifer freebsd_committer 2018-11-16 10:35:52 UTC
(In reply to Tobias Kortkamp from comment #5)
> I guess we can land this with maintainer timeout [Wednesday]

Yes, please.  This is the last PR blocking the update to GCC 8 as the
default.

> Should the CFLAGS hack be made conditional on the GCC version?
> Not exactly sure how to add such a check though given that the port
> uses USE_GCC=any vs USE_GCC=yes.

USE_GCC=any really only should make a difference on non-tier 1 
architectures that still have the age old GCC 4.2 as a system
compiler.  Everywhere else it is the same as USE_GCC=yes.

Hence I would not start hacking around re CFLAGS, and in fact
switch over to USE_GCC=yes: Doesn't make a difference for nearly
everyone and actually gets those lower tier architectures more on
par using what those that are regularly tested/used, increasing
the chance it'll actually build and work there, too.

Thanks for your help with this, Tobias!
Comment 8 commit-hook freebsd_committer 2018-11-18 22:07:45 UTC
A commit references this bug:

Author: mi
Date: Sun Nov 18 22:06:46 UTC 2018
New revision: 485281
URL: https://svnweb.freebsd.org/changeset/ports/485281

Log:
  Try to improve chances of successful build - including, but not
  limited to disabling compiler-optimizations.

  Proper fixing seems inherently impossible -- even with -O0 valgrind
  flags hundreds of unitilized memory accesses during self-check.

  Tested with gcc8 and the base cc (clang) -- remove the GCC-requirement.

  Add some patches from Debian.

  While here simplify the extract-target a little and remove the BROKEN*
  lines to attempt building on other platforms again...

  Bump port-revision.

  PR:		 232936

Changes:
  head/lang/scm/Makefile
  head/lang/scm/files/patch-bigrecy_32bit_upstream
  head/lang/scm/files/patch-scmfig.h
  head/lang/scm/files/patch-texinfo5_fixes
  head/lang/scm/files/patch-warnings
Comment 9 Tobias Kortkamp freebsd_committer 2018-11-20 11:08:18 UTC
(In reply to commit-hook from comment #8)
It doesn't stage now:
install: /wrkdirs/usr/ports/lang/scm/work/scm/edline.so: No such file or directory

earlier there is:
edline.c:22:10: fatal error: 'readline/readline.h' file not found
#include <readline/readline.h>
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.


http://beefy11.nyi.freebsd.org/data/head-i386-default/p485373_s340656/logs/errors/scm-5f2_9.log
Comment 10 Mikhail Teterin freebsd_committer 2018-12-02 20:06:08 UTC
I can't reproduce this here -- my machine has readline installed by the base. How about this patch:

Index: Makefile
===================================================================
--- Makefile    (revision 486395)
+++ Makefile    (working copy)
@@ -25,6 +25,7 @@
 CFLAGS:=       ${CFLAGS:N-O*} -O0
 CFLAGS+=       -Wall -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wcast-qual
 CFLAGS+=       -Wno-unused-label -Wno-uninitialized
+CFLAGS+=       ${readline_ARGS:S|^port$|${CPPFLAGS}|:S|^$|-I/usr/include/edit|}
 
 SUB_FILES=     require.scm
 
? Thank you!
Comment 11 Tobias Kortkamp freebsd_committer 2018-12-07 12:14:38 UTC
(In reply to Mikhail Teterin from comment #10)
No, that doesn't fix the problem, but the error changes:

(system "cc -shared -lreadline -o edline.so edline.o")
/usr/bin/ld: error: unable to find library -lreadline
cc: error: linker command failed with exit code 1 (use -v to see invocation)

Looks like an additional edit of build.scm to add -L${LOCALBASE}/lib could
help here.