[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: sip-build using C compiler for .cpp files when not using pyqt-builder?
From:       Patrick Stinson <patrickkidd () gmail ! com>
Date:       2022-10-08 14:12:03
Message-ID: CADb17j0C-Zti28TXXRtQGmuxOWjkbVxkhcYVyMnbZBFSa5SGRQ () mail ! gmail ! com
[Download RAW message or body]

Ah roger that. I was stepping through the sipbuild's calls in setuptools
but assumed it wouldn't pull in env vars.

Luckily the lib source I am compiling in my extension is simple enough that
I could just replace the c++11/c++14 stuff with older counterparts so I am
all good. But interesting to know that clang defaults to an old spec and
that it can prevent extensions to build unless using some c++ specific
flags var like CPPFLAGS.

On Sat, Oct 8, 2022 at 6:09 AM Phil Thompson <phil@riverbankcomputing.com>
wrote:

> According to the setuptools docs setting the CPPFLAGS environment
> variable might work.
>
> Phil
>
> On 08/10/2022 14:49, Patrick Stinson wrote:
> > So then with:
> >
> > extra-compile-args = ["-std=c++11"]
> >
> > you get this for the .c files:
> >
> > error: invalid argument '-std=c++11' not allowed with 'C'
> >
> > On Sat, Oct 8, 2022 at 5:47 AM Patrick Stinson <patrickkidd@gmail.com>
> > wrote:
> >
> >> Yeah, ok. It compiles fine on ubuntu. I think this is actually a
> >> problem
> >> in the default c++ spec for clang 14.0.0 on macos 12.6, for example
> >> these
> >> warnings and errors:
> >>
> >> warning: scoped enumerations are a C++11 extension
> >> [-Wc++11-extensions]
> >> error: unknown type name 'constexpr'
> >>
> >> On Fri, Oct 7, 2022 at 12:25 AM Phil Thompson
> >> <phil@riverbankcomputing.com>
> >> wrote:
> >>
> >>> On 06/10/2022 19:25, Patrick Stinson wrote:
> >>> > I have a pure C++ sip extension and it looks like sip-build is using
> >>> > the C
> >>> > compiler for everything. My other extension that sues pyqt-builder
> >>> > seems to
> >>> > work. Is there a way to get sip to use the c++ compiler for cpp files
> >>> > while
> >>> > also correctly compiling sip's C files like sip_array.c etc?
> >>> >
> >>> > Using sip-6.7.1.
> >>> >
> >>> > Cheers,
> >>> > -Patrick
> >>>
> >>> By default (ie. when you are not using PyQt-builder) SIP will use
> >>> setuptools to do the build. It will call the correct compiler
> >>> depending
> >>> on the filename extension. Works fine for me.
> >>>
> >>> Phil
> >>>
> >>
>

[Attachment #3 (text/html)]

<div dir="ltr">Ah roger that. I was stepping through  the sipbuild&#39;s calls in \
setuptools but assumed it wouldn&#39;t pull in env vars.  <div><br></div><div>Luckily \
the lib source I am compiling in my extension is simple enough that I could just \
replace the c++11/c++14 stuff with older counterparts so I am all good. But \
interesting to know that clang defaults to an old spec and that it can prevent \
extensions to build unless using some c++ specific flags var like \
CPPFLAGS.<br></div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Sat, Oct 8, 2022 at 6:09 AM Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">According \
to the setuptools docs setting the CPPFLAGS environment <br> variable might work.<br>
<br>
Phil<br>
<br>
On 08/10/2022 14:49, Patrick Stinson wrote:<br>
&gt; So then with:<br>
&gt; <br>
&gt; extra-compile-args = [&quot;-std=c++11&quot;]<br>
&gt; <br>
&gt; you get this for the .c files:<br>
&gt; <br>
&gt; error: invalid argument &#39;-std=c++11&#39; not allowed with &#39;C&#39;<br>
&gt; <br>
&gt; On Sat, Oct 8, 2022 at 5:47 AM Patrick Stinson &lt;<a \
href="mailto:patrickkidd@gmail.com" target="_blank">patrickkidd@gmail.com</a>&gt;<br> \
&gt; wrote:<br> &gt; <br>
&gt;&gt; Yeah, ok. It compiles fine on ubuntu. I think this is actually a <br>
&gt;&gt; problem<br>
&gt;&gt; in the default c++ spec for clang 14.0.0 on macos 12.6, for example <br>
&gt;&gt; these<br>
&gt;&gt; warnings and errors:<br>
&gt;&gt; <br>
&gt;&gt; warning: scoped enumerations are a C++11 extension <br>
&gt;&gt; [-Wc++11-extensions]<br>
&gt;&gt; error: unknown type name &#39;constexpr&#39;<br>
&gt;&gt; <br>
&gt;&gt; On Fri, Oct 7, 2022 at 12:25 AM Phil Thompson <br>
&gt;&gt; &lt;<a href="mailto:phil@riverbankcomputing.com" \
target="_blank">phil@riverbankcomputing.com</a>&gt;<br> &gt;&gt; wrote:<br>
&gt;&gt; <br>
&gt;&gt;&gt; On 06/10/2022 19:25, Patrick Stinson wrote:<br>
&gt;&gt;&gt; &gt; I have a pure C++ sip extension and it looks like sip-build is \
using<br> &gt;&gt;&gt; &gt; the C<br>
&gt;&gt;&gt; &gt; compiler for everything. My other extension that sues \
pyqt-builder<br> &gt;&gt;&gt; &gt; seems to<br>
&gt;&gt;&gt; &gt; work. Is there a way to get sip to use the c++ compiler for cpp \
files<br> &gt;&gt;&gt; &gt; while<br>
&gt;&gt;&gt; &gt; also correctly compiling sip&#39;s C files like sip_array.c \
etc?<br> &gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Using sip-6.7.1.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Cheers,<br>
&gt;&gt;&gt; &gt; -Patrick<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; By default (ie. when you are not using PyQt-builder) SIP will use<br>
&gt;&gt;&gt; setuptools to do the build. It will call the correct compiler <br>
&gt;&gt;&gt; depending<br>
&gt;&gt;&gt; on the filename extension. Works fine for me.<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; Phil<br>
&gt;&gt;&gt; <br>
&gt;&gt; <br>
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic