Skip to content

Cross compiling fixes, improvements and additions #128

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

Merged
merged 6 commits into from
Feb 18, 2022

Conversation

eigendude
Copy link
Contributor

@eigendude eigendude commented Mar 8, 2020

Description of the Change

This PR contains the build system fixes, improvements and additions broken out from #114.

Structure of the PR

The PR is organized as follows:

  1. Fixes needed for cross-compiling
  2. Improvements needed for cross-compiling

Fixes for cross-compiling

Commits:

  • CMake: Fix error including generated protobuf headers
  • Fix tinycbor include directory

These commits come first, because they address what could be considered defects. Inclusion would be valuable even if the rest of the PR is omitted. Further description is in the commit message.

Changes for cross-compiling

Commits:

These changes enable more control over the build process when embedded in another build system.

CMake is controlled by user variables; the first one we need is -DHUNTER_ENABLED=OFF so that we can have control over dependencies.

Another useful variable is -DTESTING=OFF, because embedding test infra drastically increases the up-front effort. The first two commits above allow this variable to exclude test infra from the dependency discovery in addition to the build.

Finally, I introduced a new variable: -DBUILD_INTERNAL_DEPS=OFF. This causes the in-tree dependencies to be skipped. I needed this for a build system that doesn't support git submodules. Instead, the dependencies are provided by the build sytsem.

Dependencies

How has this been tested?

Temporarily disabled proofs and ran make from Kodi's build deps. Build succeeds.

Ran make install:

make[2]: *** No rule to make target 'install'.  Stop.

Next PR will address this.

Copy link
Member

@igor-egorov igor-egorov left a comment

Choose a reason for hiding this comment

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

Looks good except the comment below

I am not approving while the review of libp2p/cpp-libp2p#59 is in progress


# https://docs.hunter.sh/en/latest/packages/pkg/Boost.html
hunter_add_package(Boost COMPONENTS date_time filesystem random system)
find_package(Boost CONFIG REQUIRED date_time filesystem random system)

# https://docs.hunter.sh/en/latest/packages/pkg/Microsoft.GSL.html
hunter_add_package(Microsoft.GSL)
find_package(Microsoft.GSL CONFIG REQUIRED)
Copy link
Member

@igor-egorov igor-egorov Mar 10, 2020

Choose a reason for hiding this comment

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

According to the Hunter docs (or here), find_package is still required.

Could you please check if the code below works in your environment?
(let's keep find_package without CONFIG)

-find_package(Microsoft.GSL CONFIG REQUIRED)
+find_package(Microsoft.GSL REQUIRED)

Copy link
Contributor Author

@eigendude eigendude Mar 10, 2020

Choose a reason for hiding this comment

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

I remember trying this line with no luck. CMake has no FindMicrosoft.GSL.cmake, but if I add an empty one, it works. The same with cppcodec - we don't use the output CPPCODEC_FOUND anywhere, I just added the pkg-config check because I noticed cppcodec provided pkg-config files.

Does Hunter do any magic by providing found package info to CMake? If I removed all find_package() calls, I suspect fuhon would still build, does this sound weird?

Copy link
Member

Choose a reason for hiding this comment

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

According to the faq, hunter_add_package(foo) will download and install foo package while find_package(foo) should only look up for files in read-only mode.

find_package is a CMake builtin function, which loads package settings. Thus, find_package looks to be required while even when hunter is not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropped this commit

@eigendude
Copy link
Contributor Author

libp2p/cpp-libp2p#59 is declared as a dependency in the PR description. I updated the bullet to a check box so we can see that the dependency is fulfilled directly from this PR.

@eigendude eigendude force-pushed the cross-compile-fixes branch 2 times, most recently from 155259e to aca6b56 Compare March 18, 2020 12:17
@eigendude
Copy link
Contributor Author

I updated libp2p/cpp-libp2p#59 and this PR. I removed all CONFIG commits. Also dropped a fix not needed after the rust BLS signature library was dropped in #129. Only 5 commits left in this PR now.

@eigendude
Copy link
Contributor Author

Is there more to do on the PR?

@eigendude eigendude force-pushed the cross-compile-fixes branch from aca6b56 to 2654e41 Compare April 5, 2020 02:27
@codecov
Copy link

codecov bot commented Apr 5, 2020

Codecov Report

Merging #128 (b7db528) into master (ad026fd) will increase coverage by 0.02%.
The diff coverage is 61.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #128      +/-   ##
==========================================
+ Coverage   46.00%   46.02%   +0.02%     
==========================================
  Files         713      715       +2     
  Lines       32293    32328      +35     
  Branches    17876    17885       +9     
==========================================
+ Hits        14855    14880      +25     
- Misses      13095    13102       +7     
- Partials     4343     4346       +3     
Impacted Files Coverage Δ
...re/markets/storage/provider/impl/provider_impl.hpp 36.84% <ø> (ø)
core/sector_storage/impl/manager_impl.hpp 33.33% <ø> (ø)
core/sector_storage/impl/remote_worker.cpp 0.00% <0.00%> (ø)
core/sector_storage/worker.hpp 62.50% <ø> (ø)
core/storage/piece/impl/piece_storage_impl.cpp 47.94% <0.00%> (-2.06%) ⬇️
...re/markets/storage/provider/impl/provider_impl.cpp 62.00% <16.66%> (-0.53%) ⬇️
core/miner/storage_fsm/impl/sealing_impl.cpp 43.37% <50.00%> (+0.04%) ⬆️
core/common/vector_cow.hpp 72.72% <72.72%> (ø)
core/sector_storage/impl/manager_impl.cpp 61.04% <75.00%> (+0.40%) ⬆️
core/sector_storage/impl/local_worker.cpp 71.14% <87.50%> (+0.14%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f37400...b7db528. Read the comment docs.

@igor-egorov
Copy link
Member

Hi @eigendude and sorry for the long waiting
It looks the time to merge the pr has come!
Could you please update the pr and resolve the merge conflicts?

@igor-egorov igor-egorov requested a review from turuslan November 17, 2020 15:26
@eigendude
Copy link
Contributor Author

Upstream libp2p/cpp-libp2p#59 has been merged! I plan to rebase this sometime before the end of the year.

@eigendude eigendude force-pushed the cross-compile-fixes branch 2 times, most recently from 975417f to 67460ed Compare February 16, 2022 16:24
@eigendude
Copy link
Contributor Author

Back from the dead! I rebased the PR and compile-tested. I dropped the tinycbor header change, it's no longer needed. I also added a commit removing the c-ares CMake declaration, as I can't find a use throughout the codebase.

Garrett Brown added 5 commits February 16, 2022 08:33
This change shuffles the order of several CMake steps to expose CMake
options to included files.

By defining options before inclusion, included files are able to access
the input provided by the build system.
When building without tests, GTest and GMock are not needed. This change
allows build systems to continue with filecoin compilation without devoting
resources to its testing infrastructure.
Not every build system can handle git submodules, so expose an option to
exclude these dependencies from the build
When building without Hunter, it is desirable to pass the path to
protoc and the protobuf include directory from the build system.
Allow these variables to be overridden.
@turuslan turuslan merged commit 03fd9bd into filecoin-project:master Feb 18, 2022
@eigendude eigendude deleted the cross-compile-fixes branch February 18, 2022 15:08
Markuu-s pushed a commit that referenced this pull request Mar 10, 2022
Markuu-s pushed a commit that referenced this pull request Mar 10, 2022
Markuu-s pushed a commit that referenced this pull request Mar 10, 2022
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