liudf0716 / xfrpc

The xfrpc project is a lightweight implementation of the FRP client written in C language for OpenWRT and IoT systems. It is designed to provide an efficient solution for resource-constrained devices such as OpenWRT routers and IoT devices, which often have limited ROM and RAM space.
GNU General Public License v3.0
712 stars 89 forks source link

Compiling in THIRDPARTY_STATIC_BUILD mode fails to link #35

Open liudf0716 opened 1 year ago

liudf0716 commented 1 year ago

It's the compiling step:

  1. fork project and compile
git clone https://github.com/${YOUR_GITHUB_ACCOUNT_NAME}/xfrpc.git
cd xfrp
mkdir build
cmake -D THIRDPARTY_STATIC_BUILD=ON ..
make
  1. at the link stage, the error 'undefined reference to `arc4random' is encountered
[  5%] Building C object CMakeFiles/xfrpc.dir/main.c.o
[ 10%] Building C object CMakeFiles/xfrpc.dir/client.c.o
[ 15%] Building C object CMakeFiles/xfrpc.dir/config.c.o
[ 20%] Building C object CMakeFiles/xfrpc.dir/control.c.o
[ 25%] Building C object CMakeFiles/xfrpc.dir/ini.c.o
[ 30%] Building C object CMakeFiles/xfrpc.dir/msg.c.o
[ 35%] Building C object CMakeFiles/xfrpc.dir/xfrpc.c.o
[ 40%] Building C object CMakeFiles/xfrpc.dir/debug.c.o
[ 45%] Building C object CMakeFiles/xfrpc.dir/zip.c.o
[ 50%] Building C object CMakeFiles/xfrpc.dir/commandline.c.o
[ 55%] Building C object CMakeFiles/xfrpc.dir/crypto.c.o
[ 60%] Building C object CMakeFiles/xfrpc.dir/fastpbkdf2.c.o
[ 65%] Building C object CMakeFiles/xfrpc.dir/utils.c.o
[ 70%] Building C object CMakeFiles/xfrpc.dir/common.c.o
[ 75%] Building C object CMakeFiles/xfrpc.dir/login.c.o
[ 80%] Building C object CMakeFiles/xfrpc.dir/proxy_tcp.c.o
[ 85%] Building C object CMakeFiles/xfrpc.dir/proxy_ftp.c.o
[ 90%] Building C object CMakeFiles/xfrpc.dir/proxy.c.o
[ 95%] Building C object CMakeFiles/xfrpc.dir/tcpmux.c.o
[100%] Linking C executable xfrpc
/usr/bin/ld: /workspaces/codespaces-blank/xfrpc/thirdparty/libs/libjson-c.a(random_seed.c.o): in function `json_c_get_random_seed':
/workspaces/codespaces-blank/xfrpc/thirdparty/json-c/random_seed.c:331: undefined reference to `arc4random'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/xfrpc.dir/build.make:354: xfrpc] Error 1
make[1]: *** [CMakeFiles/Makefile2:96: CMakeFiles/xfrpc.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
helintongh commented 1 year ago

I know the cause of the error, and will fix this bug in the compilation of adding mips architecture.

helintongh commented 1 year ago

Replacing the json.h in the include with the generated json.h should fix the issue. pr is https://github.com/liudf0716/xfrpc/pull/36