Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    在D1 TinaLinux SDK中编译Python报错

    D1系列-RISC-V
    3
    15
    784
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cvwithd1 LV 4 last edited by

      我尝试在TinaLinux SDK v1.0上编译Python 2.7 & 3.5:

      make menuconfig
      # Language -> Python -> python (这会导致python-ctypes强制开启)
      

      然后编译时,在编译到python-ctypes的时候报错:

        File "/tmp/tmpfsbMt5/pip-9.0.3-py2.py3-none-any.whl/pip/__init__.py", line 45, in <module>
        File "/tmp/tmpfsbMt5/pip-9.0.3-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in <module>
        File "/tmp/tmpfsbMt5/pip-9.0.3-py2.py3-none-any.whl/pip/download.py", line 36, in <module>
        File "/tmp/tmpfsbMt5/pip-9.0.3-py2.py3-none-any.whl/pip/utils/glibc.py", line 4, in <module>
        File "/home/d1/tinalinux-sdk/tina-d1-open-v1.0/out/d1-nezha/compile_dir/target/host/Python-2.7.15/Lib/ctypes/__init__.py", line 7, in <module>
          from _ctypes import Union, Structure, Array
      ImportError: No module named _ctypes
      make[4]: *** [install] Error 1
      

      请问有解决方案吗?或者我应该根据文档刷debian,这样用python会更方便一点?

      W 2 Replies Last reply Reply Quote Share 0
      • W
        whycan晕哥 LV 9 @cvwithd1 last edited by whycan

        @cvwithd1
        勾选python3.5 可以编译成功!

        C 1 Reply Last reply Reply Quote Share 0
        • W
          whycan晕哥 LV 9 @cvwithd1 last edited by

          @cvwithd1
          python2.7确实不能编译成功:

          rm -f /opt/D1/tina_d1_open/out/host/share/man/man1/python.1
          (cd /opt/D1/tina_d1_open/out/host/share/man/man1; ln -s python2.1 python.1)
          if test "xupgrade" != "xno"  ; then \
                  case upgrade in \
                          upgrade) ensurepip="--upgrade" ;; \
                          install|*) ensurepip="" ;; \
                  esac; \
                   ./python -E -m ensurepip \
                          $ensurepip --root=/ ; \
          fi
          Traceback (most recent call last):
            File "/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15/Lib/runpy.py", line 174, in _run_module_as_main
              "__main__", fname, loader, pkg_name)
            File "/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15/Lib/runpy.py", line 72, in _run_code
              exec code in run_globals
            File "/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15/Lib/ensurepip/__main__.py", line 5, in <module>
              sys.exit(ensurepip._main())
            File "/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15/Lib/ensurepip/__init__.py", line 219, in _main
              default_pip=args.default_pip,
            File "/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15/Lib/ensurepip/__init__.py", line 123, in _bootstrap
              return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
            File "/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15/Lib/ensurepip/__init__.py", line 31, in _run_pip
              import pip
            File "/tmp/tmpupgO4J/pip-9.0.3-py2.py3-none-any.whl/pip/__init__.py", line 45, in <module>
            File "/tmp/tmpupgO4J/pip-9.0.3-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in <module>
            File "/tmp/tmpupgO4J/pip-9.0.3-py2.py3-none-any.whl/pip/download.py", line 36, in <module>
            File "/tmp/tmpupgO4J/pip-9.0.3-py2.py3-none-any.whl/pip/utils/glibc.py", line 4, in <module>
            File "/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15/Lib/ctypes/__init__.py", line 7, in <module>
              from _ctypes import Union, Structure, Array
          ImportError: No module named _ctypes
          Makefile:937: recipe for target 'install' failed
          make[4]: *** [install] Error 1
          make[4]: Leaving directory '/opt/D1/tina_d1_open/out/d1-hdmionly/compile_dir/target/host/Python-2.7.15'
          Makefile:246: recipe for target '/opt/D1/tina_d1_open/out/d1-hdmionly/staging_dir/target/host/stamp/.python_installed' failed
          make[3]: *** [/opt/D1/tina_d1_open/out/d1-hdmionly/staging_dir/target/host/stamp/.python_installed] Error 2
          make[3]: Leaving directory '/opt/D1/tina_d1_open/package/lang/python'
          package/Makefile:192: recipe for target 'package/lang/python/host/compile' failed
          make[2]: *** [package/lang/python/host/compile] Error 2
          make[2]: Leaving directory '/opt/D1/tina_d1_open'
          package/Makefile:189: recipe for target '/opt/D1/tina_d1_open/out/d1-hdmionly/staging_dir/target/stamp/.package_compile' failed
          make[1]: *** [/opt/D1/tina_d1_open/out/d1-hdmionly/staging_dir/target/stamp/.package_compile] Error 2
          make[1]: Leaving directory '/opt/D1/tina_d1_open'
          /opt/D1/tina_d1_open/build/toplevel.mk:304: recipe for target 'world' failed
          make: *** [world] Error 2
          [2]+  Done                    $T/tools/build/buildserver --path $T
          
          #### make failed to build some targets (02:22 (mm:ss)) ####
          
          whycan@ubuntu:/opt/D1/tina_d1_open$
          
          
          W 1 Reply Last reply Reply Quote Share 0
          • W
            whycan晕哥 LV 9 @whycan last edited by

            @whycan

            b993c0da-2b9e-4a0f-b7ff-4140aa176cee-image.png

            不过别急,仍然有办法曲线救国:

            https://bbs.aw-ol.com/topic/171/极简操作-使用builroot-2021一键编译生成d1-nezha-系统镜像

            在这个 buildroot 里面勾选 BR2_PACKAGE_PYTHON=y

            然后 make 一下, 把 output/target/ 里面关于 python2.7 的文件都复制到 target/allwinner/d1-nezha/base-files/ 对应目录即可!

            C 1 Reply Last reply Reply Quote Share 0
            • C
              cvwithd1 LV 4 @whycan last edited by cvwithd1

              @whycan

              谢谢你的回答!

              其实我是有需求要在D1上用python调用opencv。如果编译python同时能够编译到numpy+pyyaml的话会方便很多。我看menuconfig里自带的python3.5就没有numpy和pyyaml,所以就没有尝试编译python3.5。

              不过非常感谢你的尝试!我现在想根据你提供的buildroot,试试看有没有办法可以编译到python3.6+numpy+pyyaml。

              1 Reply Last reply Reply Quote Share 0
              • C
                cvwithd1 LV 4 @whycan last edited by

                @whycan

                勾选python3之后编译通过,但是pack的时候报如下错误:

                D1@63d132a0f2eb:~/tinalinux-sdk/tina-d1-open-v1.0$ pack
                --==========--
                PACK_CHIP         sun20iw1p1
                PACK_PLATFORM     tina
                PACK_BOARD        d1-nezha
                PACK_KERN
                PACK_DEBUG        uart0
                PACK_SIG          none
                PACK_SECURE       none
                PACK_MODE         normal
                PACK_FUNC         android
                PACK_PROGRAMMER   none
                PACK_TAR_IMAGE    none
                PACK_TOPDIR       /home/D1/tinalinux-sdk/tina-d1-open-v1.0
                --==========--
                No kernel param, parse it from d1
                copying tools file
                copying configs file
                storage_type value is 5
                rm /home/D1/tinalinux-sdk/tina-d1-open-v1.0/out/d1-nezha/image/sys_partition_nor.fex
                rm /home/D1/tinalinux-sdk/tina-d1-open-v1.0/out/d1-nezha/image/image_nor.cfg
                copying boot resource
                
                LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
                copying boot file
                make user resource for : /home/D1/tinalinux-sdk/tina-d1-open-v1.0/out/d1-nezha/image/sys_partition.fex
                handle partition user-res
                no user resource partitions
                APP_PART_DOWNLOAD_FILE = /home/D1/tinalinux-sdk/tina-d1-open-v1.0/out/d1-nezha/image/app.fex
                Need size of filesystem
                no data resource partitions
                don't build dtbo ...
                update_chip
                pack boot package
                GetPrivateProfileSection read to end
                content_count=3
                LICHEE_REDUNDANT_ENV_SIZE config in BoardConfig.mk
                --mkenvimage create redundant env data!--
                ---redundant env data size 0x20000---
                packing for tina linux
                normal
                ERROR: dl file rootfs.fex size too large
                ERROR: filename = rootfs.fex
                ERROR: dl_file_size = 79104 sector
                ERROR: part_size = 40824 sector
                ERROR: update mbr file fail
                ERROR: update_mbr failed
                D1@63d132a0f2eb:~/tinalinux-sdk/tina-d1-open-v1.0$
                
                C 1 Reply Last reply Reply Quote Share 0
                • C
                  cvwithd1 LV 4 @cvwithd1 last edited by

                  @cvwithd1 我把$sdk/tina-d1-open/device/config/chips/d1/configs/nezha/sys_partition.fex里面rootfs的大小翻倍,pack就可以了

                  C 1 Reply Last reply Reply Quote Share 0
                  • C
                    cvwithd1 LV 4 @cvwithd1 last edited by

                    @cvwithd1 给大伙提个醒,不要直接把改了rootfs的固件直接刷到板子上,要不然会报错,而且再尝试刷默认固件也会失败....

                    W 1 Reply Last reply Reply Quote Share 0
                    • W
                      whycan晕哥 LV 9 @cvwithd1 last edited by

                      @cvwithd1
                      烧本站的出厂固件也会出错吗? 请问串口错误提示信息是什么?

                      C 1 Reply Last reply Reply Quote Share 0
                      • C
                        cvwithd1 LV 4 @whycan last edited by

                        @whycan 串口错误提示信息(见最后几行)如下:

                        phoenixsuit_mac_v1.0.0 sudo ./phoenixsuit ../D1哪吒HDMI测试固件20210804( 开机HDMI就有小企鹅启动logo).img
                        *************Allwinnertech************
                        AW MacOS Burn firmware software V1.0.0
                        *************Allwinnertech************
                        -----LoadPluginCenter-------
                        library file path: /Users/fengyuantao/Downloads/phoenixsuit_mac_v1.0.0/plgvector.dll
                        library file path: /Users/fengyuantao/Downloads/phoenixsuit_mac_v1.0.0/LiveProc.Plg
                        -----SetLiveProc-------
                        library file path: /Users/fengyuantao/Downloads/phoenixsuit_mac_v1.0.0/plgvector.dll
                        library file path: /Users/fengyuantao/Downloads/phoenixsuit_mac_v1.0.0/luaeFex.dll
                        -----OnImage-------
                        DeviceThreadEntryForMac called
                        Register./luaBase.dll l_RegAllFun Sucess!
                        Register./luaeFex.dll l_RegAllFun Sucess!
                        Register./luadec.dll l_RegAllFun Sucess!
                        copy luatool from local
                        ----enter sem_wait-------
                        ./AllWinnerDevice.cpp Fex_Open 604
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        Begin Burn the image!
                        progress 0%Register./luaBase.dll l_RegAllFun Sucess!
                        Register./luaeFex.dll l_RegAllFun Sucess!
                        Register./luadec.dll l_RegAllFun Sucess!
                        copy luatool from local
                        ./AllWinnerDevice.cpp Fex_Open 604
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        ./AllWinnerDevice.cpp Fex_Open 604
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        --------------Init Called------------------
                        workDir	/Users/fengyuantao/Downloads/phoenixsuit_mac_v1.0.0
                        ImgLenHigh	0
                        ImgLenLow	29854720
                        Mode	8
                        hWnd	0
                        imgFilePath	../D1哪吒HDMI测试固件20210804(开机HDMI就有小企鹅启动logo).img
                        [TL_MSG]:Mode = 8, ImgLenHigh=0, ImgLenLow = 1c78c00, imgFilePath = ../D1哪吒HDMI测试固件20210804(开机HDMI就有小企鹅启动logo).img
                        
                        IMAGEWTY
                        ItemTableSize = 1048576
                        [TL_MSG]:Tools Open Img
                        
                        ---fun end---
                        --------------entry-fel2fes Called-----------
                        felDevName	01130000
                        [TL_MSG]:Hi, I'm fel, dev=01130000
                        
                        ./AllWinnerDevice.cpp Fex_Open 604
                        FEL RecordDev: 01130000
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        [TL_MSG]:To down and Run fes1-1
                        
                        [TL_MSG]:fes1 down addr = 0x28000, retAddr =0x28340
                        
                        [TL_MSG]:To clear fes aide log
                        
                        [TL_FEX]:fel UP addr=0x28340, len=136
                        
                        [TL_MSG]:SYS_PARA_LOG read = 0x4d415244
                        
                        [TL_MSG]:dram paras[0]: 0x318
                        
                        [TL_MSG]:dram paras[1]: 0x3
                        
                        [TL_MSG]:dram paras[2]: 0x7b7bfb
                        
                        [TL_MSG]:dram paras[3]: 0x1
                        
                        [TL_MSG]:dram paras[4]: 0x10f210f2
                        
                        [TL_MSG]:dram paras[5]: 0x4001000
                        
                        [TL_MSG]:dram paras[6]: 0x1c70
                        
                        [TL_MSG]:dram paras[7]: 0x42
                        
                        [TL_MSG]:dram paras[8]: 0x18
                        
                        [TL_MSG]:dram paras[9]: 0x0
                        
                        [TL_MSG]:dram paras[10]: 0x4a2195
                        
                        [TL_MSG]:dram paras[11]: 0x2423190
                        
                        [TL_MSG]:dram paras[12]: 0x8b061
                        
                        [TL_MSG]:dram paras[13]: 0xb4787896
                        
                        [TL_MSG]:dram paras[14]: 0x0
                        
                        [TL_MSG]:dram paras[15]: 0x48484848
                        
                        [TL_MSG]:dram paras[16]: 0x48
                        
                        [TL_MSG]:dram paras[17]: 0x1620121e
                        
                        [TL_MSG]:dram paras[18]: 0x0
                        
                        [TL_MSG]:dram paras[19]: 0x0
                        
                        [TL_MSG]:dram paras[20]: 0x0
                        
                        [TL_MSG]:dram paras[21]: 0x870000
                        
                        [TL_MSG]:dram paras[22]: 0x24
                        
                        [TL_MSG]:dram paras[23]: 0x34056103
                        
                        [TL_MSG]:dram paras[24]: 0x0
                        
                        [TL_MSG]:dram paras[25]: 0x0
                        
                        [TL_MSG]:dram paras[26]: 0x0
                        
                        [TL_MSG]:dram paras[27]: 0x0
                        
                        [TL_MSG]:dram paras[28]: 0x0
                        
                        [TL_MSG]:dram paras[29]: 0x0
                        
                        [TL_MSG]:dram paras[30]: 0x0
                        
                        [TL_MSG]:dram paras[31]: 0x0
                        
                        [TL_MSG]:To down and Run uboot
                        
                        [TL_MSG]:u-boot down addr = 0x42000000
                        
                        [TL_MSG]:workmode = 0x10
                        
                        [TL_MSG]:dtb down addr = 0x42200000
                        
                        [TL_MSG]:sysconfig down addr = 0x42300000
                        
                        ---fun end---
                        Fel Thread Finished!
                        ./AllWinnerDevice.cpp Fex_Open 604
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        FES find FEL RecordDev: 01130000
                        ./AllWinnerDevice.cpp Fex_Open 604
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        ./AllWinnerDevice.cpp Fex_Open 604
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        --------------entry fes_thread Called---------
                        portId	0
                        fesDevName	01130000
                        hubId	0
                        DeviceId	1
                        [TL_MSG]:enter FES--01130000
                        
                        ./AllWinnerDevice.cpp Fex_Open 604
                        Found allwinner usb device (vendor 7994, product 61416), location id 01130000
                        Found 1 devices
                        [TL_MSG]:set erase flag 0
                        
                        [TL_MSG]:Verify: media crc = 0
                        
                        progress 3%[TL_MSG]:save item to mem :(12345678,1234567890___MBR) realLen(65536)
                        
                        ./buffer.cpp, pBuffer = 0x7fa160008004, nLen = 16380, crc32 = 1283179231[TL_MSG]:name = boot-resource, keydata = 0
                        
                        [TL_MSG]:name = env, keydata = 0
                        
                        [TL_MSG]:name = env-redund, keydata = 0
                        
                        [TL_MSG]:name = boot, keydata = 0
                        
                        [TL_MSG]:name = rootfs, keydata = 0
                        
                        [TL_MSG]:name = dsp0, keydata = 0
                        
                        [TL_MSG]:name = recovery, keydata = 0
                        
                        [TL_MSG]:name = UDISK, keydata = 0
                        
                        [TL_MSG]:name = , keydata = 0
                        
                        Fex_transmit_receive ./AllWinnerDevice.cpp, 782 status stage status Error 		   CSWStatus=fd(0) Magic=53555741(53555741)
                        Fex_transmit_receive ./AllWinnerDevice.cpp, 782 status stage status Error 		   CSWStatus=fd(0) Magic=53555741(53555741)
                        Fex_transmit_receive ./AllWinnerDevice.cpp, 782 status stage status Error 		   CSWStatus=fd(0) Magic=53555741(53555741)
                        <TL_FEX>Err./usbtool.lua_1536>:Fail to send fex cmd verify status
                        
                        <TL_ERR>:./usbtool.lua_3030>:verify status error
                        
                        <TL_ERR>:./usbtool.lua_3326>:Verify status error
                        
                        progress 4%<TL_ERR>:./usbtool.lua_3994>:down mbr error
                        
                        L296, Exception, returned value of Tools.entry_fes_thread is error.
                        
                        Error!!!: returned value of Tools.entry_fes_thread is error
                        ./DeviceMessage/ASuitDeviceMessage.cpp 128 failed
                        ----exit-------
                        
                        W 1 Reply Last reply Reply Quote Share 0
                        • W
                          whycan晕哥 LV 9 @cvwithd1 last edited by

                          @cvwithd1

                          1024128d-c60d-4b74-baa5-67481b602f2f-image.png

                          windows 用这个软件烧录试一试。

                          C 1 Reply Last reply Reply Quote Share 0
                          • C
                            cvwithd1 LV 4 @whycan last edited by

                            @whycan 特意搞了一台windows设备,但是故障板子插上去phoenixSuit检测不到。为了排除是windows上的问题,我把一块全新的D1插上去,倒是能够识别。看来是故障板子挂了。

                            W 1 Reply Last reply Reply Quote Share 0
                            • W
                              whycan晕哥 LV 9 @cvwithd1 last edited by

                              @cvwithd1
                              按住FEL键,USB也不能进入FEL模式吗?

                              C 1 Reply Last reply Reply Quote Share 0
                              • C
                                cvwithd1 LV 4 @whycan last edited by

                                @whycan FEL模式应该是可以进的,因为之前我就是通过这个方式尝试在mac下用phoenixsuit刷默认固件。

                                L 1 Reply Last reply Reply Quote Share 0
                                • L
                                  lgkgkfg LV 6 @cvwithd1 last edited by

                                  @cvwithd1 最后你编译python3.6成功了不

                                  1 Reply Last reply Reply Quote Share 0
                                  • 1 / 1
                                  • First post
                                    Last post

                                  Copyright © 2022 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                                  行为准则 | 用户协议 | 隐私权政策