Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ZIDONG_J_Intel
Employee
1,027 Views

python throw error when cross_build app using "source environment-setup-core2-32-poky-linux"

Hi, the pdf http://download.intel.com/support/edison/sb/edison_nag_331192003.pdf http://download.intel.com/support/edison/sb/edison_nag_331192003.pdf says we can cross build app using edison toolchain.

source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux

But when the app use python during its building, like nodejs, iotjs and so on, it always throw error when building.

Take nodejs as an example:

jzd@jzd32:~/Downloads/node-v4.0.0$ ./configure

Traceback (most recent call last):

File "./configure", line 7, in

import subprocess

ImportError: No module named subprocess

12 Replies
Matthias_H_Intel
Employee
121 Views

without checking the toolchain I'd suspect it doesn't support Python out of the box. Just check whether there is a /usr/lib/python2.7 or so contained in the toolchain.

 

Alternatives for instance:
  • compile on target
  • compile in a chroot environment to possibly accelerate the compilation - just "sudo mount edison-image-edison.ext4 /mnt -o loop && sudo chroot /mnt" in a Linux shell
Carlos_M_Intel
Employee
121 Views

Hi jzd,

Which BSP did you used to build the toolchain?

Are you compiling the code using the toolchain? Or are you compiling using your PC resources?

Did you check if you have the folder /usr/lib/python2.7?

Regards,

Charlie

ZIDONG_J_Intel
Employee
121 Views

Hi Charlie

1, I directly download the toolchain from http://downloadmirror.intel.com/25028/eng/edison-sdk-linux32-ww25.5-15.zip http://downloadmirror.intel.com/25028/eng/edison-sdk-linux32-ww18-15.zip

2, I compile the code after using `source environment-setup-core2-32-poky-linux`

3, yes, my host pc has the folder /usr/lib/python2.7

Thanks

Zidong

Sergio_A_Intel
Employee
121 Views

But, are you using Python from the PC or from the Yocto image? Enter into the Ubuntu terminal and type python. In the python prompt type import subprocess. Do you still see the same error?

Sergio

ZIDONG_J_Intel
Employee
121 Views

when after type "source /opt/poky-edison/1.6/environment-setup-core2-32-poky-linux", the python path will be the one in yocto image.

I can see the same problem in yocto image's python shell when import subprocess.

Can you reproduce the problem?

1, I directly download the toolchain from http://downloadmirror.intel.com/25028/eng/edison-sdk-linux32-ww25.5-15.zip http://downloadmirror.intel.com/25028/eng/edison-sdk-linux32-ww18-15.zip and install it

2,`source environment-setup-core2-32-poky-linux

3, enter python shell and "import subprocess"

Carlos_M_Intel
Employee
121 Views

Hi jzd,

Have you been able to successfully use python in with the toolchain?

Did you try with the latest version? Or do you want to use the ww18-15?

Regards,

Charlie

ZIDONG_J_Intel
Employee
121 Views

Hi Sergio and Charlie

I just tried the newest version http://downloadmirror.intel.com/25028/eng/edison-sdk-linux32-ww25.5-15.zip http://downloadmirror.intel.com/25028/eng/edison-sdk-linux32-ww25.5-15.zip

it CAN import subprocess now, but it CANNOT import filecmp.

I mainly use node-v4.0.0 configure file to test the toolchain

Thanks

Sergio_A_Intel
Employee
121 Views

Hi,

I found a workaround that lets me run import subprocess and import filecmp without any errors. I changed the file path of PYTHONHOME in /opt/poky-edison/1.7.2/environment-setup-core2-32-poky-linux.

cat /opt/poky-edison/1.7.2/environment-setup-core2-32-poky-linux

PYTHONHOME=/opt/poky-edison/1.7.2/sysroots/i686-pokysdk-linux/usr

Try with these changes and let me know your results.

Sergio

ZIDONG_J_Intel
Employee
121 Views

I am confused. the PYTHONHOME in /opt/poky-edison/1.7.2/environment-setup-core2-32-poky-linux is exactly what you write 

jzd@jzd32:/opt/poky-edison/1.7.2$ cat environment-setup-core2-32-poky-linux | grep PYTHON

export PYTHONHOME=/opt/poky-edison/1.7.2/sysroots/i686-pokysdk-linux/usr

So nothing need to modify.

Sergio_A_Intel
Employee
121 Views

Hi,

That was a mistake, the path I wanted to suggest was export PYTHONHOME=/opt/poky-edison/1.7.2/sysroots/core2-32-poky-linux/usr

Sergio

ZIDONG_J_Intel
Employee
121 Views

Reply