XRT icon indicating copy to clipboard operation
XRT copied to clipboard

Create XRT_STATIC_COMPONENT option in cmake build files

Open timsnyder opened this issue 2 years ago • 16 comments

Problem solved by the commit

Want to separately package the static libraries.

~~Bug~~ / issue (if any) fixed, which PR introduced the bug, how it was discovered

Fixes #6799

How problem was solved, alternative solutions (if any) and why they were rejected

Alternate solution is to maintain this as a separate patch in the downstream package recipe and that was rejected because it will be too fragile to maintain.

Risks (if any) associated the changes in the commit

The only change that would be visible to those not setting XRT_STATIC_COMPONENT

What has been tested and how, request additional testing if necessary

Hasn't been tested yet. I'm planning to run the ctests in XRT against this with XRT_STATIC_COMPONENT at it's default value and to also package and test downstream against my design with manual spotchecking. If there are more tests that I should run, I'd be happy to.

Documentation impact (if any)

If XRT_DEV_COMPONENT is documented somewhere, we might want to add XRT_STATIC_COMPONENT to wherever that might be.

timsnyder avatar Jul 02 '22 22:07 timsnyder

Can one of the admins verify this patch?

gbuildx avatar Jul 02 '22 22:07 gbuildx

ok to test

bryanloz-xilinx avatar Jul 03 '22 00:07 bryanloz-xilinx

it was worth a try, but I guess I'm no admin :-)

bryanloz-xilinx avatar Jul 03 '22 00:07 bryanloz-xilinx

@stsoe, Thank you for your review!

timsnyder avatar Jul 03 '22 15:07 timsnyder

Looks like the version of Centos used by AWS:

 ___ ___  ___   _     ___  _____   __    _   __  __ ___
| __| _ \/ __| /_\   |   \| __\ \ / /   /_\ |  \/  |_ _|
| _||  _/ (_ |/ _ \  | |) | _| \ V /   / _ \| |\/| || |
|_| |_|  \___/_/ \_\ |___/|___| \_/   /_/ \_\_|  |_|___|
AMI Version:        1.12.0

is no longer new enough to build XRT latest.

I've run xrtdeps.sh to get packages updated and when I run cd build && ./build.sh -split_dev -split_static (on this PR branch) I run into a bunch of CMake errors saying:

CMake Error in /home/centos/XRT/tests/validate/aie_pl_test/CMakeLists.txt:
  Target "aie_pl.exe" requires the language dialect "CXX17" (with compiler
  extensions), but CMake does not know the compile flags to use to enable it.

I'm spinning up a newer VM.

timsnyder avatar Jul 03 '22 15:07 timsnyder

I'm reminded that the AMI version can mean many things... This is what I was running on:

-bash-4.2$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

timsnyder avatar Jul 03 '22 15:07 timsnyder

@timsnyder in CentOS you might need to do scl enable devtoolset-9 bash

bryanloz-xilinx avatar Jul 03 '22 16:07 bryanloz-xilinx

scl enable devtoolset-9 bash

yeah, that's right. I forgot that it is documented in the build instructions but not automated by build.sh.

timsnyder avatar Jul 03 '22 17:07 timsnyder

scl enable devtoolset-9 bash

yeah, that's right. I forgot that it is documented in the build instructions but not automated by build.sh.

You make a good point, it could easily be automated

bryanloz-xilinx avatar Jul 03 '22 17:07 bryanloz-xilinx

Okay. After remembering the devtoolset-9 activation, on Centos7, using cmake3 installed by xrtdeps.sh (verison 3.17.5), I see:

----XRT_BUILD_INSTALL_DIR=/home/centos/XRT/build/Debug/opt/xilinx/xrt
-- Configuring done
CMake Error: INSTALL(EXPORT) given unknown export "xrt-dev-targets"
-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
bash-4.2$ which cmake3
/usr/bin/cmake3
bash-4.2$ cmake3 --version
cmake3 version 3.17.5

And I think that is https://gitlab.kitware.com/cmake/cmake/-/issues/17925, resolved in cmake 3.19. Upgrading cmake to 3.19 gets further.

@stsoe at this point, it looks like we will not merge this PR but I'd still like to document any issues I encounter while trying this out and I can use this branch to try out the split packaging before rolling back the creation of XRT_STATIC_COMPONENT.

I think it's possible that XRT_STATIC_COMPONENT is causing xrt-dev-targets to be empty at a point and cause cmake to hit this edgecase but I thought it was worth documenting.

timsnyder avatar Jul 03 '22 19:07 timsnyder

@timsnyder Thanks for the effort. I would very much like to have runtime and development component supported without separation of static libraries. I don't remember what the existing hooks in XRT CMakeLists.txt files required in terms of CMake version, I only remember that modern CMake had better support, that didn't require two install() calls.

stsoe avatar Jul 03 '22 20:07 stsoe

ok to test

chvamshi-xilinx avatar Jul 04 '22 04:07 chvamshi-xilinx

Build Failed! :(

gbuildx avatar Jul 04 '22 05:07 gbuildx

@stsoe, I suppose there is not an easy way for me to see the output of your build pipeline? The link seems to point to in internal host. I'd be curious to see where it is failing because it builds for me locally.

When I get some time, I'll revert the separation of static artifacts so that only dev and runtime packages are built.

timsnyder avatar Jul 05 '22 15:07 timsnyder

@stsoe, I suppose there is not an easy way for me to see the output of your build pipeline? The link seems to point to in internal host. I'd be curious to see where it is failing because it builds for me locally.

23:05:23 CMake Error: INSTALL(EXPORT) given unknown export "xrt-dev-targets" Centos7.8, Ubuntu18/20.04, AmazonLinux

stsoe avatar Jul 05 '22 15:07 stsoe

Ahh. Thanks. That's the CMake bug I mentioned in https://github.com/Xilinx/XRT/pull/6830#issuecomment-1173161053. I had forgotten about that and it makes sense that you hit it in this build. I'll make sure to check for it when I drop back to only haveing the runtime and dev packages.

timsnyder avatar Jul 05 '22 15:07 timsnyder

Closing since we don't want separate static package.

stsoe avatar Aug 25 '22 17:08 stsoe