pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: pkgsrc/multimedia/libmatroska



From: Thomas Klausner <wiz%NetBSD.org@localhost>
Subject: Re: CVS commit: pkgsrc/multimedia/libmatroska
Date: Tue, 10 Feb 2015 14:58:57 +0100

>> > On Thu, Jan 22, 2015 at 12:57:27PM +0000, Masatake Daimon wrote:
>> >> Module Name:      pkgsrc
>> >> Committed By:     pho
>> >> Date:             Thu Jan 22 12:57:27 UTC 2015
>> >>
>> >> Modified Files:
>> >>   pkgsrc/multimedia/libmatroska: Makefile
>> >>
>> >> Log Message:
>> >> Add 'c' to USE_LANGUAGES
>> >>
>> >> Otherwise the configure script fails with:
>> >>   PKGSRC-WARNING: Something is trying to run the c compiler,
>> >>   PKGSRC-WARNING: but it is not added to USE_LANGUAGES in the package Makefile.
>> >
>> > This is not a failure, but just a warning. If the source code contains
>> > no c code, you should not add 'c' to USE_LANGUAGES; and since this
>> > builds on lots of platforms, I expect the it was ok before adding 'c'.
>>
>> Sorry for my late reply. Since removing 'c' from USE_LANGUAGES
>> actually results in a configuration failure on Darwin, I investigated
>> the problem further. This is an excerpt from config.log:
>>
>>   configure:7833: checking how to run the C preprocessor
>>   configure:7903: result: gcc -E -isystem /usr/include
>>   configure:7923: gcc -E -isystem /usr/include -isystem /usr/include -I/usr/pkg/include conftest.c
>>   PKGSRC-WARNING: Something is trying to run the c compiler,
>>   PKGSRC-WARNING: but it is not added to USE_LANGUAGES in the package Makefile.
>>   configure:7923: $? = 1
>>   configure:7953: error: in `/usr/pkgsrc/multimedia/libmatroska/work/libmatroska-1.4.2':
>>   configure:7955: error: C preprocessor "gcc -E -isystem /usr/include" fails sanity check
>>   See `config.log' for more details
>>
>> It turned out that ${CPP} was defined as "${CC} -E -isystem
>> /usr/include" on this platform (see mk/platform/Darwin.mk). Because of
>> this, ${CPP} always fails unless USE_LANGUAGES contains 'c'.
>>
>> So what should we do in this case?
>
> Thanks for taking another look at this. Since Darwin is the only
> platform where cpp is defined this way, you'll probably have to fix
> lots of packages. Is there some cpp wrapper installed on Darwin that
> we could use, to make it more similar to the other platforms in
> pkgsrc?

Darwin actually comes with /usr/bin/cpp but it's a weird shell script
that runs "/usr/bin/gcc -E" with arguments heavily modified for some
unknown reasons, e.g.

  % cpp -isystem /usr/include test.c

is translated to this, which is of course not what we want:

  % /usr/bin/gcc -E -traditional '-system' -x -c /usr/include -o test.c

The reason why we need "-isystem /usr/include" is, as described in
mk/platform/Darwin.mk, Darwin's native gcc is weirdly configured so
that /usr/local/include takes precedence over /usr/include.

So if ${WRKDIR}/.gcc/bin/cpp were the following shell script,
everything would work as expected. Note that "-isystem /usr/include"
is passed through ${CPPFLAGS} so there's no need to repeat it here:

  #!/bin/sh
  exec /usr/bin/gcc -E "$@"

I attached a patch to get the effect described above.
Could you review it?

Thanks,
_______________________________________________________
 - PHO -                         http://cielonegro.org/
OpenPGP public key: 1024D/1A86EF72
Fpr: 5F3E 5B5F 535C CE27 8254  4D1A 14E7 9CA7 1A86 EF72
Index: compiler/gcc.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler/gcc.mk,v
retrieving revision 1.155
diff -u -r1.155 gcc.mk
--- compiler/gcc.mk     4 Feb 2015 14:11:50 -0000       1.155
+++ compiler/gcc.mk     10 Feb 2015 19:54:26 -0000
@@ -786,6 +786,13 @@
 IMAKEOPTS+=    -DHasGcc2=YES -DHasGcc2ForCplusplus=YES
 .endif

+.if ${OPSYS} == "Darwin" && !empty(_USE_PKGSRC_GCC:M[nN][oO])
+# The native cpp on this platform is a weird shell script that chokes
+# on "-isystem" flag. See also ../../mk/platform/Darwin.mk
+_GCC_CPP_CMD=          ${CCPATH} -E
+_DEF_VARS.gcc+=        _GCC_CPP_CMD
+.endif
+
 .if ${OPSYS} == "Darwin" || ${OPSYS} == "Linux" || ${OPSYS} == "SunOS"
 _COMPILER_ABI_FLAG.32=  -m32
 _COMPILER_ABI_FLAG.64=  -m64
@@ -845,7 +852,13 @@
 override-tools: ${_GCC_${_var_}}
 ${_GCC_${_var_}}:
        ${RUN}${MKDIR} ${.TARGET:H}
-.    if !empty(COMPILER_USE_SYMLINKS:M[Yy][Ee][Ss])
+.    if defined(_GCC_${_var_}_CMD)
+       ${RUN}                                  \
+       (${ECHO} '#!${TOOLS_SHELL}';                                    \
+        ${ECHO} 'exec ${_GCC_${_var_}_CMD} "$$@"';                     \
+       ) > ${.TARGET}
+       ${RUN}${CHMOD} +x ${.TARGET}
+.    elif !empty(COMPILER_USE_SYMLINKS:M[Yy][Ee][Ss])
        ${RUN}${RM} -f ${.TARGET}
        ${RUN}${LN} -s ${_GCCBINDIR}/${.TARGET:T} ${.TARGET}
 .    else
Index: platform/Darwin.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/platform/Darwin.mk,v
retrieving revision 1.66
diff -u -r1.66 Darwin.mk
--- platform/Darwin.mk  3 Jan 2015 21:30:52 -0000       1.66
+++ platform/Darwin.mk  10 Feb 2015 19:54:26 -0000
@@ -26,9 +26,6 @@
 X11_TYPE?=     native
 .endif

-.if !defined(CPP) || ${CPP} == "cpp"
-CPP=           ${CC} -E ${CPP_PRECOMP_FLAGS}
-.endif
 .if empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
 ECHO_N?=       /bin/echo -n
 .else

Attachment: pgpIqivnkMg3M.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index