poudriere use vs. later having debug information and source around in case of problems

2017-08-14 Thread Mark Millard
I've been exploring ports-mgmt/poudriere-devel use, not
for building all the ports or huge sets of them but for
building those comparatively few that I normally build
and install because I use them.

Historically I have used:

portmaster -DK

to leave source code and build materials around
for reference in case of problems, leaving them
where the debug information then indicates. (Of
course more is left around than may be needed but
I have the storage space to allow this.)

I've also built with debug information (but avoiding
disabling optimizations). Currently I do this via
adding to /usr/ports/Mk/bsd.port.mk a:

ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG

to control the behavior and avoiding WITH_DEBUG
for ports that give it problematical alternate
interpretations ( webkit-qt5* back when I was
using it and llvm* ). In /etc/make.conf this
use looks like:

#From  a local /usr/ports/Mk/bsd.port.mk extension:
ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG=
#
.if ${.CURDIR:M*/devel/llvm*}
#WITH_DEBUG=
.elif ${.CURDIR:M*/www/webkit-qt5*}
#WITH_DEBUG=
.else
WITH_DEBUG=
.endif
MALLOC_PRODUCTION=

In bsd.port.mk it looks like:

# svnlite diff /usr/ports/Mk/bsd.port.mk 
Index: /usr/ports/Mk/bsd.port.mk
===
--- /usr/ports/Mk/bsd.port.mk   (revision 447082)
+++ /usr/ports/Mk/bsd.port.mk   (working copy)
@@ -1645,7 +1645,11 @@
 STRIP_CMD= ${TRUE}
 .endif
 DEBUG_FLAGS?=  -g
+.if defined(ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG)
+CFLAGS:=   ${CFLAGS} ${DEBUG_FLAGS}
+.else
 CFLAGS:=   ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS}
+.endif
 .if defined(INSTALL_TARGET)
 INSTALL_TARGET:=   ${INSTALL_TARGET:S/^install-strip$/install/g}
 .endif

(Noted just to give an idea of the context.)

So far I do not see a way of using poudriere to leave
the material in place to support debug activity and
source inspections and the like if a program later
fails. (Note this is not about build-time failures.)

Have I missed something? Are there any hooks for doing
such?


===
Mark Millard
markmi at dsl-only.net

___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Buildfailures with ld.lld

2017-08-14 Thread Shawn Webb
On Mon, Aug 14, 2017 at 08:01:08PM +0200, Dimitry Andric wrote:
> On 14 Aug 2017, at 19:41, Shawn Webb  wrote:
> > 
> > On Mon, Aug 14, 2017 at 07:38:28PM +0200, Dimitry Andric wrote:
> >> On 14 Aug 2017, at 18:40, Shawn Webb  wrote:
> >>> 
> >>> On Mon, Aug 14, 2017 at 07:28:39PM +0300, Johannes Jost Meixner wrote:
>  I'm seeing a few `undefined references` trying to build recent base on
>  HardenedBSD with clang 5.0.0:
>  
>  https://dpaste.de/FThb/raw
>  
>  Would you know what I am missing here?
> >>> 
> >>> Hey Johannes,
> >>> 
> >>> It looks like contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
> >>> isn't included in the Makefile for usr.bin/lld.
> >>> 
> >>> I'm wondering if the lib/DebugInfo/DWARF files should be included in
> >>> usr.bin/lld/Makefile. dim@, could you verify?
> >> 
> >> Those files are already in lib/clang/libllvm/Makefile.  How can this
> >> particular error be reproduced?  I just did a fresh clone of hardenedbsd
> >> master, and it built just fine for me, with an empty make.conf and
> >> src.conf.
> > 
> > Johannes is trying to build ports-mgmt/pkg in HardenedBSD
> > 12-CURRENT/amd64, where MK_LLD_IS_LD is default to yes. If you use the
> > HardenedBSD ports tree, ports-mgmt/pkg is patched to allow a configure
> > argument to enable SafeStack for pkg(8) and pkg-static(8)
> > (--enable-safestack).
> > 
> > Reproduction steps:
> > 
> > 1. Install HardenedBSD 12-CURRENT/amd64
> > 2. Fetch HardenedBSD's ports tree
> > 3. Attempt to build ports-mgmt/pkg
> 
> I don't see why pkg is trying to build lld?  It's just a package
> management tool.  Or are you building some sort of jail, e.g. in
> poudriere?
> 
> For me, it's easiest to have a reproduction scenario where I can build
> either FreeBSD head or HardenedBSD master, with some specific src.conf
> settings.  So maybe MK_LLD_IS_LD would cause this problem?

It looks like I got confused with another bug report Johannes and I were
talking about in other channels. I'll let him dive into more detail
here.

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: Buildfailures with ld.lld

2017-08-14 Thread Dimitry Andric
On 14 Aug 2017, at 19:41, Shawn Webb  wrote:
> 
> On Mon, Aug 14, 2017 at 07:38:28PM +0200, Dimitry Andric wrote:
>> On 14 Aug 2017, at 18:40, Shawn Webb  wrote:
>>> 
>>> On Mon, Aug 14, 2017 at 07:28:39PM +0300, Johannes Jost Meixner wrote:
 I'm seeing a few `undefined references` trying to build recent base on
 HardenedBSD with clang 5.0.0:
 
 https://dpaste.de/FThb/raw
 
 Would you know what I am missing here?
>>> 
>>> Hey Johannes,
>>> 
>>> It looks like contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
>>> isn't included in the Makefile for usr.bin/lld.
>>> 
>>> I'm wondering if the lib/DebugInfo/DWARF files should be included in
>>> usr.bin/lld/Makefile. dim@, could you verify?
>> 
>> Those files are already in lib/clang/libllvm/Makefile.  How can this
>> particular error be reproduced?  I just did a fresh clone of hardenedbsd
>> master, and it built just fine for me, with an empty make.conf and
>> src.conf.
> 
> Johannes is trying to build ports-mgmt/pkg in HardenedBSD
> 12-CURRENT/amd64, where MK_LLD_IS_LD is default to yes. If you use the
> HardenedBSD ports tree, ports-mgmt/pkg is patched to allow a configure
> argument to enable SafeStack for pkg(8) and pkg-static(8)
> (--enable-safestack).
> 
> Reproduction steps:
> 
> 1. Install HardenedBSD 12-CURRENT/amd64
> 2. Fetch HardenedBSD's ports tree
> 3. Attempt to build ports-mgmt/pkg

I don't see why pkg is trying to build lld?  It's just a package
management tool.  Or are you building some sort of jail, e.g. in
poudriere?

For me, it's easiest to have a reproduction scenario where I can build
either FreeBSD head or HardenedBSD master, with some specific src.conf
settings.  So maybe MK_LLD_IS_LD would cause this problem?

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: Buildfailures with ld.lld

2017-08-14 Thread Dimitry Andric
On 14 Aug 2017, at 18:40, Shawn Webb  wrote:
> 
> On Mon, Aug 14, 2017 at 07:28:39PM +0300, Johannes Jost Meixner wrote:
>> I'm seeing a few `undefined references` trying to build recent base on
>> HardenedBSD with clang 5.0.0:
>> 
>> https://dpaste.de/FThb/raw
>> 
>> Would you know what I am missing here?
> 
> Hey Johannes,
> 
> It looks like contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
> isn't included in the Makefile for usr.bin/lld.
> 
> I'm wondering if the lib/DebugInfo/DWARF files should be included in
> usr.bin/lld/Makefile. dim@, could you verify?

Those files are already in lib/clang/libllvm/Makefile.  How can this
particular error be reproduced?  I just did a fresh clone of hardenedbsd
master, and it built just fine for me, with an empty make.conf and
src.conf.

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: Buildfailures with ld.lld

2017-08-14 Thread Shawn Webb
On Mon, Aug 14, 2017 at 07:28:39PM +0300, Johannes Jost Meixner wrote:
> I'm seeing a few `undefined references` trying to build recent base on
> HardenedBSD with clang 5.0.0:
> 
> https://dpaste.de/FThb/raw
> 
> Would you know what I am missing here?

Hey Johannes,

It looks like contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
isn't included in the Makefile for usr.bin/lld.

I'm wondering if the lib/DebugInfo/DWARF files should be included in
usr.bin/lld/Makefile. dim@, could you verify?

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Buildfailures with ld.lld

2017-08-14 Thread Johannes Jost Meixner
I'm seeing a few `undefined references` trying to build recent base on
HardenedBSD with clang 5.0.0:

https://dpaste.de/FThb/raw

Would you know what I am missing here?


-- 


Best regards,

Johannes Meixner


Perceivon OÜ
Pikk 7-17
10123 Tallinn

tel: +372 5855 1779
web: http://www.perceivon.net



signature.asc
Description: OpenPGP digital signature