Navigation

    全志在线开发者论坛

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

    在menuconfig页面上启用luci后编译失败

    编译和烧写问题专区
    4
    15
    5204
    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.
    • K
      konosiba LV 4 last edited by

      如标题,原本编译正常,但是在开启luci服务后编译就一直失败(见下图)
      屏幕截图 2022-10-10 093426.png
      并且在关闭luci页面里的所有选项后依旧无法正常编译,会有同样的报错。

      YuzukiTsuru 1 Reply Last reply Reply Quote Share 0
      • YuzukiTsuru
        柚木 鉉 LV 9 @konosiba last edited by

        @konosiba luci需要依赖其他的选项,会一并勾选,看一下是不是那些选项导致的问题

        K 1 Reply Last reply Reply Quote Share 0
        • K
          konosiba LV 4 @YuzukiTsuru last edited by

          @yuzukitsuru 是menuconfig中 base system里的firewall和rpcd选项,这两选项都是开了就会编译错误,但是开了luci这两个选项就会强制开启,请问如何解决?

          YuzukiTsuru 1 Reply Last reply Reply Quote Share 0
          • YuzukiTsuru
            柚木 鉉 LV 9 @konosiba last edited by

            @konosiba 那就不使用luci,或者从openwrt主线更新新版本的firewall和rpcd

            1 Reply Last reply Reply Quote Share 0
            • Q
              qianchenzhumeng LV 3 last edited by

              我编 f133 版本的时候也遇到这个问题了,怀疑是工具链的问题,认为 uint16_t 的 port->port_min 和 port->port_max 的最大值是 2147483647。

              比较快的方法是修改一下源码,找到 firewall-2016-01-29 文件夹下所有包含 65535 字符串的行,把 65535 修改成 2147483647 就可以了,其实就是把 buf 改大一点。
              应该也可以把告警转错误的编译选项 Werror 去掉,不过我还没找到地方。

              grep "65535" ./out/f133-mq_r/compile_dir/target/firewall-2016-01-29/ -nr
              

              修改后是这样的:

              grep "2147483647" ./out/f133-mq_r/compile_dir/target/firewall-2016-01-29/ -nr
              ./out/f133-mq_r/compile_dir/target/firewall-2016-01-29/iptables.c:835:  char buf[sizeof("2147483647:2147483647\0")];
              ./out/f133-mq_r/compile_dir/target/firewall-2016-01-29/redirects.c:348: char buf[sizeof("2147483647-2147483647\0")];
              ./out/f133-mq_r/compile_dir/target/firewall-2016-01-29/redirects.c:367: char buf[sizeof("255.255.255.255:2147483647-2147483647\0")];
              ./out/f133-mq_r/compile_dir/target/firewall-2016-01-29/utils.c:570:     char buf[sizeof("2147483647-2147483647\0")];
              ./out/f133-mq_r/compile_dir/target/firewall-2016-01-29/snats.c:275:     char buf[sizeof("255.255.255.255:2147483647-2147483647\0")];
              

              就可以编过了。

              我也是想用 luci 才遇到这个问题的,但是不光是这个问题,即便编译过了,烧录启动后,浏览器访问时,lua 会提示连接 ubus 有问题,顺着这个下去,发现 ubusd 也无法运行。

              路好像还很长。

              K 1 Reply Last reply Reply Quote Share 0
              • Q
                qianchenzhumeng LV 3 last edited by

                编 rpcd 可能还会在链接时遇到 crypt 函数未定义的错误,需要增加链接标志,链接 crypt 库:rpcd: Explicitly link with lcrypt

                1 Reply Last reply Reply Quote Share 0
                • K
                  konosiba LV 4 @qianchenzhumeng last edited by

                  @qianchenzhumeng 多谢回答!我按照你的思路修改下试试

                  1 Reply Last reply Reply Quote Share 0
                  • X
                    xiaowen LV 5 last edited by xiaowen

                    @qianchenzhumeng
                    @应该也可以把告警转错误的编译选项 Werror 去掉,不过我还没找到地方。
                    make -i 可以disable Werror,你试试下面的命令编译一下
                    make -i -j$(($(nproc)+1)) V=sc ; echo -e '\a'

                    1 Reply Last reply Reply Quote Share 0
                    • X
                      xiaowen LV 5 last edited by

                      [最近用也在用Luci在Tina上,也碰到这个问题,这个issue主要是我们在写程序时用到不定长的buffer时要对最大长度预留一些余量,比如Luci用的的firewall 中

                      char buf[sizeof("65535-65535\0")];
                      
                      sprintf(buf, "%u-%u", port->port_min, port->port_max);
                      

                      我们要把两个uint16(范围是0到65535)连接并转为字符,上面定义是没有问题的,而且加了一个\0字符余量,正常GCC可以看到不报错,但是不知道为什么Tina的GCC看不到就奇怪了,不过改为snprintf就可以了,如下:

                      		snprintf(buf, sizeof("65535-65535\0"), "%u-%u", port->port_min, port->port_max);
                      

                      你也可以只用用下面的patch文件

                      0001-fix-luci-firewall-tina-gcc-werror-issues.patch

                      [ 7%] Building C object CMakeFiles/firewall3.dir/main.c.o
                      [ 14%] Building C object CMakeFiles/firewall3.dir/options.c.o
                      [ 21%] Building C object CMakeFiles/firewall3.dir/defaults.c.o
                      [ 28%] Building C object CMakeFiles/firewall3.dir/zones.c.o
                      [ 35%] Building C object CMakeFiles/firewall3.dir/forwards.c.o
                      [ 42%] Building C object CMakeFiles/firewall3.dir/rules.c.o
                      [ 50%] Building C object CMakeFiles/firewall3.dir/redirects.c.o
                      [ 57%] Building C object CMakeFiles/firewall3.dir/snats.c.o
                      [ 64%] Building C object CMakeFiles/firewall3.dir/utils.c.o
                      [ 71%] Building C object CMakeFiles/firewall3.dir/ubus.c.o
                      [ 78%] Building C object CMakeFiles/firewall3.dir/ipsets.c.o
                      [ 85%] Building C object CMakeFiles/firewall3.dir/includes.c.o
                      [ 92%] Building C object CMakeFiles/firewall3.dir/iptables.c.o
                      [100%] Linking C executable firewall3

                      X 1 Reply Last reply Reply Quote Share 0
                      • X
                        xiaowen LV 5 @xiaowen last edited by

                        @xiaowen
                        另外,rpcd会报一个ld undefined crypt issue,如下
                        make[5]: Entering directory '/home/liyq/tina-d1-h/out/d1-h-nezha/compile_dir/target/rpcd'
                        [ 41%] Linking C executable rpcd
                        /home/liyq/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/../lib/gcc/riscv64-unknown-linux-gnu/8.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: CMakeFiles/rpcd.dir/session.c.o: in function rpc_login_test_login': /home/liyq/tina-d1-h/out/d1-h-nezha/compile_dir/target/rpcd/session.c:874: undefined reference to crypt'
                        collect2: error: ld returned 1 exit status

                        直接在package 下rpcd的Makefile中加上下面一行即可
                        TARGET_LDFLAGS += -lcrypt

                        X 1 Reply Last reply Reply Quote Share 0
                        • X
                          xiaowen LV 5 @xiaowen last edited by

                          @xiaowen
                          经过一番折腾,Luci终于跑起来了在D1h上
                          Screen Shot 2022-10-22 at 13.10.50.png

                          Q 1 Reply Last reply Reply Quote Share 0
                          • Q
                            qianchenzhumeng LV 3 @xiaowen last edited by

                            @xiaowen 请问有遇到 luci 报错的问题吗?如何解决的呢?

                            X 1 Reply Last reply Reply Quote Share 0
                            • X
                              xiaowen LV 5 @qianchenzhumeng last edited by

                              @qianchenzhumeng 除了上面碰到的两个问题,其他问题没有碰到,你还碰到其他问题吗?

                              Q 1 Reply Last reply Reply Quote Share 0
                              • Q
                                qianchenzhumeng LV 3 @xiaowen last edited by

                                @xiaowen 我还遇到了 luci 无法和 ubus 建立连接的问题,不过已经解决掉了,原因是 sdk 里面,默认的启动进程是 init,需要替换成 procd,ubusd 才能正常工作,luci 才能和 ubus 通信。否则网页上就会报如下错误:

                                /usr/lib/lua/luci/dispatcher.lua:460: Failed to execute function dispatcher target for entry '/'.
                                The called action terminated with an exception:
                                /usr/lib/lua/luci/util.lua:610: Unable to establish ubus connection
                                stack traceback:
                                	[C]: in function 'assert'
                                	/usr/lib/lua/luci/dispatcher.lua:460: in function 'dispatch'
                                	/usr/lib/lua/luci/dispatcher.lua:141: in function </usr/lib/lua/luci/dispatcher.lua:140>
                                

                                走了好多弯路。
                                最开始是想让 usbd 跑起来,但是手动启动会报错:

                                usbd &
                                usock: no such file or directory
                                

                                看了 ubus 的源码,尝试在 /var 下创建 run 目录后,再手动启动 usbd 能够成功:

                                mkdir /var/run
                                ubusd &
                                

                                但是 luci 会报另外的错误:

                                Status: 500 Internal Server Error
                                /usr/lib/lua/luci/dispatcher.lua:460: Failed to execute function dispatcher target for entry '/'.
                                The called action terminated with an exception:
                                /usr/lib/lua/luci/template.lua:97: Failed to execute template 'sysauth'.
                                A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'header'.
                                A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'themes/bootstrap/header'.
                                A runtime error occured: [string "/usr/lib/lua/luci/view/themes/bootstrap/hea..."]:150: attempt to index local 'boardinfo' (a nil value)
                                stack traceback:
                                	[C]: in function 'assert'
                                	/usr/lib/lua/luci/dispatcher.lua:460: in function 'dispatch'
                                	/usr/lib/lua/luci/dispatcher.lua:141: in function </usr/lib/lua/luci/dispatcher.lua:140>
                                

                                监听 ubus 发现,luci 从 ubus 查询一些信息的时候,ubus 返回找不到:

                                ubus monitor
                                -> b40158cc #b40158cc          hello: {}
                                <- b40158cc #00000000         lookup: {"objpath":"session"}
                                -> b40158cc #00000000         status: {"status":4}
                                <- b40158cc #00000000         lookup: {"objpath":"system"}
                                -> b40158cc #00000000         status: {"status":4}
                                

                                之后找到一篇分析 openwrt 启动顺序的文章:《OpenWrt 启动顺序》,里面提到 procd 启动的时候要连接 ubus,于是按这个帖子把启动进程换成了 procd:《Tina procd-init 与 busybox-init 切换》,之后就好了,luci 可以用了。

                                1 Reply Last reply Reply Quote Share 0
                                • Q
                                  qianchenzhumeng LV 3 last edited by

                                  另外的,我的开发板是芒果派 MQ-R F133。

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

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

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