编译sifive的freedom-u-sdk

编译sifive的freedom-u-sdk

    • 问题1:error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
      • 解决1:
    • 问题2:fatal error: openssl/bio.h: No such file or directory
      • 解决2:
    • 参考文章

在其它电脑搭建编译该sdk工程的环境,由于所在电脑的linux系统为新装系统(版本:Ubuntu 20.04 LTS),下面记录了编译过程中遇到的问题,以及解决过程供以后参考

问题1:error “Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib.”

freadahead.c: In function 'freadahead':
rm -f t-charset.alias charset.alias && \
/bin/bash ./config.charset 'x86_64-pc-linux-gnu' > t-charset.alias && \
mv t-charset.alias charset.alias
freadahead.c:91:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
   91 |  #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
      |   ^~~~~
fseeko.c: In function 'rpl_fseeko':
make[7]: *** [Makefile:1842: freadahead.o] Error 1
make[7]: *** Waiting for unfinished jobs....
fseeko.c:109:4: error: #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
  109 |   #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
      |    ^~~~~
make[7]: *** [Makefile:1842: fseeko.o] Error 1
make[6]: *** [Makefile:1602: all] Error 2
make[5]: *** [Makefile:1506: all-recursive] Error 1
make[4]: *** [Makefile:1461: all] Error 2
make[3]: *** [package/pkg-generic.mk:198: /home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/work/buildroot_initramfs/build/host-m4-1.4.17/.stamp_built] Error 2
make[2]: *** [Makefile:36: _all] Error 2
make[2]: Leaving directory '/home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/buildroot'
make[1]: *** [Makefile:115: /home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/work/buildroot_initramfs/images/rootfs.tar] Error 2
make[1]: Leaving directory '/home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk'
make: *** [Makefile:312: Image] Error 2

解决1:

//进入报错目录
$ cd /home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/work/buildroot_initramfs/build/host-m4-1.4.17
$ sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
$ echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h

问题2:fatal error: openssl/bio.h: No such file or directory

/home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/linux/scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
   21 | #include 
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.host:90: scripts/extract-cert] Error 1
make[4]: *** Waiting for unfinished jobs....
  SHIPPED scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  CHK     scripts/mod/devicetable-offsets.h
  UPD     scripts/mod/devicetable-offsets.h
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  UPD     include/config/kernel.release
  Using /home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/linux as source for kernel
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      kernel/bounds.s
  CHK     include/generated/timeconst.h
  UPD     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  UPD     include/generated/bounds.h
  CC      arch/riscv/kernel/asm-offsets.s
  HOSTLD  scripts/dtc/dtc
  CHK     include/generated/asm-offsets.h
  UPD     include/generated/asm-offsets.h
  CALL    /home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/linux/scripts/checksyscalls.sh
  HOSTLD  scripts/mod/modpost
make[3]: *** [/home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/linux/Makefile:556: scripts] Error 2
make[3]: Leaving directory '/home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/work/linux'
make[2]: *** [Makefile:146: sub-make] Error 2
make[2]: Leaving directory '/home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/linux'
make[1]: *** [Makefile:164: /home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk/work/linux/vmlinux] Error 2
make[1]: Leaving directory '/home/imaginemiracle/Miracle/Linux_Workspace/riscv-object/freedom-u-sdk'
make: *** [Makefile:312: Image] Error 2

解决2:

出现这个或者fatal error: openssl/名单.h: No such file or directory。都是没有安装libssl-dev
libssl-dev包含libraries, header files and manpages,他是openssl的一部分,而openssl对ssl进行了实现

$ sudo apt-get install libssl-dev

参考文章

[1].https://blog.csdn.net/zmlovelx/article/details/104200565
[2].https://blog.csdn.net/qq_41533289/article/details/82985788

你可能感兴趣的:(学习过程中遇到的小问题)