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

find_package with Boost not working... #7

Closed
MichaelVoelkel opened this issue Dec 12, 2021 · 6 comments
Closed

find_package with Boost not working... #7

MichaelVoelkel opened this issue Dec 12, 2021 · 6 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@MichaelVoelkel
Copy link

MichaelVoelkel commented Dec 12, 2021

Hi,

thanks for the other answer, it was really helpful!

I have tried for some time getting this to run with CMake find_package Boost now on a Windows runner (windows-latest), but encounter some problems. I see in stage/lib that there are tons of lib files after your download action, which is great. But providing BOOST_ROOT into CMake does not seem to be enough for find_package to actually find boost (in particular, I have find_package(Boost REQUIRED thread)). It will always tell me:

Could NOT find Boost (missing: Boost_INCLUDE_DIR thread)

Trying to run find_package in debug did not really help because it just gave tons of output that it looked for tons of specific boost lib files...

I also checked that BOOST_ROOT is really in CMake (used message to give me own debug output), but it was correctly set...

Any idea? This is probably on this damn cmake find_package but maybe I get lucky here...

Edit:
Hm, running it on a bare repository gives:

See also "D:/a/github-action-tests/github-action-tests/build/CMakeFiles/CMakeOutput.log".
29
  considered to be NOT FOUND.  Reason given by package:
30

31
  No suitable build variant has been found.
32

33
  The following variants have been tried and rejected:
34

35
  * libboost_thread-vc141-mt-gd-x32-1_72.lib (32 bit, need 64)
36

37
  * libboost_thread-vc141-mt-gd-x64-1_72.lib (vc141, detected vc142, set
38
  Boost_COMPILER to override)
39

40
  * libboost_thread-vc141-mt-x32-1_72.lib (32 bit, need 64)
41

42
  * libboost_thread-vc141-mt-x64-1_72.lib (vc141, detected vc142, set
43
  Boost_COMPILER to override)

Should I use legacy to actually bump the compiler version with toolset?

@MarkusJx
Copy link
Owner

I am assuming you are using msvc 14.1 which is not supported by my own prebuilt boost versions as this compiler is slowly becoming obsolete (or is it?). But yes, I would also suggest using the legacy setting as actions/boost-versions can supply boost compiled using msvc 14.1 up to version 1.73.0, so your actions.yml may look like this:

- name: Install boost
  uses: MarkusJx/install-boost@v2.0.0
  with:
    boost_version: 1.72.0
    # You'll need this:
    version: legacy
    # And this:
    toolset: msvc14.2

But if you need newer boost versions, I'll suggest either updating to msvc 14.2 or if you really depend on msvc 14.1, let me know, I could make that work using my own repository.

@MarkusJx MarkusJx added documentation Improvements or additions to documentation question Further information is requested labels Dec 12, 2021
@MichaelVoelkel
Copy link
Author

Hmm, I have not changed anything with relation to the compiler version and the messages seem to indicate that the downloaded boost files are 14.1..? My compiler is actually 14.2 and CMake configure also shows this. Probably, I am just reading it wrong, but from where do you get the information that I use 14.1? Anyway, I will try with legacy+toolset (although this again seems to rather tell your action that 14.2 should be used instead of 14.1, indicating that I already use 14.2 but the download is wrong? bit confused here :) )

@MarkusJx
Copy link
Owner

Oh, so you are using msvc 14.2? In that case this should work fine but for some reason your cmake seems to search for boost compiled using msvc 14.1, which is weird...

@MichaelVoelkel
Copy link
Author

I created a sample repository and there the job is failed, might be easier to see this way :) Maybe, I'm just doing something stupid:
https://github.com/MichaelVoelkel/github-action-tests
https://github.com/MichaelVoelkel/github-action-tests/runs/4497347273?check_suite_focus=true

@MarkusJx
Copy link
Owner

MarkusJx commented Dec 12, 2021

Found the issue.
This action uses boost built for windows server 2016 by default but you were using windows server 2019 (windows-latest).
Windows server 2016 (the github-hosted runners) ships with msvc 14.1, while windows server 2019 ships with msvc 14.2, which was causing your issue.

So I've just changed

- name: Install boost
  uses: MarkusJx/install-boost@v2.0.0
  id: install-boost
  with:
    boost_version: 1.72.0

to

- name: Install boost
  uses: MarkusJx/install-boost@v2.0.0
  id: install-boost
  with:
    boost_version: 1.72.0
    platform_version: 2019

adding the platform_version argument.

I should add this to the readme or let the action figure out the runner's os version.
Edit: The versions built for windows server 2019 do even work for windows server 2022, which is nice.

@MichaelVoelkel
Copy link
Author

Great! Thanks for taking the time, I also tested it on my repository and seems to work!! Will try on my "real repository" soon, hopefully it will work there, too.
Have a nice Sunday!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants