Re: #sdk #yocto Appears SDK searching host for files that are only present on target side #sdk #yocto


Leon Woestenberg
 

Hello Steven,

you mention you use CMake with the Yocto (standard) SDK.

After you sourced the SDK environment script, what is the output of
"which cmake" ?

Do you use the cmake toolchain configuration file provided by the SDK?
(CMAKE_TOOLCHAIN_FILE)

In my conf/local.conf I make sure I have a native cmake included in the SDK:

# Does not work, will destroy TOOLCHAIN_HOST_TASK
#TOOLCHAIN_HOST_TASK += "nativesdk-cmake"
# This is a work-around (we need to extra space here because _append
will not add it for us).
TOOLCHAIN_HOST_TASK_append = " nativesdk-cmake"

And this is how I compile an application using SDK and CMake:

(source /tmp/oe-sdk-cmake/environment-setup-core2-64-oe-linux-musl && \
cd myapp-cmake && \
mkdir -p build_sdk && \
cd build_sdk && \
cmake -DCMAKE_TOOLCHAIN_FILE=$$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake
-DCMAKE_VERBOSE_MAKEFILE=1 . .. && \
make)

(I am using gcc, I I will verify this setup if I switch to clang.)

Regards,
--
Leon Woestenberg
leon@...
M: +31 6 472 30 372

Sidebranch Embedded Systems
Eindhoven, The Netherlands
http://www.sidebranch.com

On Thu, Sep 10, 2020 at 12:53 PM Monsees, Steven C (US) via
lists.yoctoproject.org
<steven.monsees=baesystems.com@...> wrote:



fyi...

I am using CMake with GNU, that is what is required for the build.

I do source the SDK environment script prior to attempting build.

Here is my current environment-setup-corei7-64-poky-linux script created by SDK:

# 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 SYSROOTS=/ede/smonsees/yocto/testSDK/sysroots
export SDKTARGETSYSROOT=/disk0/scratch/smonsees/yocto/testSDK/sysroots/corei7-64-poky-linux
export PATH=/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/usr/bin:/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/usr/sbin:/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/bin:/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/sbin:/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/usr/bin/../x86_64-pokysdk-linux/bin:/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux-musl:/disk0/scratch/smonsees/yocto/testSDK/sysroots/corei7-64-poky-linux/usr/lib/../lib/:/disk0/scratch/smonsees/yocto/testSDK/sysroots/corei7-64-poky-linux/usr/lib/../lib/x86_64-poky-linux/7.3.0/:$PATH
export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT
export PKG_CONFIG_PATH=$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig
export CONFIG_SITE=/disk0/scratch/smonsees/yocto/testSDK/site-config-corei7-64-poky-linux
export OECORE_NATIVE_SYSROOT="/disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux"
export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"
export OECORE_ACLOCAL_OPTS="-I /disk0/scratch/smonsees/yocto/testSDK/sysroots/x86_64-pokysdk-linux/usr/share/aclocal"
unset command_not_found_handle
export CC="x86_64-poky-linux-gcc -v -m64 -march=corei7 -mtune=corei7 -mfpmath=sse -msse4.2 --sysroot=$SDKTARGETSYSROOT"
export CXX="x86_64-poky-linux-g++ -v -m64 -march=corei7 -mtune=corei7 -mfpmath=sse -msse4.2 --sysroot=$SDKTARGETSYSROOT"
export CPP="x86_64-poky-linux-gcc -v -E -m64 -march=corei7 -mtune=corei7 -mfpmath=sse -msse4.2 --sysroot=$SDKTARGETSYSROOT"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=$SDKTARGETSYSROOT"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"
export CFLAGS=" --sysroot=$SDKTARGETSYSROOT -O2 -pipe -g -feliminate-unused-debug-types"
export CXXFLAGS=" --sysroot=$SDKTARGETSYSROOT -O2 -pipe -g -feliminate-unused-debug-types"
export LDFLAGS=" -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"
export OECORE_DISTRO_VERSION="2.4.1"
export OECORE_SDK_VERSION="2.4.1"
export ARCH=x86
export CROSS_COMPILE=x86_64-poky-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
export CLANGCC="x86_64-poky-linux-clang -m64 -march=corei7 -mtune=corei7 -mfpmath=sse -msse4.2 -mlittle-endian --sysroot=$SDKTARGETSYSROOT"
export CLANGCXX="x86_64-poky-linux-clang++ -m64 -march=corei7 -mtune=corei7 -mfpmath=sse -msse4.2 -mlittle-endian --sysroot=$SDKTARGETSYSROOT"
export CLANGCPP="x86_64-poky-linux-clang -E -m64 -march=corei7 -mtune=corei7 -mfpmath=sse -msse4.2 -mlittle-endian --sysroot=$SDKTARGETSYSROOT"


and

Join yocto@lists.yoctoproject.org to automatically receive all group messages.