Prerequisite builds targeting Yocto poky toolchain fail due to missing compiler flags
Summary
gpsd, gtest, ad9361, liquid fail to build as they don't use or overwrite compiler flags CXXFLAGS, CFLAGS, SYSROOT etc
Steps to reproduce
Run ./scripts/install-prerequisites.sh -f {platform}
Where {platform} uses a Yocto poky toolchain to build and requires it's own sourced environment variables
Context
Run install-prerequisites.sh
Expected correct behaviour
Build passes
Relevant logs and/or screenshots
Yocto poky toolchain expects to have environment sourced before building
Then you get env vars such as:
export SDKTARGETSYSROOT=/opt/poky/2.5.3/sysroots/cortexa9hf-neon-poky-linux-gnueabi
export CXX="arm-poky-linux-gnueabi-g++ -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=$SDKTARGETSYSROOT"
The various build scripts and autotools don't pick these up properly
Environment info
- OpenCPI Version 2.0.1, 2.1.0
- Type of install (Source or RPM): Source
- Environment vars (
env | grep -i ocpi | sort): - Operating System and version (ex. CentOS 7): Ubuntu 18.04
- Link to your project on GitLab (optional):
Possible fixes
For the most part (gtest, ad9361, liquid) I have created a work around where I add scripts to my custom Yocto poky toolchain which point to the tools (g++, gcc etc) with the flags added
In my platform file I have this:
OcpiCrossCompile:=${CROSS_COMPILE}
OcpiCXX=poky-g++
Where ${CROSS_COMPILE} is sourced by poky - export CROSS_COMPILE=arm-poky-linux-gnueabi-
My OcpiCXX points to a script that actually points to arm-poky-linux-gnueabi-g++
arm-poky-linux-gnueabi-g++ -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=SDKTARGETSYSROOT "@"
Where the flags are what should be in CXXFLAGS, CFLAGS etc
This almost works really well except that gtest script requires
addition of PATH=$PATH
and removal of quotes around $CXX and $AR to make my scripts work
The reason for the scripts is that none of the prerequisite scripts can pick up already sourced env vars....
gpsd is a pain as it uses scons which does things differently to the rest...
I have had to hardcode a check on target platform and manually add the CXXFLAGS setting, for some reason it can't get them from the environment variables
And I tried sourcing from my install-{platform}.sh script but that doesn't work either. I assume it's all some sort of bash / shell limitation and is out of my knowledge how to fix it properly