Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 14:42:01 GMT
From:      Vitaly Magerya <vmagerya@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/171575: [patch] sysutils/uhidd: make it work with clang (encoding-related)
Message-ID:  <201209121442.q8CEg12I060447@red.freebsd.org>
Resent-Message-ID: <201209121450.q8CEo2wD033221@freefall.freebsd.org>

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

>Number:         171575
>Category:       ports
>Synopsis:       [patch] sysutils/uhidd: make it work with clang (encoding-related)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 12 14:50:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Vitaly Magerya
>Release:        FreeBSD 9.1-RC1 amd64
>Organization:
>Environment:
>Description:
Currently building sysutils/uhidd does not work if you set
CC=clang in make.conf:

    usage_in_page.c:4602:11: error: illegal character encoding
    in string literal [-Werror,-Winvalid-source-encoding]
                            return("Horizontal Moir<E9>");
                                   ^
    usage_in_page.c:4604:11: error: illegal character encoding
    in string literal [-Werror,-Winvalid-source-encoding]
                            return("Vertical Moir<E9>");
                                   ^
    2 errors generated.

It appears that GCC defaults to UTF-8, while clang can only
handle ASCII, so combination of UTF-8 and -Werror causes errors.
>How-To-Repeat:

>Fix:
There are two ways of fixing this: one is to change non-ASCII
characters into escape sequences like this:

diff -ruN uhidd.orig/files/patch-uhidd-usage_in_page.awk uhidd/files/patch-uhidd-usage_in_page.awk
--- uhidd.orig/files/patch-uhidd-usage_in_page.awk      1970-01-01 03:00:00.000000000 +0300
+++ uhidd/files/patch-uhidd-usage_in_page.awk   2012-09-12 17:17:33.000000000 +0300
@@ -0,0 +1,10 @@
+--- uhidd/usage_in_page.awk.orig       2012-09-12 17:15:02.000000000 +0300
++++ uhidd/usage_in_page.awk    2012-09-12 17:16:54.000000000 +0300
+@@ -33,6 +33,7 @@
+       str = substr($0, index($0, $2), length)
+       gsub(/\\/, "\\\\", str)
+       gsub("\"", "\\\"", str)
++      gsub("Moir.*", "Moir\\xc3\\xa9", str);
+       printf("\t\t\treturn(\"%s\");\n", str);
+     }
+ }

Another (and I think this is a slightly better fix) is to simply
disable -Werror; see the attached patch.

Patch attached with submission follows:

diff -ruN uhidd.orig/Makefile uhidd/Makefile
--- uhidd.orig/Makefile	2012-09-12 16:42:14.000000000 +0300
+++ uhidd/Makefile	2012-09-12 17:30:06.000000000 +0300
@@ -34,6 +34,8 @@
 
 .include <bsd.port.pre.mk>
 
+MAKE_ENV+=	NO_WERROR=y
+
 .if defined(DEBUG_FLAGS)
 MAKE_ENV+=	DEBUG_FLAGS='${DEBUG_FLAGS}'
 .endif


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209121442.q8CEg12I060447>