gpsd-dev
[Top][All Lists]
Advanced

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

Re: [PATCH 2/3] SConstruct: Use target_python when constructing extensio


From: Ladislav Michl
Subject: Re: [PATCH 2/3] SConstruct: Use target_python when constructing extension name
Date: Thu, 6 Feb 2020 09:18:32 +0100

Hello Gary,

lets start over here...

On Mon, Feb 03, 2020 at 03:09:19PM -0800, Gary E. Miller wrote:
> Yo Ladislav!
> 
> This one confuses me.  You are concerned about cross-cmpiling, right?
> 
> > +        # get version part of python extension name
> > +        ext_python_ver = config.GetPythonValue('ext version string',
> > +                                               'import sys',
> > +                                               '"_".join(map(str, '
> > +                                               'sys.version_info))')
> > +
> 
> Well, config.GetPythonValue() uses the target_python, but it works
> by executing the target_python on the build host, not the target
> host.  If the build host is on Intel, and building for MIPS, then the
> target_python will not run on the build host.

As you said, you are not cross-compiling, so lets focus on native builds:
$ which python
/usr/bin/python
$ /usr/bin/python --version
Python 2.7.17
$ which python3
/usr/bin/python3
$ /usr/bin/python3 --version
Python 3.7.6
$ scons target_python=/usr/bin/python
[...]
Creating 'gpsd_config.h'
x86_64-linux-gnu-gcc -pthread -o crc24q-py_3_7_6_final_0.so -c 
-fno-strict-aliasing -Wdate-time 
-fdebug-prefix-map=/build/python2.7-x6KfBw/python2.7-2.7.17=. 
-fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fPIC -D_FORTIFY_SOURCE=2 -DNDEBUG -I/usr/include/python2.7 
crc24q.c

So SConstruct is building crc24q-py_3_7_6_final_0.so and looking for
python2.7 includes. Now with the patch I get:
[...]
Creating 'gpsd_config.h'
x86_64-linux-gnu-gcc -pthread -o crc24q-py_2_7_17_final_0.so -c 
-fno-strict-aliasing -Wdate-time 
-fdebug-prefix-map=/build/python2.7-x6KfBw/python2.7-2.7.17=. 
-fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fPIC -D_FORTIFY_SOURCE=2 -DNDEBUG -I/usr/include/python2.7 
crc24q.c

> So config.GetPythonValue() will fail.

It will not. That would mean config.GetPythonValue() is broken for
all other uses already present in SConstruct.

> Or maybe target_python is starting an emulation environment and running
> the target python in it?

How's that implemented is up to cross-build environment setup and completely
out of SConstruct scope.

> "target_python" is intended so you can built gpsd for one local python,
> say python3.7, while scons is running on another local python, say
> python2.7.

Yes. That is exactly what this patch makes right, see above.

> Or am I missing something?

If you do not like this particular implementation, I'm open to suggestions.

Best regards,
        ladis



reply via email to

[Prev in Thread] Current Thread [Next in Thread]