Bug 166373 - x11/libX11 fails if /usr/bin/cpp is clang
Summary: x11/libX11 fails if /usr/bin/cpp is clang
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-24 13:20 UTC by jakub_lach
Modified: 2012-07-29 19:56 UTC (History)
0 users

See Also:


Attachments
clang.diff (925 bytes, patch)
2012-05-01 06:47 UTC, Jan Beich
no flags Details | Diff
cpp.diff (1.06 KB, patch)
2012-06-01 13:55 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jakub_lach 2012-03-24 13:20:08 UTC
If WITH_CLANG_IS_CC= is set in src.conf, /usr/bin/cpp is clang, and configure fails:

checking for cpp... /usr/bin/cpp
checking if /usr/bin/cpp requires -undef... yes
checking if /usr/bin/cpp requires -traditional... configure: error: /usr/bin/cpp does not preserve whitespace with or without -traditional.  I don't know what to do.
===>  Script "configure" failed unexpectedly.
Please report the problem to x11@FreeBSD.org [maintainer] and attach the
"/usr/obj/usr/ports/x11/libX11/work/libX11-1.4.4/config.log" including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-03-24 13:20:18 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-x11

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Jan Beich freebsd_committer freebsd_triage 2012-05-01 06:47:26 UTC
Here's a template fix. Xserver likely needs similar patch.

  # if you already have lang/gcc installed
  $ echo RAWCPP=/usr/local/bin/cpp46 >>Makefile.local
  $ make install
  
Comment 3 Niclas Zeising 2012-05-27 16:28:13 UTC
A patch has been committed to the xorg development repository[1].  This
issue is being worked on and will hopefully be resolved soon.
Regards!
-- 
Niclas Zeising

[1]  https://trillian.chruetertee.ch/svn/ports/trunk
Comment 4 Koop Mast freebsd_committer freebsd_triage 2012-05-27 16:35:33 UTC
State Changed
From-To: open->analyzed
Comment 5 Jan Beich freebsd_committer freebsd_triage 2012-06-01 13:55:57 UTC
I reconsider, ucpp is buggy compared to clang-cpp. Here is an example of
broken en_US.UTF-8 locale: http://ompldr.org/vZTFvaQ/xterm.png

  # affects a few non-unicode locales, e.g. zh_TW.big5
  $ printf '\\xaa\\xab' | ucpp | sed '/^#/d; /^$/d'
  \xaaxab
  $ printf '\\xaa\\xab' | cpp46 | sed '/^#/d; /^$/d'
  \xaa\xab

  # affects locale.alias
  $ printf "#if 0\nfo'o\n#endif\nbar\n" | ucpp | sed '/^#/d; /^$/d'
  <stdin>: line 2: truncated token
  <stdin>: line 5: unterminated #if construction (depth 1)
  $ printf "#if 0\nfo'o\n#endif\nbar\n" | cpp46 | sed '/^#/d; /^$/d'
  <stdin>:2:3: warning: missing terminating ' character [enabled by default]
  bar

A quick diff(1) in nls/ directory showed only whitespace difference
between cpp46 and clang-cpp for me.

  # autoconf assumes -traditional is only for whitespace
  $ echo ftp://localhost | clang-cpp | sed '/^#/d; /^$/d'
  ftp:
  $ echo ftp://localhost | clang-cpp -traditional | sed '/^#/d; /^$/d'
  ftp://localhost
Comment 6 Jan Beich freebsd_committer freebsd_triage 2012-06-01 14:06:27 UTC
> +CONFIGURE_ENV+=	ac_cv_path="${CPP}" ac_cv_path_PS2PDF=""
                        ^^^^^^^^^^^^^^^^^^
Oops, this is supposed to be ac_cv_path_RAWCPP but no one cares
about respecting CPP, anyway.
Comment 7 Niclas Zeising 2012-06-02 09:44:16 UTC
It is noted.  I have however, not had time to work on it more last week.
 Hopefully things clear up in the week to come.
Comment 8 Niclas Zeising 2012-06-21 21:32:13 UTC
A new patch is in the xorg development repository[1]. Hopefully it will
work better. Please test it so we can resolve this issue.
Regards!
-- 
Niclas

[1] https://trillian.chruetertee.ch/svn/ports/trunk
Comment 9 Mark Linimon freebsd_committer freebsd_triage 2012-06-22 03:37:10 UTC
State Changed
From-To: analyzed->suspended

From misfiled PR ports/169310: 

Date: Fri, 22 Jun 2012 00:35:26 +0200 
Comment 10 dfilter service freebsd_committer freebsd_triage 2012-07-29 19:26:14 UTC
Author: zeising
Date: Sun Jul 29 18:26:00 2012
New Revision: 301687
URL: http://svn.freebsd.org/changeset/ports/301687

Log:
  Fix the build of xorg related ports when the base system is compiled with
  clang as system compiler and cpp is clang cpp (as opposed to GNU cpp).
  This is done by removing the configure test for cpp completely.  Using
  clang cpp will make some manual pages as well as some scripts get slightly
  wierd whitespace formatting.  However, it does not affect the function of
  the scripts or the instructions in the manual pages.
  
  PR:             ports/166373
  Submitted by:   Jakub Lach <jakub_lach@mailplus.pl> (PR)
  Patch by:       me (with ideas from PR and mailing list)
  Tested by:      Jakub Lach <jakub_lach@mailplus.pl>, me
  Approved by:    kwm (mentor)
  Obtained from:  xorg staging area

Modified:
  head/x11-drivers/xf86-video-sis/Makefile
  head/x11-servers/xorg-server/Makefile
  head/x11-toolkits/libXt/Makefile
  head/x11/libX11/Makefile
  head/x11/xinit/Makefile

Modified: head/x11-drivers/xf86-video-sis/Makefile
==============================================================================
--- head/x11-drivers/xf86-video-sis/Makefile	Sun Jul 29 17:32:50 2012	(r301686)
+++ head/x11-drivers/xf86-video-sis/Makefile	Sun Jul 29 18:26:00 2012	(r301687)
@@ -20,4 +20,8 @@ XORG_CAT=	driver
 USE_XORG=	xf86dgaproto xf86driproto xineramaproto videoproto xf86miscproto xextproto glproto
 MAN4=		sis.4x
 
+post-patch:
+	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
+		${WRKSRC}/configure
+	
 .include <bsd.port.mk>

Modified: head/x11-servers/xorg-server/Makefile
==============================================================================
--- head/x11-servers/xorg-server/Makefile	Sun Jul 29 17:32:50 2012	(r301686)
+++ head/x11-servers/xorg-server/Makefile	Sun Jul 29 18:26:00 2012	(r301687)
@@ -148,6 +148,10 @@ pre-everything::
 	@${ECHO_MSG} "xorg-server_UNSET=SUID in /etc/make.conf."
 .endif
 
+post-patch:
+	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
+		${WRKSRC}/configure
+
 .if defined(WITH_NEW_XORG)
 post-install:
 	@${MKDIR} ${PREFIX}/share/X11/xorg.conf.d

Modified: head/x11-toolkits/libXt/Makefile
==============================================================================
--- head/x11-toolkits/libXt/Makefile	Sun Jul 29 17:32:50 2012	(r301686)
+++ head/x11-toolkits/libXt/Makefile	Sun Jul 29 18:26:00 2012	(r301687)
@@ -285,4 +285,8 @@ MAN3=	MenuPopdown.3 \
 	XtWindowOfObject.3 \
 	XtWindowToWidget.3
 
+post-patch:
+	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
+		${WRKSRC}/configure
+
 .include <bsd.port.mk>

Modified: head/x11/libX11/Makefile
==============================================================================
--- head/x11/libX11/Makefile	Sun Jul 29 17:32:50 2012	(r301686)
+++ head/x11/libX11/Makefile	Sun Jul 29 18:26:00 2012	(r301687)
@@ -22,6 +22,7 @@ RUN_DEPENDS+=	${LOCALBASE}/libdata/pkgco
 XORG_CAT=	lib
 USE_XORG=	bigreqsproto xau xcmiscproto xdmcp xextproto xtrans \
 		kbproto:both inputproto xf86bigfontproto xproto:both
+
 CONFIGURE_ARGS+=	--datadir=${PREFIX}/lib \
 			--without-xmlto \
 			--disable-specs
@@ -30,6 +31,8 @@ CONFIGURE_ENV+=	ac_cv_path_PS2PDF=""
 .include "${.CURDIR}/manpages"
 
 post-patch:
+	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
+		${WRKSRC}/configure
 	@${REINPLACE_CMD} '/^install-data-am:/,/^$$/ \
 		s/install-specDATA//' ${WRKSRC}/nls/Makefile.in
 

Modified: head/x11/xinit/Makefile
==============================================================================
--- head/x11/xinit/Makefile	Sun Jul 29 17:32:50 2012	(r301686)
+++ head/x11/xinit/Makefile	Sun Jul 29 18:26:00 2012	(r301687)
@@ -24,6 +24,7 @@ PLIST_DIRS=	lib/X11/xinit
 MAN1=		startx.1 xinit.1
 
 post-patch:
+	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' ${WRKSRC}/configure
 	@${REINPLACE_CMD} -e 's|hexdump|/usr/bin/hexdump|' ${WRKSRC}/startx.cpp
 	@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/man/xinit.man
 
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 11 Niclas Zeising freebsd_committer freebsd_triage 2012-07-29 19:56:13 UTC
State Changed
From-To: suspended->closed

The fix in the xorg staging area was merged to the regular ports tree. 
Thanks for all help in resolving this!