Ok, so I think I found the solution to my problem.

In distutils3.bbclass, last line, LDSHARED is set to "${CCLD}
-shared". That environment variable is not set after sourcing the
env-setup script from my SDK.

My workaround is to check for some environment vars that is set and
manually set it in my setup.py since my module will only be used on
this platform and on developer computers anyway. It feels like the
correct thing to do would be to set LDSHARED when sourcing the SDK
setup script.

BR
/Einar

On Mon, May 4, 2020 at 3:12 PM Einar Vading via lists.yoctoproject.org
<yocto-ml=vading...@lists.yoctoproject.org> wrote:
>
> Hello!
>
> I've been trying to build a python package which has a component
> written in c that is used through cython.
>
> But when I try to build in the SDK I first got:
>
> #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc 
> config?)."
>
> I figured it had to do with
> "-I/home/einar/tmp/sdk/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/lib/python3.7/site-packages/numpy/core/include"
> since that points to my native sysroot instead of the target sysroot.
>
> So I added:
>
> numpy_incdir = numpy.get_include()
> python_incdir = '.' # Just some harmeless directory
> try:
>     native = os.environ['OECORE_NATIVE_SYSROOT']
>     target = os.environ['OECORE_TARGET_SYSROOT']
> except KeyError:
>     pass
> else:
>     rel_path = Path(numpy_incdir).relative_to(native)
>     numpy_incdir = target / rel_path
>     python_incdir = target + '/usr/include/python3.7m/'
>
> to my setup.py and got passed the first compiler error.
>
> So now my extension module is built ok but after that there is a step
> that fails:
>
> creating build/lib.linux-x86_64-3.7
> x86_64-pokysdk-linux-gcc -shared -Wl,-O1 -L -Wl,-O1 -Wl,-O1
> -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong
> -Wl,-z,relro,-z,now -O2 -pipe -g -feliminate-unused-debug-types
> build/temp.linux-x86_64-3.7/myext.o
> build/temp.linux-x86_64-3.7/extlib.o
> build/temp.linux-x86_64-3.7/myextmodule.o
> -L/home/einar/tmp/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/lib
> -lpython3.7m -o
> build/lib.linux-x86_64-3.7/bbfit.cpython-37m-x86_64-linux-gnu.so -lm
> unable to execute 'x86_64-pokysdk-linux-gcc': No such file or directory
> error: command 'x86_64-pokysdk-linux-gcc' failed with exit status 1
>
> And I can't get passed this error and I think it's weird that it's
> trying to use x86_64-pokysdk-linux-gcc since my extension module is
> built with
>
> CC=arm-poky-linux-gnueabi-gcc  -mthumb -mfpu=neon-vfpv4
> -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong
> -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security
> --sysroot=/home/einar/tmp/poky/3.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi
>
> Should building a cython extension in the SDK work? Any ideas why ming
> won't compile. Or why it's trying to use a compiler for host instead
> of target in the end?
>
> Best regards,
> Einar
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#49342): https://lists.yoctoproject.org/g/yocto/message/49342
Mute This Topic: https://lists.yoctoproject.org/mt/73974417/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/yocto/leave/6691583/737036229/xyzzy  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to