CPP: Fix cmake build failure + export libphonenumber-config.cmake#2818
CPP: Fix cmake build failure + export libphonenumber-config.cmake#2818penmetsaa merged 9 commits intogoogle:masterfrom
Conversation
…library without creating a FindLibPhonenumber
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Hey, @penmetsaa! Just checking in, have you been able to review this? |
|
Hi @temideoye , Thanks so much for your patience. We are planning to review this in next 4 weeks. |
|
|
||
| project (generate_geocoding_data) | ||
|
|
||
| # Helper functions dealing with finding libraries and programs this library |
There was a problem hiding this comment.
As we have moved the download functionality to main library's CMAKE, we were unable to build the offline geocoder individually. Could we not remove this from here OR have this as a common build rule file?
CMake Error at CMakeLists.txt:39 (target_link_libraries):
Target "generate_geocoding_data" links to:
absl::strings
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Note: I am not expertise in CPP builds, please suggest and do what you think is best :)
There was a problem hiding this comment.
Can we do anything about this..?
There was a problem hiding this comment.
@penmetsaa, I had assumed (erroneously) that tools/cpp is merely a dependency of the main project, but now I understand you build it independently for other purposes as well.
There are 2, or 3 possible ways to resolve this:
- Copy the find abseil functions back to tools/cpp. The demerit of this is obviously the maintenance overhead.
- Create a new shared cmake module for the find abseil functions. This is DRYer than 1, but still a bit of a dance.
- Build tools/cpp via the main project with an option like
-DBUILD_TOOLS_ONLY=ON. This should simplify the interface in that all dependency resolutions happen in the same file. It would be my preference too.
I will share a pull request in a moment. Let me know if it works for you, or if you'd rather resolve it a different way.
| option (USE_LITE_METADATA "Use lite metadata" OFF) | ||
| option (USE_RE2 "Use RE2" OFF) | ||
| option (USE_STD_MAP "Force the use of std::map" OFF) | ||
| option (BUILD_STATIC_LIB "Build static libraries" ON) |
There was a problem hiding this comment.
About these new options, could you please add some notes in cpp/README file.
It helps readers to know about these options.
penmetsaa
left a comment
There was a problem hiding this comment.
Thanks so much for meticulous work.
Mentioned some minor suggestions / doubts I have, please take a look. :)
|
Hiya, @penmetsaa. I've gone through your comments. Thanks. First, it looks like you ran your tests against each of the commits in the pull request. Only the last commit is designed to be whole and complete, please limit your test to that. The preceding commits are mostly of documentary value and not guaranteed to be stable. If you could test the repo at this point, I expect it to build without errors with the only necessary change being bumping the version number to 8.13.0. Please confirm and let me know. With regards to the readme; sure I'm happy to send a pull request that documents what's new. Happy new year! |
|
Thanks! +1 to what you mentioned.. Some pending AIs:
|
|
Hi, Is this something related to https://stackoverflow.com/questions/5378528/install-export-problem-for-library-with-dependencies, should we link_libraries?, if not feasible to export these external deps.. |
|
@penmetsaa, that looks like cmake couldn't find your abseil lib directory. Do you have the installation path of abseil in CMAKE_PREFIX_PATH? You may try something like |
|
Hi @temideoye
Is it that after the change, the cached abseil binaries are not been able to found? |
|
Oh dang, I see what you mean. The issue seems to be that abseil disables its install rules in superbuilds: Setting |
|
@penmetsaa, I've added a fix for the install errors to 2869. Let me know if it resolves the issue for you. |
|
Thanks much for the patch @temideoye.. |
| "test_metadata" | ||
| "metadata" |
There was a problem hiding this comment.
this rename conflicts with the metadata.h generated above in the non-test METADATA_TARGET. they both output a metadata.h like this, which means the build has two rules that generate the same output file (one for metadata_target, and one for test_metadata_target).
this breaks the build for cmake -G Ninja, because the .ninja spec forbids two distinct rules for the same output:
$ ninja -C build/
ninja: entering directory 'build/'
ninja: multiple rules generate '/home/demon/src/aports/community/libphonenumber/src/libphonenumber-8.13.4/cpp/src/phonenumbers/metadata.h'There was a problem hiding this comment.
@nekopsykose, thanks for the catch. The bug was fixed here, but was reintroduced by a clumsy merge. @penmetsaa, will send in a quick pull request to restore the fix if that's OK.
|
Thanks for correcting the thing that we overlooked @nekopsykose and @temideoye. Merged the #2874 PR |
|
@penmetsaa thanks! |
Currently, the project fails to build when
BUILD_GEOCODER=OFFdue to a missing dependency. The issue is described here. This push fixes the bug and proposes the following additional features to enhance the CMake build process overall:BUILD_SHARED_LIBSandBUILD_TESTINGas user configurable optionsfind_package(libphonenumber), without creating a FindLibPhonenumber.cmake file