Le jeu. 4 mai 2023, 21:44, Peter Bergin <pe...@berginkonsult.se> a écrit :

>
> On 2023-05-04 19:13, Frederic Martinsons wrote:
>
>
>
> Le jeu. 4 mai 2023, 13:42, Peter Bergin <pe...@berginkonsult.se> a écrit :
>
>>
>> On 2023-05-04 12:03, Frederic Martinsons wrote:
>>
>>
>>
>> Le jeu. 4 mai 2023, 11:31, Frédéric Martinsons <
>> frederic.martins...@gmail.com> a écrit :
>>
>>>
>>>
>>> On Thu, 4 May 2023 at 11:00, Alexander Kanavin <alex.kana...@gmail.com>
>>> wrote:
>>>
>>>> On Thu, 4 May 2023 at 10:41, Peter Bergin <pe...@berginkonsult.se>
>>>> wrote:
>>>>
>>>> > At
>>>> >
>>>> https://github.com/pyca/cryptography/blob/f816b457494e010b655cd7fdcd30e3446f86a703/src/rust/build.rs#L46
>>>> > the path to python includes is defined by calling 'python3 -c "import
>>>> > sysconfig; print(sysconfig.get_path('include'))"' (but from inside
>>>> > rust). With print-debugging this seems to return the bad string
>>>> > '/usr/include/python3.11' which is then passed to cc::Build
>>>> >
>>>> > I executed this in recipe context:
>>>> >
>>>> > do_compile:prepend() {
>>>> >      which python3
>>>> >      python3 -c "import sysconfig;
>>>> print(sysconfig.get_path('include'))"
>>>> > }
>>>> >
>>>> > and then I got the correct return value:
>>>> >
>>>> > |
>>>> >
>>>> /work/yocto/poky/build/tmp/work/core2-64-poky-linux/python3-cryptography/40.0.2-r0/recipe-sysroot-native/usr/bin/python3-native/python3
>>>> > |
>>>> >
>>>> /work/yocto/poky/build/tmp/work/core2-64-poky-linux/python3-cryptography/40.0.2-r0/recipe-sysroot-native/usr/include/python3.11
>>>>
>>>> This is pointing to the native sysroot in a target build, so it is
>>>> most likely not actually correct. I believe 'inherit
>>>> python3targetconfig' may help, as it substitutes most places where
>>>> native python gets queried by components with target-specific values.
>>>>
>>>> Alex
>>>>
>>>
>>> Unless I'm mistaken , in the error message we can see that the compiler
>>> specified the sysroot correctly (recipe-sysroot and recipe-sysroot-native)
>>>
>>
>> recipe-sysroot and NOT recipe-sysroot-native
>>
>> '--sysroot' is specified correct but that is not automatically add search
>> paths to '-I' directive, if I'm not misreading this:
>> https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html . When you use
>> --sysroot with gcc you have to add = or $SYSROOT to your -I directive in
>> order to add it to search path for headers. With that information I guess
>> '-I =/usr/lib/python3.11' or '-I \$SYSROOT/usr/lib/python3.11' can work but
>> '-I /usr/lib/python3.11' will point to your host.
>>
>> /Peter
>>
> I'm confused by the gcc docs, from the same links you gave:
>
> --sysroot=dir
>        Use dir as the logical root directory for headers and libraries.
> For example, if the compiler normally searches for headers in /usr/include
> and libraries in /usr/lib, it instead searches dir/usr/include and
> dir/usr/lib.
>
> So I don't know what to think (I never see -I used with '=' or $SYSROOT).
> I'll try to know more about that for my curiosity
>
> An example to illustrate:
>
>   $ cat main.c
>   #include "my-include.h"
>
>   int main(void) {
>       return 0;
>   }
>   $ tree dir1
>   dir1
>   └── dir2
>       └── my-include.h
>
>   1 directory, 1 file
>   $ gcc main.c
>   main.c:1:10: fatal error: my-include.h: No such file or directory
>       1 | #include "my-include.h"
>         |          ^~~~~~~~~~~~~~
>   compilation terminated.
>   $ gcc -I dir1/dir2 main.c
>   $ gcc --sysroot=$PWD/dir1 -I dir2 main.c
>   main.c:1:10: fatal error: my-include.h: No such file or directory
>       1 | #include "my-include.h"
>         |          ^~~~~~~~~~~~~~
>   compilation terminated.
>   $ gcc --sysroot=$PWD/dir1 -I =/dir2 main.c
>   $ gcc --sysroot=$PWD/dir1 -I \$SYSROOT/dir2 main.c
>
> /Peter
>
Thanks Peter, that was exactly what I wanted to try.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#180899): 
https://lists.openembedded.org/g/openembedded-core/message/180899
Mute This Topic: https://lists.openembedded.org/mt/98667212/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to