Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 478810 - sys-devel/llvm: please add symlink clang-cpp for better amd64-fbsd clang profile support.
Summary: sys-devel/llvm: please add symlink clang-cpp for better amd64-fbsd clang prof...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: AMD64 FreeBSD
: Lowest enhancement (vote)
Assignee: Gentoo/BSD Team
URL: https://reviews.llvm.org/D25161
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-30 13:04 UTC by Yuta SATOH
Modified: 2016-10-02 21:52 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
sample patch for clang-3.3.ebuild (clang-3.3.patch,668 bytes, patch)
2013-07-30 13:05 UTC, Yuta SATOH
Details | Diff
drop warning sample patch for toolchain-funcs.eclass (478810-toolchain-funcs.eclass.patch,533 bytes, patch)
2013-07-30 13:08 UTC, Yuta SATOH
Details | Diff
sample patch for kde4-base.eclass (478810-kde4-base.patch,642 bytes, patch)
2013-07-30 13:09 UTC, Yuta SATOH
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuta SATOH 2013-07-30 13:04:03 UTC
clang profile is not used clang's C preprocessor yet.
I think better to use CPP of clang.

clang-cpp is required to build system of FreeBSD safely.
Please create a symbolic link.

FYI,
http://svnweb.freebsd.org/base?view=revision&revision=231079
https://wiki.freebsd.org/BuildingFreeBSDWithClang#Quickstart

NOTE,
When set CPP=clang-cpp to /etc/portage/make.conf, I found two problems at least.
Comment 1 Yuta SATOH 2013-07-30 13:05:19 UTC
Created attachment 354610 [details, diff]
sample patch for clang-3.3.ebuild
Comment 2 Yuta SATOH 2013-07-30 13:08:25 UTC
Created attachment 354612 [details, diff]
drop warning sample patch for toolchain-funcs.eclass

$ clang-cpp -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"
clang: warning: argument unused during compilation: '-E'
4 2 1
$ clang-cpp -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"
4 2 1

another way)
$ clang-cpp -E -P -Qunused-arguments - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"
4 2 1

FYI,
$ clang -E -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"
4 2 1
Comment 3 Yuta SATOH 2013-07-30 13:09:13 UTC
Created attachment 354614 [details, diff]
sample patch for kde4-base.eclass

Problem occurs in package that checks the version of GCC.
I think need to pass the version check in some way.

[[ $(tc-getCPP) != clang* ]] && \
In this example, target clang-cpp and "clang -E" both.
Comment 4 Alexis Ballier gentoo-dev 2013-08-12 15:09:13 UTC
(In reply to Yuta SATOH from comment #1)
> Created attachment 354610 [details, diff] [details, diff]
> sample patch for clang-3.3.ebuild

this we should better either update gcc-config, add a clang-config, or install a 'clang system wide compiler' package that would also install the cc/c++/others symlinks
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-16 16:36:51 UTC
Is this still relevant?
Comment 6 Yuta SATOH 2016-10-02 02:21:07 UTC
(In reply to Michał Górny from comment #5)
> Is this still relevant?
sys-freebsd/* packages that contains RPCGEN_CPP= does not support CPP="clang -E".
sys-freebsd/* packages using the preprocessor of clang requires clang-cpp to compile.

e.g.)
CPP="clang -E")
# CPP="clang -E" MAKEOPTS=-j1 ebuild freebsd-usbin-11.0.ebuild clean compile
===> rpc.lockd (all)
Warning: Object directory not changed from original /var/tmp/portage/sys-freebsd/freebsd-usbin-11.0/work/usr.sbin/rpc.lockd
RPCGEN_CPP=clang\ -E rpcgen -L -C -m -o nlm_prot_svc.c /usr/include/rpcsvc/nlm_prot.x
x86_64-gentoo-freebsd10.3-clang-3.8: warning: /usr/include/rpcsvc/nlm_prot.x: 'linker' input unused
x86_64-gentoo-freebsd10.3-clang-3.8: warning: argument unused during compilation: '-C'
x86_64-gentoo-freebsd10.3-clang-3.8: warning: argument unused during compilation: '-D RPC_SVC'
echo rpc.lockd: /usr/lib/libc.a /usr/lib/librpcsvc.a >> .depend
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.kern.o -MTkern.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c kern.c -o kern.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.nlm_prot_svc.o -MTnlm_prot_svc.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c nlm_prot_svc.c -o nlm_prot_svc.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.lockd.o -MTlockd.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c lockd.c -o lockd.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.lock_proc.o -MTlock_proc.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c lock_proc.c -o lock_proc.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.lockd_lock.o -MTlockd_lock.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c lockd_lock.c -o lockd_lock.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Qunused-arguments  -o rpc.lockd kern.o nlm_prot_svc.o lockd.o lock_proc.o lockd_lock.o   -lrpcsvc
lockd.o: In function `main':
lockd.c:(.text+0x4a7): undefined reference to `nlm_prog_4'
lockd.o: In function `complete_service':
lockd.c:(.text+0x1441): undefined reference to `nlm_prog_0'
lockd.c:(.text+0x1474): undefined reference to `nlm_prog_1'
lockd.c:(.text+0x14a7): undefined reference to `nlm_prog_3'
lockd.c:(.text+0x14da): undefined reference to `nlm_prog_4'
x86_64-gentoo-freebsd10.3-clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
*** [rpc.lockd] Error code 1

make[1]: stopped in /var/tmp/portage/sys-freebsd/freebsd-usbin-11.0/work/usr.sbin/rpc.lockd
1 error

CPP="clang-cpp")
# ln -s clang /usr/bin/clang-cpp
# CPP="clang-cpp" MAKEOPTS=-j1 ebuild freebsd-usbin-11.0.ebuild clean compile
===> rpc.lockd (all)
Warning: Object directory not changed from original /var/tmp/portage/sys-freebsd/freebsd-usbin-11.0/work/usr.sbin/rpc.lockd
RPCGEN_CPP=clang-cpp rpcgen -L -C -m -o nlm_prot_svc.c /usr/include/rpcsvc/nlm_prot.x
echo rpc.lockd: /usr/lib/libc.a /usr/lib/librpcsvc.a >> .depend
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.kern.o -MTkern.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c kern.c -o kern.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.nlm_prot_svc.o -MTnlm_prot_svc.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c nlm_prot_svc.c -o nlm_prot_svc.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.lockd.o -MTlockd.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c lockd.c -o lockd.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.lock_proc.o -MTlock_proc.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c lock_proc.c -o lock_proc.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc   -MD  -MF.depend.lockd_lock.o -MTlockd_lock.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  -c lockd_lock.c -o lockd_lock.o
clang -O2 -pipe -fno-strict-aliasing -I. -I/usr/include/rpcsvc -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Qunused-arguments  -o rpc.lockd kern.o nlm_prot_svc.o lockd.o lock_proc.o lockd_lock.o   -lrpcsvc
gzip -cn rpc.lockd.8 > rpc.lockd.8.gz


List of sources, including RPCGEN_CPP.)
# grep -r RPCGEN_CPP *
include/rpcsvc/Makefile:RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C
include/rpc/Makefile:RPCCOM=    RPCGEN_CPP=${CPP:Q} rpcgen -C
lib/librpcsvc/Makefile:RPCCOM=  RPCGEN_CPP=${CPP:Q} rpcgen -C
lib/libc/tests/rpc/Makefile:RPCGEN=                     RPCGEN_CPP=${CPP:Q} rpcgen -L -C
lib/libc/rpc/Makefile.inc:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C
lib/libc/yp/Makefile.inc:RPCGEN=        RPCGEN_CPP=${CPP:Q} rpcgen -C
lib/libypclnt/Makefile:RPCGEN=  RPCGEN_CPP=${CPP:Q} rpcgen -C
libexec/ypxfr/Makefile:RPCGEN=  RPCGEN_CPP=${CPP:Q} rpcgen -I -C
release/picobsd/tinyware/passwd/Makefile:RPCGEN=        RPCGEN_CPP=${CPP:Q} rpcgen -C
sys/modules/kgssapi/Makefile:   RPCGEN_CPP=${CPP:Q} rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h
sys/modules/kgssapi/Makefile:   RPCGEN_CPP=${CPP:Q} rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c
sys/modules/kgssapi/Makefile:   RPCGEN_CPP=${CPP:Q} rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c
sys/modules/kgssapi_krb5/Makefile:      RPCGEN_CPP=${CPP:Q} rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h
sys/conf/files: compile-with            "RPCGEN_CPP='${CPP}' rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h" \
sys/conf/files: compile-with            "RPCGEN_CPP='${CPP}' rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c" \
sys/conf/files: compile-with            "RPCGEN_CPP='${CPP}' rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c" \
usr.bin/rpcgen/rpc_main.c:      else if ((var = getenv("RPCGEN_CPP")) == NULL)
usr.bin/rpcgen/rpcgen.1:.Ev RPCGEN_CPP
usr.sbin/rpc.ypxfrd/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C
usr.sbin/yppush/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C
usr.sbin/amd/Makefile.inc:RPCCOM=               RPCGEN_CPP=${CPP:Q} rpcgen
usr.sbin/bootparamd/bootparamd/Makefile:        RPCGEN_CPP=${CPP:Q} rpcgen -C -m -o ${.TARGET} ${RPCSRC}
usr.sbin/bootparamd/bootparamd/Makefile:        RPCGEN_CPP=${CPP:Q} rpcgen -C -c -o ${.TARGET} ${RPCSRC}
usr.sbin/bootparamd/bootparamd/Makefile:        RPCGEN_CPP=${CPP:Q} rpcgen -C -h -o ${.TARGET} ${RPCSRC}
usr.sbin/bootparamd/callbootd/Makefile: RPCGEN_CPP=${CPP:Q} rpcgen -C -l -o ${.TARGET} ${RPCSRC}
usr.sbin/bootparamd/callbootd/Makefile: RPCGEN_CPP=${CPP:Q} rpcgen -C -c -o ${.TARGET} ${RPCSRC}
usr.sbin/bootparamd/callbootd/Makefile: RPCGEN_CPP=${CPP:Q} rpcgen -C -h -o ${.TARGET} ${RPCSRC}
usr.sbin/gssd/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C -M
usr.sbin/rpc.yppasswdd/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C
usr.sbin/ypserv/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C
usr.sbin/keyserv/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -C
usr.sbin/rpc.ypupdated/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -I -C
usr.sbin/rpc.lockd/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C
usr.sbin/rpc.statd/Makefile:RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-10-02 19:45:29 UTC
Lesson to learn here: opening a Gentoo bug will take 3.5yr to fix this. If you submit patch upstream, you'll get it approved in half a day ;-).

I'm going to test the updated ebuilds and commit them in a few minutes.

A side note though: you don't want to define CPP globally for all ebuilds. It breaks stuff ;-).
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-10-02 21:52:20 UTC
Now in 3.9.0+. Please test.


commit 00f67b1579de819d36bd728a1af6e1fa4fca9f4c
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: Sun Oct 2 23:32:01 2016
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: Sun Oct 2 23:51:49 2016

    sys-devel/llvm: Backport clang-cpp symlink, #478810

commit 580e344faafafd53dfe8a47e62ec8f11dad79fda
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: Sun Oct 2 23:30:45 2016
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: Sun Oct 2 23:51:48 2016

    sys-devel/clang: Wrap the new clang-cpp symlink, #478810