From owner-freebsd-ports@freebsd.org Wed Aug 7 18:02:45 2019 Return-Path: Delivered-To: freebsd-ports@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FA03B31E7; Wed, 7 Aug 2019 18:02:45 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463fVX5hgZz45ZB; Wed, 7 Aug 2019 18:02:44 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 160EB3C0199; Wed, 7 Aug 2019 18:02:44 +0000 (UTC) Date: Wed, 7 Aug 2019 18:02:44 +0000 From: Brooks Davis To: Mark Millard Cc: freebsd-toolchain@freebsd.org, freebsd-ports@freebsd.org, freebsd-ppc@freebsd.org Subject: Re: devel/llvm90 requires math/z3 first; building math/z3 requires a c++ toolchain be in place Message-ID: <20190807180244.GJ94703@spindle.one-eyed-alien.net> References: <8DB3EAA4-2B88-4180-8386-673524D27C64@yahoo.com> <20190806165525.GC94703@spindle.one-eyed-alien.net> <2A88AADC-8ED0-4FFD-85A8-34C0186D5D4F@yahoo.com> <20190807020826.GH94703@spindle.one-eyed-alien.net> <602EEB6C-D0B0-4EFB-AB0E-BE98FF1C4D90@yahoo.com> <086C99B8-1289-4D81-AAF5-85FB0AE70B7C@yahoo.com> <20190807171714.GI94703@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="D6IIOQQv2Iwyp54J" Content-Disposition: inline In-Reply-To: <20190807171714.GI94703@spindle.one-eyed-alien.net> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 463fVX5hgZz45ZB X-Spamd-Bar: ------- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-7.40 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; IP_SCORE(-3.56)[ip: (-9.27), ipnet: 199.48.128.0/22(-4.62), asn: 36236(-3.87), country: US(-0.05)]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[yahoo.com]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; SIGNED_PGP(-2.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2019 18:02:45 -0000 --D6IIOQQv2Iwyp54J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 07, 2019 at 05:17:14PM +0000, Brooks Davis wrote: > On Tue, Aug 06, 2019 at 09:22:52PM -0700, Mark Millard wrote: > > [I found something known to be missing in the > > in at least some versions of > > llvm/cmake/modules/CrossCompile.cmake that messes > > up the overall handling of LLVM_ENABLE_Z3_SOLVER .] > >=20 > > On 2019-Aug-6, at 20:23, Mark Millard wrote: > >=20 > >=20 > >=20 > > > On 2019-Aug-6, at 19:08, Brooks Davis wrote: > > >=20 > > >> On Tue, Aug 06, 2019 at 05:59:21PM -0700, Mark Millard wrote: > > >>>=20 > > >>>=20 > > >>> On 2019-Aug-6, at 09:55, Brooks Davis wrote: > > >>>=20 > > >>>> I'd prefer to disable this dependency. There's a knob that worked= in > > >>>> the 8.0 timeframe, but the lit build now autodetects z3 when it is > > >>>> present and I've failed to find a knob to disable it. For now, th= e easy > > >>>> workaround is probably to disable options LIT. We could make that= the > > >>>> default on non-LLVM platforms is that makes sense. > > >>>>=20 > > >>>> -- Brooks > > >>>=20 > > >>> Okay. > > >>>=20 > > >>> poudriere-devel automatically built math/z3 because > > >>> I'd indicated to build devel/llvm90 . math/z3 was not > > >>> previously built: I've never had other use of it. So > > >>> my context was not one of an implicit autodetect. > > >>=20 > > >> The dependency is there because if z3 is installed then the package > > >> that is built depends on z3. Thus I had not choice but to add a z3 > > >> dependency until I find a way to turn it off. You can either help f= ind > > >> a way to disable z3 detection in the cmake infrastructure or turn off > > >> LIT. I don't have any use for reports on the effects of commenting = out > > >> the DEPENDS line. I know what that does. > > >=20 > > >=20 > > > I hope this helps. (I'm not a cmake expert.) > > >=20 > > > llvm-9.0.0rc1.src/lib/Support/Z3Solver.cpp does: > > >=20 > > > #if LLVM_WITH_Z3 > > >=20 > > > #include > > >=20 > > > namespace { > > > . . . > > > } // end anonymous namespace > > >=20 > > > #endif > > >=20 > > > llvm::SMTSolverRef llvm::CreateZ3Solver() { > > > #if LLVM_WITH_Z3 > > > return llvm::make_unique(); > > > #else > > > llvm::report_fatal_error("LLVM was not compiled with Z3 support, reb= uild " > > > "with -DLLVM_ENABLE_Z3_SOLVER=3DON", > > > false); > > > return nullptr; > > > #endif > > > } > > >=20 > > > (There are other places LLVM_WITH_Z3 is used but the > > > above is suggestive.) > > >=20 > > > Working backwards finds that: > > >=20 > > > /wrkdirs/usr/ports/devel/llvm90/work/llvm-9.0.0rc1.src/CMakeLists.txt > > >=20 > > > shows LLVM_WITH_Z3 being conditionally set to 1 via . . . > > >=20 > > > set(LLVM_Z3_INSTALL_DIR "" CACHE STRING "Install directory of the Z3 = solver.") > > >=20 > > > find_package(Z3 4.7.1) > > >=20 > > > if (LLVM_Z3_INSTALL_DIR) > > > if (NOT Z3_FOUND) > > > message(FATAL_ERROR "Z3 >=3D 4.7.1 has not been found in LLVM_Z3_I= NSTALL_DIR: ${LLVM_Z3_INSTALL_DIR}.") > > > endif() > > > endif() > > >=20 > > > set(LLVM_ENABLE_Z3_SOLVER_DEFAULT "${Z3_FOUND}") > > >=20 > > > option(LLVM_ENABLE_Z3_SOLVER > > > "Enable Support for the Z3 constraint solver in LLVM." > > > ${LLVM_ENABLE_Z3_SOLVER_DEFAULT} > > > ) > > >=20 > > > if (LLVM_ENABLE_Z3_SOLVER) > > > if (NOT Z3_FOUND) > > > message(FATAL_ERROR "LLVM_ENABLE_Z3_SOLVER cannot be enabled when = Z3 is not available.") > > > endif() > > >=20 > > > set(LLVM_WITH_Z3 1) > > > endif() > > >=20 > > > if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) > > > set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} ) > > > endif() > > >=20 > > >=20 > > > If I read that correctly, LLVM_ENABLE_Z3_SOLVER set directly > > > appears to override the default (that tracks if z3 was found). > >=20 > > I saw a reference to: > >=20 > > diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules= /CrossCompile.cmake > > index bc3b210f018..0c30b88f80f 100644 > > --- a/llvm/cmake/modules/CrossCompile.cmake > > +++ b/llvm/cmake/modules/CrossCompile.cmake > > @@ -53,6 +53,7 @@ function(llvm_create_cross_target_internal target_nam= e toolchain buildtype) > > -DLLVM_DEFAULT_TARGET_TRIPLE=3D"${TARGET_TRIPLE}" > > -DLLVM_TARGET_ARCH=3D"${LLVM_TARGET_ARCH}" > > -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=3D"${LLVM_TEMPORARILY_A= LLOW_OLD_TOOLCHAIN}" > > + -DLLVM_ENABLE_Z3_SOLVER=3D"${LLVM_ENABLE_Z3_SOLVER}" > > ${build_type_flags} ${linker_flag} ${external_clang_dir} > > WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} > > DEPENDS CREATE_LLVM_${target_name} > >=20 > > in https://reviews.llvm.org/D54978 on Feb 12 2019, 5:41 PM > > and it had the comment: > >=20 > > QUOTE > > Independent of the rest of the discussion, this patch should be part of= the reland, to make sure that explicitly turning off Z3 works reliably. Th= anks for coming up with that, and thanks everyone for the good discussion h= ere :) > > END QUOTE > >=20 > > This apparently fixes a sub-cmake not respecting the > > LLVM_ENABLE_Z3_SOLVER setting in the parent cmake. > > (The overall review earlier describes the sub-cmake > > not doing the right thing.) >=20 > Thanks for digging this up. Unfortunately, this doesn't seem to have > solved the problem. With this patch applied I still get this if I have > z3 installed on the system and no LIB_DEPENDS line: >=20 > Error: /usr/local/bin/FileCheck90 is linked to /usr/local/lib/libz3.so.0 > from math/z3 but it is not declared as a dependency > Warning: you need LIB_DEPENDS+=3Dlibz3.so:math/z3 >=20 > I've generally observed that the portions of the system that cover lit > (which includes FileCheck) aren't very well behaved. I've filed https://bugs.llvm.org/show_bug.cgi?id=3D42921 upstream, hopefully someone who understand this part of the cmake system will help us out. -- Brooks --D6IIOQQv2Iwyp54J Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJdSxJCAAoJEKzQXbSebgfA/zgH/R6J4rXQf1lRPUAU6UdmaIR/ PZK4kgl0mPJLfvW3QIiF6ID8zP6aaC0GWHk8LZgxDpauD3SNc+Cq6roA2jNM7L7x 7stIDM69HT9vGHXt9/b/YTU6tKCO/3YgZLUkOsNTeG2mpfJleurRdLzdVL2pODNF xtcZNStbYqvpi88Y0bE5nSZ/q9ieBgPFqAMcoUy4ZTKIb1+/K244TwyqQoTmMJzE eatMJ9sgD7l3TUglikpiLplaA3NzozoMPDe+LQTckuds2azdMJo32rHid1iQ+u1G lmYLrkopXCdqQyXKLrnyN4Rgfmn/c3d/aNnkG4iNpdt9oEibbMfsyLl1zBjMwmY= =Zv7c -----END PGP SIGNATURE----- --D6IIOQQv2Iwyp54J--