<div dir="ltr">Hello guys,<div><br></div><div>I&#39;ve been facing problems with python and I need some help. My current branch is morty but I think this could affect others too.</div><div>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:<br></div><div><br></div><div><div>inet@ubuntu:~/workspace/upstream/router-ibd$ python setup.py build</div><div>running build<br></div><div>running build_py</div><div>package init file &#39;python-ibd/__init__.py&#39; not found (or not a regular file)</div><div>package init file &#39;python-ibd/__init__.py&#39; not found (or not a regular file)</div><div>running build_ext</div><div>building &#39;pyibd&#39; extension</div><div>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</div><div>In file included from /opt/iep/16.2/sysroots/x86_64-iepsdk-linux/usr/include/python2.7/Python.h:8:0,</div><div>                 from python-ibd/ibdmodule.c:11:</div><div>/opt/iep/16.2/sysroots/x86_64-iepsdk-linux/usr/include/python2.7/pyconfig.h:1193:0: warning: &quot;_POSIX_C_SOURCE&quot; redefined</div><div> #define _POSIX_C_SOURCE 200112L</div><div> </div><div>In file included from /opt/iep/16.2/sysroots/ppce500v2-iep-linux-gnuspe/usr/include/stdint.h:25:0,</div><div>                 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,</div><div>                 from ./include/ibd.h:12,</div><div>                 from python-ibd/ibdmodule.c:9:</div><div>/opt/iep/16.2/sysroots/ppce500v2-iep-linux-gnuspe/usr/include/features.h:225:0: note: this is the location of the previous definition</div><div> # define _POSIX_C_SOURCE 200809L</div><div> </div><div>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</div><div>/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: Relocations in generic ELF (EM: 20)</div><div>/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: Relocations in generic ELF (EM: 20)</div><div>/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: Relocations in generic ELF (EM: 20)</div><div>/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: Relocations in generic ELF (EM: 20)</div><div>/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: Relocations in generic ELF (EM: 20)</div><div>/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: Relocations in generic ELF (EM: 20)</div><div>/usr/bin/ld: build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: Relocations in generic ELF (EM: 20)</div><div>build/temp.linux-x86_64-2.7/python-ibd/ibdmodule.o: error adding symbols: File in wrong format</div><div>collect2: error: ld returned 1 exit status</div><div>error: command &#39;x86_64-iepsdk-linux-gcc&#39; failed with exit status 1</div></div><div><br></div><div>The resulting build tree from SDK (distutils/setuptools) and bitbake (distutils) is:</div><div>.<br></div><div><div>├── build<br>│   ├── lib.linux-x86_64-2.7<br>│   └── temp.linux-x86_64-2.7<br>│       └── python-ibd<br>│           └── ibdmodule.o</div></div><div><br></div><div><div>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.</div><div>I&#39;ve seen this been generated by bitbake using distutils in setup.py too but works on the board, I don&#39;t known why.</div><div>If I change from distutils to setuptools in setup.py and run bitbake the system looks correctly.</div></div><div><br></div><div>bitbake (setuptools)</div><div><div>├── deploy-ipks</div><div>│   └── ppce500v2</div><div>│       ├── python-ibd-dbg_git-r0.5_ppce500v2.ipk</div><div>│       ├── python-ibd-dev_git-r0.5_ppce500v2.ipk</div><div>│       └── python-ibd_git-r0.5_ppce500v2.ipk</div></div><div><br></div><div>To get that wrong result using the SDK was needed add as follow, otherwise the Python.h include error appears:</div><div><br></div><div>nativesdk-packagegroup-sdk-host.bbappend<br></div><div><br></div><div><div>+RDEPENDS_${PN} += &quot; \</div><div>+    nativesdk-gcc \</div><div>+    \</div><div>+    nativesdk-python-dev \<br></div><div>+    nativesdk-python-setuptools \</div><div>+&quot;<br></div></div><div><br></div><div>There seems to be missing some cross compile patch. Does anyone have any ideas?<br></div></div>