Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2014 00:22:25 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        office@FreeBSD.org
Cc:        Roman Divacky <rdivacky@FreeBSD.org>
Subject:   Boost port change: for clang, switch from pth to pch
Message-ID:  <E2FA8B51-9652-4FD1-B203-12739CA8B172@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_900A17EB-0815-435D-A6FB-54A7E2635A99
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_2C72ACB8-773C-4359-AC8F-0AF8310CC36D"


--Apple-Mail=_2C72ACB8-773C-4359-AC8F-0AF8310CC36D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Dear boost port maintainers,

I'm working on importing clang 3.4 into head.  This turns up some nasty
problems in the way devel/boost-libs is using clang's -emit-pth
precompiled headers feature:

=
http://package18.nyi.freebsd.org/bulk/head-default-pr_185430/2014-01-23_06=
h38m38s/logs/errors/boost-libs-1.52.0_2.log

E.g. clang crashes fairly randomly on its own .pth files.  I have been
informed by the upstream authors that this is more or less expected, as
clang's -emit-pth and -include-pth features have never worked entirely
correctly, and are basically abandoned by upstream.  They will most
likely be removed in a future clang release.

Instead, we should use -emit-pch and -include-pch, which are more
robust.  I have attached a patch for boost's clang-linux.jam, which
essentially does s/pth/pch/g, and that makes boost-libs compile
successfully with clang 3.4 for me, at least on i386 and amd64.

I should probably also send this upstream, but I would really like to
get this patch into the port, as I plan on doing the clang 3.4 import
somewhere in the coming week.

-Dimitry

--Apple-Mail=_2C72ACB8-773C-4359-AC8F-0AF8310CC36D
Content-Disposition: attachment;
	filename=patch-tools__build__v2__tools__clang-linux.jam
Content-Type: application/octet-stream;
	name="patch-tools__build__v2__tools__clang-linux.jam"
Content-Transfer-Encoding: 7bit

--- tools/build/v2/tools/clang-linux.jam.orig	2011-06-06 22:36:21.000000000 +0200
+++ tools/build/v2/tools/clang-linux.jam	2014-02-09 22:19:34.000000000 +0100
@@ -31,7 +31,7 @@
 generators.override clang-linux.compile.c++.pch : pch.default-cpp-pch-generator ;
  
 type.set-generated-target-suffix PCH
-  : <toolset>clang <toolset-clang:platform>linux : pth ;
+  : <toolset>clang <toolset-clang:platform>linux : pch ;
 
 toolset.inherit-rules clang-linux : gcc ;
 toolset.inherit-flags clang-linux : gcc 
@@ -95,24 +95,24 @@
   gcc.setup-fpic $(targets) : $(sources) : $(properties) ;
   gcc.setup-address-model $(targets) : $(sources) : $(properties) ;
 
-  local pth-file = [ on $(<) return $(PCH_FILE) ] ;
+  local pch-file = [ on $(<) return $(PCH_FILE) ] ;
 
-  if $(pth-file) {
-    DEPENDS $(<) : $(pth-file) ;
+  if $(pch-file) {
+    DEPENDS $(<) : $(pch-file) ;
     clang-linux.compile.c++.with-pch $(targets) : $(sources) ;
   }
   else {
-    clang-linux.compile.c++.without-pth $(targets) : $(sources) ;
+    clang-linux.compile.c++.without-pch $(targets) : $(sources) ;
   }
 }
 
-actions compile.c++.without-pth {
+actions compile.c++.without-pch {
   "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
 }
 
 actions compile.c++.with-pch bind PCH_FILE
 {
-  "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pth -Xclang "$(PCH_FILE)" -o "$(<)" "$(>)"
+  "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pch -Xclang "$(PCH_FILE)" -o "$(<)" "$(>)"
 }
 
 rule compile.c ( targets * : sources * : properties * )
@@ -121,25 +121,25 @@
   gcc.setup-fpic $(targets) : $(sources) : $(properties) ;
   gcc.setup-address-model $(targets) : $(sources) : $(properties) ;    
 
-  local pth-file = [ on $(<) return $(PCH_FILE) ] ;
+  local pch-file = [ on $(<) return $(PCH_FILE) ] ;
 
-  if $(pth-file) {
-    DEPENDS $(<) : $(pth-file) ;
+  if $(pch-file) {
+    DEPENDS $(<) : $(pch-file) ;
     clang-linux.compile.c.with-pch $(targets) : $(sources) ;
   }
   else {
-    clang-linux.compile.c.without-pth $(targets) : $(sources) ;
+    clang-linux.compile.c.without-pch $(targets) : $(sources) ;
   }
 }
 
-actions compile.c.without-pth
+actions compile.c.without-pch
 {
   "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
 }
 
 actions compile.c.with-pch bind PCH_FILE
 {
-  "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pth -Xclang "$(PCH_FILE)" -c -o "$(<)" "$(>)"
+  "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pch -Xclang "$(PCH_FILE)" -c -o "$(<)" "$(>)"
 }
 
 ###############################################################################
@@ -152,7 +152,7 @@
 }
 
 actions compile.c++.pch {
-  rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pth -o "$(<)" "$(>)"
+  rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pch -o "$(<)" "$(>)"
 }
 
 rule compile.c.pch ( targets * : sources * : properties * ) {
@@ -163,7 +163,7 @@
 
 actions compile.c.pch
 {
-  rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pth -o "$(<)" "$(>)"
+  rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pch -o "$(<)" "$(>)"
 }
 
 ###############################################################################

--Apple-Mail=_2C72ACB8-773C-4359-AC8F-0AF8310CC36D
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii



--Apple-Mail=_2C72ACB8-773C-4359-AC8F-0AF8310CC36D--

--Apple-Mail=_900A17EB-0815-435D-A6FB-54A7E2635A99
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)

iEYEARECAAYFAlL4DbgACgkQsF6jCi4glqM9JwCgspDHj61ckCC4H5L8IzQUYXqk
BWIAoIYXeR4a36BLcF+e/nnlRJhEaBTT
=o3Hj
-----END PGP SIGNATURE-----

--Apple-Mail=_900A17EB-0815-435D-A6FB-54A7E2635A99--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E2FA8B51-9652-4FD1-B203-12739CA8B172>