chsrc icon indicating copy to clipboard operation
chsrc copied to clipboard

[Bug] 请问openwrt该如何安装chsrc啊?

Open Matthew-Harris-36 opened this issue 1 year ago • 3 comments

你操作了什么?

x86-64位CPU使用curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-linux -o chsrc; chmod +x ./chsrc

发生了什么?

提示chsrc: chsrc: cannot execute binary file

本应该怎么样?

希望能运行

chsrc 版本

看不到

你使用的是哪个操作系统?

其他

OS 版本 / OS 发行版

OpenWrt 22.03.6

Log 输出

No response

防止重复问题

  • [X] 我已在项目的 GitHub 和 Gitee 两个仓库分别搜索过类似的 issue

Matthew-Harris-36 avatar Oct 05 '24 16:10 Matthew-Harris-36

@BlueDolphin9527

试试直接编译运行,$ git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; gmake

先看看能不能运行

ccmywish avatar Oct 06 '24 01:10 ccmywish

root@iStoreOS:~# git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; gma
ke
Cloning into 'chsrc'...
remote: Enumerating objects: 4296, done.
remote: Counting objects: 100% (2980/2980), done.
remote: Compressing objects: 100% (2405/2405), done.
remote: Total 4296 (delta 1694), reused 771 (delta 443), pack-reused 1316
Receiving objects: 100% (4296/4296), 1.41 MiB | 2.74 MiB/s, done.
Resolving deltas: 100% (2564/2564), done.
-ash: gmake: not found
root@iStoreOS:~/chsrc# opkg install gcc g++ make
Package gcc (11.2.0-4) installed in root is up to date.
Unknown package 'g++'.
Package make (4.3-1) installed in root is up to date.
Collected errors:
 * opkg_install_cmd: Cannot install package g++.
root@iStoreOS:~/chsrc# make
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [Makefile:29: all] Error 1
root@iStoreOS:~/chsrc# opkg update
Downloading https://istore.linkease.com/repo/all/compat/Packages.gz
Updated list of available packages in /var/opkg-lists/istore_compat
Downloading https://istore.linkease.com/repo/all/compat/Packages.sig
Signature check passed.
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/targets/x86/64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/targets/x86/64/packages/Packages.sig
Signature check passed.
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/base/Packages.sig
Signature check passed.
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/luci/Packages.sig
Signature check passed.
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/packages/Packages.sig
Signature check passed.
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/routing/Packages.sig
Signature check passed.
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading https://mirrors.cernet.edu.cn/openwrt/releases/22.03.6/packages/x86_64/telephony/Packages.sig
Signature check passed.
root@iStoreOS:~/chsrc# opkg install libc
Package libc (1.2.3-4) installed in root is up to date.
root@iStoreOS:~/chsrc# opkg install binutils
Package binutils (2.37-2) installed in root is up to date.
root@iStoreOS:~/chsrc# opkg install gcc
Package gcc (11.2.0-4) installed in root is up to date.
root@iStoreOS:~/chsrc# opkg install g++
Unknown package 'g++'.
Collected errors:
 * opkg_install_cmd: Cannot install package g++.
root@iStoreOS:~/chsrc# opkg install libgcc
Package libgcc1 (11.2.0-4) installed in root is up to date.
root@iStoreOS:~/chsrc# make
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [Makefile:29: all] Error 1
root@iStoreOS:~/chsrc# 

我是真解决不了

Matthew-Harris-36 avatar Oct 06 '24 14:10 Matthew-Harris-36

https://github.com/RubyMetric/chsrc/blob/main/Makefile#L19-L21

把Makefile里的这三行删了,重新 make 一下,试试,应该能编译成功。

ccmywish avatar Oct 06 '24 15:10 ccmywish

@ccmywish image image 还是不行

Matthew-Harris-36 avatar Oct 09 '24 07:10 Matthew-Harris-36

chsrc 为了移植,基本不存在任何外部依赖。所以你这里连编译都无法成功,让我觉得很奇怪。

你的报错中提到:

root@iStoreOS:~/chsrc# make
/usr/bin/ld: cannot find -lc

就是连 libc 都找不到。你试一下,写一个最简单的C语言程序输出 hello world,看能不能编译运行:

#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}

ccmywish avatar Oct 09 '24 07:10 ccmywish

image image @ccmywish

Matthew-Harris-36 avatar Oct 11 '24 04:10 Matthew-Harris-36

@BlueDolphin9527 你上一次给的这个截图,这不是编译过了吗?运行 ./chsrc 还是出现 chsrc: chsrc: cannot execute binary file 这个报错吗?

image

ccmywish avatar Oct 11 '24 09:10 ccmywish

好的,可用了,谢谢

Matthew-Harris-36 avatar Oct 12 '24 04:10 Matthew-Harris-36