Bug 219035 - devel/kBuild failed to build
Summary: devel/kBuild failed to build
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Virtualbox Team (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-03 10:50 UTC by Stéphane D'Alu
Modified: 2017-06-26 00:25 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane D'Alu 2017-05-03 10:50:13 UTC
Building from port on 11.0-RELEASE-p7 #0 r312523, kBuild failed with

/usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/config/help2man --name "stream editor for filtering and transforming text" \
  -p sed --include /usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/doc/sed.x ../sed/sed > /usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/doc/sed.1
help2man: can't get `--help' info from ../sed/sed
gmake[7]: *** [Makefile:878: sed.1] Error 255


/etc/make.conf
DEFAULT_VERSIONS+=   gcc=5
Comment 1 John Hein 2017-05-04 01:28:52 UTC
Perhaps an earlier error caused the build of kBuild's internal version of sed to fail?
Comment 2 Stéphane D'Alu 2017-05-04 09:21:00 UTC
kBuild version of sed segfault

root@rork:~ # /usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/bootstrap/sed/sed/sed
Segmentation fault (core dumped)

Running gdb:
Core was generated by `sed'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.7...Reading symbols from /usr/lib/debug//lib/libc.so.7.debug...done.
done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...Reading symbols from /usr/lib/debug//libexec/ld-elf.so.1.debug...done.
done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x000000080063a186 in memcpy () from /libexec/ld-elf.so.1
(gdb) 


Could it be related to the message printed when installing gcc?
> To ensure binaries built with this toolchain find appropriate versions
> of the necessary run-time libraries, you may want to link using
>
>  -Wl,-rpath=%%TARGLIB%%
Comment 3 Stéphane D'Alu 2017-05-04 16:00:02 UTC
Building from scratch (rm -rf /usr/local /var/db/pkg/*)

[root@rork /usr/ports/devel/kBuild]# MAKE_JOBS_UNSAFE=yes make

kBuild: Installing kmk_time => /usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998/kBuild/bin/freebsd.amd64/kmk_time
kmk: Leaving directory `/usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998'
echo done > /usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/bootstrap/ts-stage2-install
gmake[2]: Leaving directory '/usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998'
cd /usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998 && /bin/rm -f -r out
cd /usr/obj/usr/ports/devel/kBuild/work/kBuild-0.1.9998 && ./kBuild/env.sh kmk
./kBuild/env.sh: info: Executing command: kmk
Segmentation fault (core dumped)
./kBuild/env.sh: info: rc=139: kmk
*** Error code 139

Perhaps the problem is more related to gcc?
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2017-05-08 14:15:06 UTC
It was discussed a month ago in #bsdports@EFNet IRC.

I had the same with 
# grep =RELRO /var/db/ports/devel_binutils/options
OPTIONS_FILE_SET+=RELRO

After I changed it to OPTIONS_FILE_UNSET+=RELRO and recompile devel/binutils - devel/kBuild builded without errors.

A bit more info:
#include <ctype.h>
int main ()
{
   islower('a');
   return 0;
}

$ gcc -o test test.c
$ ./test
Segmentation fault

Quote from irc log:
<jilles> VVD, there is a commit to libexec/rtld-elf from early this year with message "For the main binary, postpone enforcing relro read-only protection until copy relocations are done."
<jilles> svn r311984 in head and MFCed to stable/11 and stable/10
<VVD> jilles, do I need recompile binutils with OPTIONS_FILE_UNSET+=RELRO ?
<jilles> VVD, that's a possible workaround
<VVD> will try
<VVD> jilles, yes, it fixed: binutils with OPTIONS_FILE_UNSET+=RELRO
Comment 5 Stéphane D'Alu 2017-05-08 15:55:10 UTC
I confirm, that was due to binutils RELRO option. I removed it and now kBuild is building fine. Thanks
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2017-06-26 00:25:13 UTC
Appears to work now.