Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] prebuild set CMAKE_PREFIX_PATH properly #1154

Merged
merged 7 commits into from
Oct 11, 2024
Merged

Conversation

TingDaoK
Copy link
Contributor

@TingDaoK TingDaoK commented Oct 10, 2024

Issue #, if available:

 -- XXXXXXXXXXXX depBinaryDir /root/aws-crt-cpp/build/aws-crt-cpp/deps/S2N
CMake Warning:
  Ignoring extra path from command line:

   "/root/aws-crt-cpp/build/install"

cmakeCommand /usr/bin/cmake;-S;/root/aws-crt-cpp/crt/s2n;
-DCMAKE_BUILD_TYPE=RelWithDebInfo;
-DCMAKE_PREFIX_PATH=/root/aws-crt-cpp/build/aws-crt-cpp/deps/AWSLC/install/;/root/aws-crt-cpp/build/install;
-DCMAKE_INSTALL_PREFIX=/root/aws-crt-cpp/build/aws-crt-cpp/deps/S2N/install;
-DCMAKE_INSTALL_RPATH=;
-DBUILD_SHARED_LIBS=;
-DUNSAFE_TREAT_WARNINGS_AS_ERRORS=OFF;
-DBUILD_TESTING=OFF

After more digging

  • It's not random, it's from some other CMAKE_PREFIX_PATH
  • We add the new install path to the CMAKE_PREFIX_PATH, so the CMAKE_PREFIX_PATH is now a list
  • We add CMAKE_PREFIX_PATH variable into the list of args to call for Cmake execute_process, it seems like based on the version of CMAKE, cmake sometimes confuses about those values. And treat the second value in the CMAKE_PREFIX_PATH list as a separate args for cmake to take.
  • You can see -DCMAKE_PREFIX_PATH=/root/aws-crt-cpp/build/aws-crt-cpp/deps/AWSLC/install/;/root/aws-crt-cpp/build/install; I assume some version of cmake just took it as -DCMAKE_PREFIX_PATH=/root/aws-crt-cpp/build/aws-crt-cpp/deps/AWSLC/install/ and /root/aws-crt-cpp/build/install
  • I tried a lot different way to set the CMAKE_PREFIX_PATH properly, and MOST failed.
  • I have to set the environment variable of CMAKE_PREFIX_PATH instead of passing it to as the commend line args for Cmake, which seems to work.

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TingDaoK TingDaoK changed the title Try to fixprebuild [fix] prebuild set build path explicitly Oct 10, 2024
@TingDaoK TingDaoK changed the title [fix] prebuild set build path explicitly [fix] prebuild set CMAKE_PREFIX_PATH properly Oct 10, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.84%. Comparing base (6978946) to head (7310e92).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1154   +/-   ##
=======================================
  Coverage   83.84%   83.84%           
=======================================
  Files          57       57           
  Lines        5992     5993    +1     
=======================================
+ Hits         5024     5025    +1     
  Misses        968      968           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

else()
list(JOIN CMAKE_PREFIX_PATH ":" PREFIX_PATH_ENV_VAR)
endif()
set(ENV{CMAKE_PREFIX_PATH} ${PREFIX_PATH_ENV_VAR})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing an environment variable seems like trouble
try to find a way to continue passing this as arguments
can do something to convince cmake more strongly that we want to treat this as a string, not a list

if(WIN32)
list(JOIN CMAKE_PREFIX_PATH ";" PREFIX_PATH_ENV_VAR)
else()
list(JOIN CMAKE_PREFIX_PATH ":" PREFIX_PATH_ENV_VAR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list(JOIN) is cmake 3.12+

cmake/AwsPrebuildDependency.cmake Outdated Show resolved Hide resolved
cmake/AwsPrebuildDependency.cmake Outdated Show resolved Hide resolved
cmake/AwsPrebuildDependency.cmake Outdated Show resolved Hide resolved
Co-authored-by: Michael Graeb <graebm@amazon.com>
@TingDaoK TingDaoK enabled auto-merge (squash) October 11, 2024 21:50
@TingDaoK TingDaoK merged commit f8c5d8e into main Oct 11, 2024
53 checks passed
@TingDaoK TingDaoK deleted the try-to-fixprebuild branch October 11, 2024 22:08
graebm added a commit that referenced this pull request Oct 14, 2024
Co-authored-by: Michael Graeb <graebm@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants