Skip to content

WSL2 Ubuntu 22.04.3 LTS交叉编译失败 #69

@xioei

Description

@xioei

一、环境:

  1. lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 22.04.3 LTS
    Release: 22.04
    Codename: jammy

  2. cat /proc/version
    Linux version 5.10.102.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) How to cross compile this project? #1 SMP Wed Mar 2 00:30:59 UTC 2022

3.arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

二、编译报错:
1.git拉取master分支
2.执行cmake -DTHIRDPARTY_STATIC_BUILD=arm -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc ..报错

/usr/bin/ld: crypto/aes/aes_cbc.o: relocations in generic ELF (EM: 40)
/usr/bin/ld: crypto/aes/aes_cbc.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:704: libcrypto.so] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/xiongwei/workspace/xfrpc/thirdparty/openssl-1.1.1m'
make: *** [Makefile:174: all] Error 2

还有其他报错省略

3.执行make 报错

xfrpc/client.c:16:10: fatal error: zlib.h: No such file or directory
   16 | #include <zlib.h>
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/xfrpc.dir/build.make:90: CMakeFiles/xfrpc.dir/client.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:101: CMakeFiles/xfrpc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

4.将zlib.h和zconf.h复制到include目录下,再执行make 还是报错

/usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcrypt: No such file or directory
/usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcrypt: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/xfrpc.dir/build.make:497: xfrpc] Error 1
make[1]: *** [CMakeFiles/Makefile2:101: CMakeFiles/xfrpc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions