junxzm1990 / x86-sok

124 stars 20 forks source link

x86/build.sh is outdated for some dependencies #17

Closed fsgmhoward closed 2 years ago

fsgmhoward commented 2 years ago

While I follow the README and build ground truth generator on my VM, I encountered some issues.

System information:

howard@Howard-Ubuntu:~/x86-sok/gt$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:   jammy

howard@Howard-Ubuntu:~/x86-sok/gt$ dpkg --list | grep libc6
ii  libc6:amd64                                2.35-0ubuntu3.1                            amd64        GNU C Library: Shared libraries
ii  libc6-dbg:amd64                            2.35-0ubuntu3.1                            amd64        GNU C Library: detached debugging symbols
ii  libc6-dev:amd64                            2.35-0ubuntu3.1                            amd64        GNU C Library: Development Libraries and Header Files
ii  libc6-dev-i386                             2.35-0ubuntu3.1                            amd64        GNU C Library: 32-bit development libraries for AMD64
ii  libc6-dev-x32                              2.35-0ubuntu3.1                            amd64        GNU C Library: X32 ABI Development Libraries for AMD64
ii  libc6-i386                                 2.35-0ubuntu3.1                            amd64        GNU C Library: 32-bit shared libraries for AMD64
ii  libc6-x32                                  2.35-0ubuntu3.1                            amd64        GNU C Library: X32 ABI Shared libraries for AMD64

howard@Howard-Ubuntu:~/x86-sok/gt$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1) 

howard@Howard-Ubuntu:~/x86-sok/gt$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.38
  1. Protobuf current version 21.x no longer use autogen.sh so the script will exit in error at line 45

    eval "cd protobuf && git submodule update --init --recursive && ./autogen.sh"

    Suggested fix: tag the old branch when pulling repo, e.g.

    eval "git clone https://github.com/protocolbuffers/protobuf.git -b 3.20.x"
  2. When running bash x86/build.sh, PWD_PATH is set to be x86/build, so at line 76

    PROTODEF_DIR="$PWD_PATH/../proto"

    PROTODEF_DIR is set to be x86/proto which is wrong. This should probably be:

    PROTODEF_DIR="$PWD_PATH/../../proto"
  3. Error in compilation of binutils & gas 2.30

    mv -f .deps/stabs.Tpo .deps/stabs.Po
    mv -f .deps/bbInfoHandle.Tpo .deps/bbInfoHandle.Po
    mv -f .deps/write.Tpo .deps/write.Po
    mv -f .deps/symbols.Tpo .deps/symbols.Po
    mv -f .deps/read.Tpo .deps/read.Po
    mv -f .deps/tc-i386.Tpo .deps/tc-i386.Po
    /bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings  -I/usr/local/include  -static-libstdc++ -static-libgcc -L/usr/local/lib -lprotobuf-c -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o bbInfoHandle.o shuffleInfo.pb-c.o tc-i386.o obj-elf.o atof-ieee.o  ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a   
    libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I/usr/local/include -static-libstdc++ -static-libgcc -o .libs/as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o bbInfoHandle.o shuffleInfo.pb-c.o tc-i386.o obj-elf.o atof-ieee.o  -L/usr/local/lib ../opcodes/.libs/libopcodes.so -L/home/howard/x86-sok/gt/x86/build/binutils-2.30/build/opcodes/../libiberty/pic ../bfd/.libs/libbfd.so -L/home/howard/x86-sok/gt/x86/build/binutils-2.30/build/bfd/../libiberty/pic /usr/local/lib/libprotobuf-c.so -liberty -lz ../libiberty/libiberty.a -Wl,-rpath -Wl,/home/howard/x86-sok/gt/x86/build/executable_binutils/lib
    /usr/bin/ld: symbols.o:(.bss+0x0): multiple definition of `jmp_table'; ehopt.o:(.bss+0x0): first defined here
    /usr/bin/ld: bbInfoHandle.o:(.bss+0x0): multiple definition of `jmp_table'; ehopt.o:(.bss+0x0): first defined here
    /usr/bin/ld: obj-elf.o:(.bss+0x0): multiple definition of `jmp_table'; ehopt.o:(.bss+0x0): first defined here
    collect2: error: ld returned 1 exit status
    make[4]: *** [Makefile:806: as-new] Error 1
    make[4]: Leaving directory '/home/howard/x86-sok/gt/x86/build/binutils-2.30/build/gas'
    make[3]: *** [Makefile:2295: all-recursive] Error 1
    make[3]: Leaving directory '/home/howard/x86-sok/gt/x86/build/binutils-2.30/build/gas'
    make[2]: *** [Makefile:736: all] Error 2
    make[2]: Leaving directory '/home/howard/x86-sok/gt/x86/build/binutils-2.30/build/gas'
    make[1]: *** [Makefile:4864: all-gas] Error 2
    make[1]: Leaving directory '/home/howard/x86-sok/gt/x86/build/binutils-2.30/build'

    This might due to gcc version 11.2.0 and ld version 2.38 being too new for the package. Tried to update to latest binutils 2.39 and it fixed this issue while introduced new ones. Still finding a way to get around with it. I will try docker version first.

bin2415 commented 2 years ago

Hello, thanks for your suggestions! I fixed the dependencies of build.sh. I recommend to run build.sh if your machine is Ubuntu18.04. We also provide the Dockerfile to build the toolchains of x86/x64.

fsgmhoward commented 2 years ago

@bin2415 Thanks! For the docker file it do work although sometimes it will be good to download resources using http instead of ftp. That occurs for a script of one of the dependencies and I have to do a sed replacement because my network blocked outbound ftp connections. I understand not in the scope of your dockerBuild.sh though.