Xilinx / smartcam

Other
23 stars 21 forks source link

Build Error #3

Closed BloomBabe closed 2 years ago

BloomBabe commented 2 years ago

I successfully built project, made petalinux sdk, and sourced its environment-setup file. But when I run build.sh script I got:

schebnev@alveo-ubuntu:/data/kv260-vitis/smartcam$ ./build.sh /home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk
./build.sh: 7: ./build.sh: source: not found
CMake Error at /home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
  Could NOT find GStreamer (missing: GSTREAMER_INCLUDE_DIRS
  GSTREAMER_LIBRARIES GSTREAMER_VERSION GSTREAMER_BASE_INCLUDE_DIRS
  GSTREAMER_BASE_LIBRARIES) (found version "")
Call Stack (most recent call first):
  /home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindGStreamer.cmake:112 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:27 (find_package)

-- Configuring incomplete, errors occurred!
See also "/data/kv260-vitis/smartcam/build/CMakeFiles/CMakeOutput.log".
xlnx-yuxiz commented 2 years ago

Can you check if there's "/usr/lib/gstreamer-1.0/include/gst" under your sysroot? You should follow the steps here up to and including SDK generation to get the sdk.

BTW, what's your petalinux version? 2021.1 release?

BloomBabe commented 2 years ago

I have it in "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include/gst". Yes, I use 2021.1 release.

xlnx-yuxiz commented 2 years ago

Hi @BloomBabe , I think the sysroot should be at $SDKINSTALLPATH/sysroots/cortexa72-cortexa53-xilinx-linux, after you source the file $SDKINSTALLPATH/environment-setup-cortexa72-cortexa53-xilinx-linux, can you confirm? Or can you show the content of your $SDKINSTALLPATH/environment-setup-cortexa72-cortexa53-xilinx-linux?

BloomBabe commented 2 years ago

Content of the environment-setup-cortexa72-cortexa53-xilinx-linux:

# Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice
# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80
# http://xahlee.info/UnixResource_dir/_/ldpath.html
# Only disable this check if you are absolutely know what you are doing!
if [ ! -z "$LD_LIBRARY_PATH" ]; then
    echo "Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'"
    echo "but please check why this was set in the first place and that it's safe to unset."
    echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."
    echo "For more references see:"
    echo "  http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80"
    echo "  http://xahlee.info/UnixResource_dir/_/ldpath.html"
    return 1
fi
export SDKTARGETSYSROOT=/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/cortexa72-cortexa53-xilinx-linux
export PATH=/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/bin:/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/sbin:/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/bin:/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/sbin:/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/bin/../x86_64-petalinux-linux/bin:/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux:/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux-musl:$PATH
export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT
export PKG_CONFIG_PATH=$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig
export CONFIG_SITE=/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/site-config-cortexa72-cortexa53-xilinx-linux
export OECORE_NATIVE_SYSROOT="/home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux"
export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"
export OECORE_ACLOCAL_OPTS="-I /home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/x86_64-petalinux-linux/usr/share/aclocal"
export OECORE_BASELIB="lib"
export OECORE_TARGET_ARCH="aarch64"
export OECORE_TARGET_OS="linux"
unset command_not_found_handle
export CC="aarch64-xilinx-linux-gcc  -mcpu=cortex-a72.cortex-a53 -march=armv8-a+crc -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export CXX="aarch64-xilinx-linux-g++  -mcpu=cortex-a72.cortex-a53 -march=armv8-a+crc -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export CPP="aarch64-xilinx-linux-gcc -E  -mcpu=cortex-a72.cortex-a53 -march=armv8-a+crc -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export AS="aarch64-xilinx-linux-as "
export LD="aarch64-xilinx-linux-ld  --sysroot=$SDKTARGETSYSROOT"
export GDB=aarch64-xilinx-linux-gdb
export STRIP=aarch64-xilinx-linux-strip
export RANLIB=aarch64-xilinx-linux-ranlib
export OBJCOPY=aarch64-xilinx-linux-objcopy
export OBJDUMP=aarch64-xilinx-linux-objdump
export READELF=aarch64-xilinx-linux-readelf
export AR=aarch64-xilinx-linux-ar
export NM=aarch64-xilinx-linux-nm
export M4=m4
export TARGET_PREFIX=aarch64-xilinx-linux-
export CONFIGURE_FLAGS="--target=aarch64-xilinx-linux --host=aarch64-xilinx-linux --build=x86_64-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now"
export CPPFLAGS=""
export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"
export OECORE_DISTRO_VERSION="2021.1"
export OECORE_SDK_VERSION="2021.1"
export ARCH=arm64
export CROSS_COMPILE=aarch64-xilinx-linux-

# Append environment subscripts
if [ -d "$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then
    for envfile in $OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do
        . $envfile
    done
fi
if [ -d "$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
    for envfile in $OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
        . $envfile
    done
fi
xlnx-yuxiz commented 2 years ago

@BloomBabe so you can see the SDKTARGETSYSROOT is /home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/cortexa72-cortexa53-xilinx-linux If everything goes fine, there should be /home/schebnev/Petalinux/petalinux-kria-2021.1/image/linux/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/include/gstreamer-1.0 Please make sure that you follow the steps here up to and including SDK generation to get the sdk.

BloomBabe commented 2 years ago

I found that in order to connect the gstreamer-1.0 to SDK it is necessary to add it in 'Petalinux Package Groups-->pacakgegroup-petalinux-gstreamer' and then build the project and extract SDK. But I dont understand why this is not mentioned in tutorial

chkohn commented 2 years ago

@BloomBabe if you look at the PetaLinux tutorial here: https://xilinx.github.io/kria-apps-docs/main/build/html/docs/build_petalinux.html#enable-xilinx-application-packages , the step right before the SDK generation enables all the example applications in the PetaLinux BSP which in turn also enables all the dependent packages like gstreamer and others. If you do this prior to SDK generation, you will have everything enabled that is needed to cross-compile this and other example apps. Maybe we should add a note in the SDK generation section https://xilinx.github.io/kria-apps-docs/main/build/html/docs/build_petalinux.html#build-the-sdk as well that mentions to enable these package groups prior to SDK generation, would that help?

xlnx-yuxiz commented 2 years ago

@BloomBabe The "Enable Xilinx Application Packages" section of tutorial is to add the application and all its dependencies into rootfs and also SDK. So if you strictly flow it, there should be gstreamer libs and headers in the SDK.