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
721 stars 92 forks source link

How to compile in docker to different architecture? #30

Open lars18th opened 1 year ago

lars18th commented 1 year ago

Hi,

Now we can compile xfrpc inside a container with static support. However, I need to know how to compile not only for x86, but for example ARM for Android device, mips32 for OpenWRT device, etc.

Any idea?

liudf0716 commented 1 year ago

@lars18th XFRPC has already been adopted by the OpenWRT project, which supports a wide range of hardware platforms such as ARM, MIPS and so on.

lars18th commented 1 year ago

Hi @liudf0716 ,

Yes, I know it. However, I need to compile it statically for a different platform (not OpenWRT). So, you know how to compile it inside the Docker container for mips32 device?

Thank you.

liudf0716 commented 1 year ago

@lars18th I haven't done the research yet, maybe someone else can do it for you.

helintongh commented 1 year ago

You are talking about cross compiling.There will be a document describing how to cross-compile the corresponding binary through arm-gcc or mips-gcc.

lars18th commented 1 year ago

You are talking about cross compiling.There will be a document describing how to cross-compile the corresponding binary through arm-gcc or mips-gcc.

Thank you. I want to see this document soon. Regards.

helintongh commented 1 year ago

Now supports cross-compiling xfrpc for mips architecture or arm architecture on x86. See pr https://github.com/liudf0716/xfrpc/pull/36 . Execute the following command in ubuntu 22.04:

sudo apt-get install gcc-mips-linux-gnu # install mips-gcc compiler
mkdir build && cd build
cmake -DTHIRDPARTY_STATIC_BUILD=mips -DCMAKE_C_COMPILER=mips-linux-gnu-gcc ..
make

get mips xfrpc.

image

lars18th commented 1 year ago

Hi @helintongh ,

Thank you. I'll check it with the docker image.