[OE-core] Building python modules using the SDK emit errors

Gerson Fernando Budke nandojve at gmail.com
Thu Sep 28 12:28:31 UTC 2017


Hello guys,

I've been facing problems with python and I need some help. My current
branch is morty but I think this could affect others too.
At firstly, it works perfecly and run OK when using bitbake (even using
with distutils in setup.py - see below) but when tring build using SDK I
get this:

inet at ubuntu:~/workspace/upstream/router-ibd$ python setup.py build
running build
running build_py
package init file 'python-ibd/__init__.py' not found (or not a regular file)
package init file 'python-ibd/__init__.py' not found (or not a regular file)
running build_ext
building 'pyibd' extension
powerpc-iep-linux-gnuspe-gcc -m32 -mcpu=8548 -mabi=spe -mspe
-mfloat-gprs=double
--sysroot=/opt/iep/16.2/sysroots/ppce500v2-iep-linux-gnuspe -DNDEBUG -g -O3
-Wall -Wstrict-prototypes -O -fno-omit-frame-pointer -g
-feliminate-unused-debug-types -pipe -fPIC -DMAJOR_VERSION=1
-DMINOR_VERSION=0 -I./include
-I/opt/iep/16.2/sysroots/x86_64-iepsdk-linux/usr/include/python2.7 -c
python-ibd/ibdmodule.c -o build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o
In file included from
/opt/iep/16.2/sysroots/x86_64-iepsdk-linux/usr/include/python2.7/Python.h:8:0,
                 from python-ibd/ibdmodule.c:11:
/opt/iep/16.2/sysroots/x86_64-iepsdk-linux/usr/include/python2.7/pyconfig.h:1193:0:
warning: "_POSIX_C_SOURCE" redefined
 #define _POSIX_C_SOURCE 200112L

In file included from
/opt/iep/16.2/sysroots/ppce500v2-iep-linux-gnuspe/usr/include/stdint.h:25:0,
                 from
/opt/iep/16.2/sysroots/x86_64-iepsdk-linux/usr/lib/powerpc-iep-linux/gcc/powerpc-iep-linux/6.2.0/include/stdint.h:9,
                 from ./include/ibd.h:12,
                 from python-ibd/ibdmodule.c:9:
/opt/iep/16.2/sysroots/ppce500v2-iep-linux-gnuspe/usr/include/features.h:225:0:
note: this is the location of the previous definition
 # define _POSIX_C_SOURCE 200809L

x86_64-iepsdk-linux-gcc -shared -Wl,-O1 -Wl,-O1 -Wl,--hash-style=gnu
-Wl,--as-needed -O -fno-omit-frame-pointer -g
-feliminate-unused-debug-types -pipe
build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o
-L/opt/iep/16.2/sysroots/x86_64-iepsdk-linux/usr/lib -lrouter-ibd
-lpython2.7 -o build/lib.linux-x86_64-2.7/pyibd.so
/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o:
Relocations in generic ELF (EM: 20)
/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o:
Relocations in generic ELF (EM: 20)
/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o:
Relocations in generic ELF (EM: 20)
/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o:
Relocations in generic ELF (EM: 20)
/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o:
Relocations in generic ELF (EM: 20)
/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o:
Relocations in generic ELF (EM: 20)
/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o:
Relocations in generic ELF (EM: 20)
build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: error adding symbols:
File in wrong format
collect2: error: ld returned 1 exit status
error: command 'x86_64-iepsdk-linux-gcc' failed with exit status 1

The resulting build tree from SDK (distutils/setuptools) and bitbake
(distutils) is:
.
├── build
│   ├── lib.linux-x86_64-2.7
│   └── temp.linux-x86_64-2.7
│       └── python-ibd
│           └── ibdmodule.o

I can see a build problem here since the platform is ppc. If I change from
distutils to setuptools in setup.py I get the same.
I've seen this been generated by bitbake using distutils in setup.py too
but works on the board, I don't known why.
If I change from distutils to setuptools in setup.py and run bitbake the
system looks correctly.

bitbake (setuptools)
├── deploy-ipks
│   └── ppce500v2
│       ├── python-ibd-dbg_git-r0.5_ppce500v2.ipk
│       ├── python-ibd-dev_git-r0.5_ppce500v2.ipk
│       └── python-ibd_git-r0.5_ppce500v2.ipk

To get that wrong result using the SDK was needed add as follow, otherwise
the Python.h include error appears:

nativesdk-packagegroup-sdk-host.bbappend

+RDEPENDS_${PN} += " \
+    nativesdk-gcc \
+    \
+    nativesdk-python-dev \
+    nativesdk-python-setuptools \
+"

There seems to be missing some cross compile patch. Does anyone have any
ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20170928/53505ed2/attachment-0002.html>


More information about the Openembedded-core mailing list