Closed lars18th closed 1 year ago
does the following content answer your question ?
Quickstart for Ubuntu 20.04.3 LTS
xfrp need [libevent](https://github.com/libevent/libevent) [openssl-dev](https://github.com/openssl/openssl) and [json-c](https://github.com/json-c/json-c) support
Before compile xfrp, please install libevent and json-c in your system.
Install json-c libevent in ubuntu 20.04 LTS
sudo apt-get install -y libjson-c-dev
sudo apt-get install -y libevent-dev
Fork xfrpc on GitHub
git clone https://github.com/${YOUR_GITHUB_ACCOUNT_NAME}/xfrpc.git
cd xfrp
mkdir build
cmake ..
make
Hi @liudf0716 ,
Thank you for the response. However, this is only a simple guide to compile the content of this repo. My concern is about How to compile the binaries statically. Are you sure that the default compilation mode using the cmake
tool is an static target?
Hi @liudf0716 ,
To compile the package inside one Ubuntu docker image:
$ docker run -v $(pwd):/root -it ubuntu:22.04 /bin/bash
apt update
apt install build-essential
apt-get install -y git cmake libssl-dev zlib1g-dev
apt-get install -y libjson-c-dev
apt-get install -y libevent-dev
cd /root
git clone https://github.com/liudf0716/xfrpc.git
cd xfrp
mkdir build
cd build
cmake ..
make
root@914d09f63f63:~/xfrpc/build# ldd xfrpc
linux-vdso.so.1 (0x00007ffd7cfc1000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f5ad31e0000)
libevent-2.1.so.7 => /lib/x86_64-linux-gnu/libevent-2.1.so.7 (0x00007f5ad318c000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f5ad3170000)
libjson-c.so.5 => /lib/x86_64-linux-gnu/libjson-c.so.5 (0x00007f5ad315d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5ad2f35000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5ad3655000)
And as you can see the output binary is NOT static. The question is how to compile it without any library dependency. Do you know it?
@lars18th thanks for your detailed explanation, I understand what u mean now. In fact I didn't think that in deep, therefore I need time to verify how to link depended library in static mode.
Hi @liudf0716 ,
Thank you. I hope you will found a solution to compile the binaries statically. The objective is to use this tool in different devices not running OpenWRT.
Regards.
Hi to @helintongh abd @liudf0716 for adding this very useful option. Congratulations! 👍
Hi,
This project targets OpenWRT devices. However, it could be useful to run it in other devices. In this case, the only one requirement is that the binary will be static. Therefore, the question is: how to compile the target static?
Regards.