awslabs / aws-c-s3

C99 library implementation for communicating with the S3 service, designed for maximizing throughput on high bandwidth EC2 instances.
Apache License 2.0
102 stars 41 forks source link

Failed to build dependencies on ubuntu 20 #326

Closed dbickson closed 1 year ago

dbickson commented 1 year ago

Describe the issue

The go requirement is not documented, I was able to solve it via installed 1.20.5 go from source (the default go with ubuntu 20.04 is 1.14 I think and then I got an error of missing includes).

 wget https://go.dev/dl/go1.20.5.linux-amd64.tar.gz
  sudo tar -C /usr/local -xzf go1.20.5.linux-amd64.tar.gz
  mkdir ~/.go
  GOROOT=/usr/local/go
  GOPATH=~/.go
  PATH=$PATH:$GOROOT/bin:$GOPATH/bin
  sudo update-alternatives --install "/usr/bin/go" "go" "/usr/local/go/bin/go" 0
  sudo update-alternatives --set go /usr/local/go/bin/go

After solving the go issue I am getting another error:

ubuntu@ip-172-31-30-217:/mnt/data/crtsdk$ cmake -S aws-checksums -B aws-checksums/build -DCMAKE_INSTALL_PREFIX=`pwd`
CMake Error at CMakeLists.txt:31 (include):
  include could not find load file:

    AwsCFlags

CMake Error at CMakeLists.txt:32 (include):
  include could not find load file:

    AwsCheckHeaders

CMake Error at CMakeLists.txt:33 (include):
  include could not find load file:

    AwsSharedLibSetup

CMake Error at CMakeLists.txt:34 (include):
  include could not find load file:

    AwsSanitizers

CMake Error at CMakeLists.txt:36 (include):
  include could not find load file:

    AwsFindPackage

CMake Error at CMakeLists.txt:37 (include):
  include could not find load file:

    AwsFeatureTests

CMake Error at CMakeLists.txt:117 (aws_set_common_properties):
  Unknown CMake command "aws_set_common_properties".

-- Configuring incomplete, errors occurred!
See also "/mnt/data/crtsdk/aws-checksums/build/CMakeFiles/CMakeOutput.log".

Please advise what is the correct way to compile? the first 3 projects do compile but the 4th one and later are missing those includes.

Links

https://github.com/awslabs/aws-c-s3

dbickson commented 1 year ago

I fixed the previous error:

cmake -S aws-checksums -B aws-checksums/build -DCMAKE_PREFIX_PATH=`pwd` -DCMAKE_INSTALL_PREFIX=`pwd`

namely the -DCMAKE_PREFIX_PATH was missing. Now I got a new erorr:

ubuntu@ip-172-31-30-217:/mnt/data/crtsdk$ cmake -S aws-checksums -B aws-checksums/build -DCMAKE_PREFIX_PATH=`pwd` -DCMAKE_INSTALL_PREFIX=`pwd`
-- Performing Test AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS
-- Performing Test AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS - Success
-- Performing Test AWS_HAVE_WINAPI_DESKTOP
-- Performing Test AWS_HAVE_WINAPI_DESKTOP - Failed
-- Performing Test AWS_ARCH_INTEL
-- Performing Test AWS_ARCH_INTEL - Success
-- Performing Test AWS_ARCH_ARM64
-- Performing Test AWS_ARCH_ARM64 - Failed
-- Performing Test AWS_ARCH_ARM32
-- Performing Test AWS_ARCH_ARM32 - Failed
-- Performing Test AWS_HAVE_GCC_INLINE_ASM
-- Performing Test AWS_HAVE_GCC_INLINE_ASM - Success
-- Performing Test AWS_HAVE_AUXV
-- Performing Test AWS_HAVE_AUXV - Success
-- Performing Test AWS_HAVE_EXECINFO
-- Performing Test AWS_HAVE_EXECINFO - Success
-- Performing Test AWS_HAVE_LINUX_IF_LINK_H
-- Performing Test AWS_HAVE_LINUX_IF_LINK_H - Success
-- Performing Test HAS_FPIC_FLAG
-- Performing Test HAS_FPIC_FLAG - Success
-- Performing Test HAS_64BIT_FILE_OFFSET_BY_DEFAULT
-- Performing Test HAS_64BIT_FILE_OFFSET_BY_DEFAULT - Success
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Performing Test HAS_WGNU
-- Performing Test HAS_WGNU - Failed
-- Performing Test HAVE_SYSCONF
-- Performing Test HAVE_SYSCONF - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
CMake Error at /mnt/data/crtsdk/aws-c-common/cmake/aws-c-common-config.cmake:8 (include):
  include could not find load file:

    /mnt/data/crtsdk/aws-c-common/cmake/shared/@PROJECT_NAME@-targets.cmake
Call Stack (most recent call first):
  /mnt/data/crtsdk/aws-c-common/cmake/aws-c-common-config.cmake:22 (aws_load_targets)
  /mnt/data/crtsdk/lib/cmake/AwsFindPackage.cmake:19 (find_package)
  CMakeLists.txt:130 (aws_use_package)

-- Performing Test HAS_WNO_STRINGOP_OVERFLOW
-- Performing Test HAS_WNO_STRINGOP_OVERFLOW - Success
-- Configuring incomplete, errors occurred!
See also "/mnt/data/crtsdk/aws-checksums/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/data/crtsdk/aws-checksums/build/CMakeFiles/CMakeError.log".
waahm7 commented 1 year ago

@dbickson, thank you for creating the issue. Could you please try updating the path to something other than pwd, such as <pwd>/build? I've tested this and it works fine. Maybe CMake is encountering some conflicts when pwd is specified.

Regarding the GO requirement, we can disable it during the build process of Aws-lc using cmake -S aws-lc -B aws-lc/build -DCMAKE_INSTALL_PREFIX=<install-path> -DDISABLE_GO=ON. I'll update our ReadMe with this flag.

dbickson commented 1 year ago

HI @waahm7 I tried also routing the install prefix to another folder not pwd and it did not work either, which OS are you using? I was using Ubuntu 20.04, are you using Amazon Linux?

waahm7 commented 1 year ago

@dbickson, I tried it on Ubuntu 20.04 using the following steps:

git clone https://github.com/awslabs/aws-lc.git
cmake -S aws-lc -B aws-lc/build -DCMAKE_INSTALL_PREFIX=/home/ubuntu/work/build -DDISABLE_GO=ON
cmake --build aws-lc/build --target install

git clone https://github.com/aws/s2n-tls.git
cmake -S s2n-tls -B s2n-tls/build -DCMAKE_INSTALL_PREFIX=/home/ubuntu/work/build -DCMAKE_PREFIX_PATH=/home/ubuntu/work/build
cmake --build s2n-tls/build --target install

git clone https://github.com/awslabs/aws-c-common.git
cmake -S aws-c-common -B aws-c-common/build -DCMAKE_INSTALL_PREFIX=/home/ubuntu/work/build
cmake --build aws-c-common/build --target install

git clone https://github.com/awslabs/aws-checksums.git
cmake -S aws-checksums -B aws-checksums/build -DCMAKE_INSTALL_PREFIX=/home/ubuntu/work/build -DCMAKE_PREFIX_PATH=/home/ubuntu/work/build
cmake --build aws-checksums/build --target install

Please let me know if I'm doing anything differently. Also, could you please try it again by deleting the previous build folder?

dbickson commented 1 year ago

HI @waahm7 the new instructions work on a fresh folder, many thanks!