How to build linux binary on mac

I tried this way.
1.rustup target add x86_64-unknown-linux-musl
2.brew install FiloSottile/musl-cross/musl-cross
3. vi ~/.cargo/config , and add
linker = "x86_64-linux-musl-gcc"
4.CC_x86_64_unknown_linux_musl="x86_64-linux-musl-gcc" cargo build --release --target=x86_64-unknown-linux-musl

But it not work.

error[E0425]: cannot find value `SO_INCOMING_CPU` in crate `libc`
    --> /Users/zhpan/.cargo/registry/src/
1201 |             getsockopt::<c_int>(self.inner, libc::SOL_SOCKET, libc::SO_INCOMING_CPU)
     |                                                                     ^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `SO_INCOMING_CPU` in crate `libc`
    --> /Users/zhpan/.cargo/registry/src/
1217 |                 libc::SO_INCOMING_CPU,
     |                       ^^^^^^^^^^^^^^^ not found in `libc`

   Compiling hostname v0.3.1
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
error: could not compile `socket2`

To learn more, run the command again with --verbose.

It failed with build crate socket2.
How to solve this problem, can you help me?

I asked before, but I still choose to compile rust directly on centos.
I won't be because of Docker.

But I try to use a ubuntu image based ecs on aliyun to build it, it have another error. Only centos can build it? I developed it on mac. I am so confused with the reason. I am a golang programmer before. It's easy to cross-platform build. But a lot of strange error happened when build it on linux.

I even got a ecs on aws, it also have errors on building.

[root@ip-172-31-26-45 fast-ipam]# cargo build
   Compiling fast_ipam v0.1.0 (/home/ec2-user/fast-ipam)
error: linking with `cc` failed: exit code: 1
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib"

But works very well on my mac, I can't understand the error which not caused by my program.

Finally, I found it caused by libc's bug.
After cargo update. it works!