-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[liblas] Fix missing dependency to boost-foreach #30950
[liblas] Fix missing dependency to boost-foreach #30950
Conversation
0cdca95
to
d24203b
Compare
Has this been submitted upstream? |
|
||
find_package(Threads) | ||
-find_package(Boost 1.42 COMPONENTS program_options thread system iostreams filesystem REQUIRED) | ||
+find_package(Boost 1.42 COMPONENTS program_options thread system iostreams REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need something about foreach here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah indeed. Tried bcp
and boostdep
to check what we really need here, but unfortunately the tools don't seem to be suitable for checking what is needed in foreign code or I didn't find the right options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, seems not be required within the list:
CMake Warning at C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:2218 (message):
No header defined for foreach; skipping header check (note: header-only
libraries have no designated component)
usage:
When testing usage, the following error occurs:
CMakeFindUsage.cpp#include <iostream> #include "liblas.h" CMakeLists.txtcmake_minimum_required (VERSION 3.8) Edit: But it is not caused by this PR. |
Not so far. I added the patch after the fact, because I first only adjusted the dependencies and only saw through the CI that in the CMake file still unneeded modules are requested. Unfortunately, the 1.8.1 tag is so old that it is probably a completely new research on the required modules. |
Upstream: https://github.com/libLAS/libLAS/issues Did you notify upstream in any way? |
b942d6a
to
0d83ded
Compare
Patch submitted there now as the includes didn't changed much: libLAS/libLAS#221 @MonicaLiu0311: I could reproduce your issue. It seems to be the same issue like here: #8104 As this only happens when compiling with vcpkg it seems to be a vcpkg issue and no libLAS issue (compiling libLAS without vcpkg: Sadly it still doesn't work. I'm now getting:
The source within libLAS (@v1.8.1): get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
get_filename_component (PROJECT_ROOT_DIR "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE)
set (libLAS_INCLUDE_DIRS "${PROJECT_ROOT_DIR}/include")
set (libLAS_LIBRARY_DIRS "${PROJECT_ROOT_DIR}/lib")
set (libLAS_BINARY_DIRS "${PROJECT_ROOT_DIR}/bin")
include ("${_DIR}/liblas-depends.cmake") This is still correct within After applying the patch get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
get_filename_component (PROJECT_ROOT_DIR "${_DIR}/.." ABSOLUTE)
set (libLAS_INCLUDE_DIRS "${PROJECT_ROOT_DIR}/include")
set (libLAS_LIBRARY_DIRS "${PROJECT_ROOT_DIR}/lib")
set (libLAS_BINARY_DIRS "${PROJECT_ROOT_DIR}/bin")
include(CMakeFindDependencyMacro)
find_dependency(GeoTIFF CONFIG)
include ("${CMAKE_CURRENT_LIST_DIR}/liblas-depends.cmake") But somehow after libLAS is compiled, the file looks like: get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
get_filename_component (PROJECT_ROOT_DIR "${_DIR}/../.." ABSOLUTE)
set (libLAS_INCLUDE_DIRS "${PROJECT_ROOT_DIR}/include")
set (libLAS_LIBRARY_DIRS "${PROJECT_ROOT_DIR}$<$<CONFIG:DEBUG>:/debug>/lib")
set (libLAS_BINARY_DIRS "${PROJECT_ROOT_DIR}/tools/liblas")
include(CMakeFindDependencyMacro)
find_dependency(GeoTIFF CONFIG)
include ("${CMAKE_CURRENT_LIST_DIR}$<$<CONFIG:DEBUG>:/debug>/liblas-depends.cmake") Seems the following call is wrong vcpkg/ports/liblas/portfile.cmake Line 47 in 501db0f
Sadly #29259 seems to be not fully tested. Added a patch for this now - not sure whether Now CMake runs fine - sadly libLAS doesn't define a modern imported target, therefore the usage file needed an adjustment too (tested via including |
63aada4
to
3b83dd5
Compare
+set(Boost_HeaderOnly_Required_Components foreach interprocess lambda property_tree uuid) | ||
+foreach(COMPONENT ${Boost_HeaderOnly_Required_Components}) | ||
+ if(EXISTS "${Boost_INCLUDE_DIR}/${COMPONENT}") | ||
+ message(FATAL_ERROR "Header-only component \"${COMPONENT}\" of Boost is required but could not be found!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it must be wrong: if it does exist you're emitting an error saying it does not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix sadly just worked for the downloaded Boost version, but would not work here. So it is now just a comment now.
+ endif() | ||
+endforeach() | ||
+ | ||
+include_directories(${Boost_INCLUDE_DIRS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is certainly wrong, it should be added by a target_link_libraries
to add Boost::boost
(or Boost::headers
) somewhere instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libLAS requires still just CMake 2.8.12, so you imported targets are still not supported (requires CMake 3.5). They are doing later target_link_libraries(${LIBLAS_LIB_NAME} ... ${Boost_LIBRARIES})
.
As the change related include_directories
doesn't have any effect and is just to cleanup the code, I could remove the change and just submit this to the libLAS repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally for the patch we are tracking we should be making the minimum change that makes it work inside vcpkg, unless we are applying an exact change upstream did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the same patch as I commited here: libLAS/libLAS#221
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the same patch as I commited here: libLAS/libLAS#221
Upstream seems responsive so going to give them some time to consider/merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is merged there.
3d16001
to
581ea8a
Compare
@@ -0,0 +1,16 @@ | |||
diff --git a/cmake/liblas-config-version.cmake.in b/cmake/liblas-config-version.cmake.in | |||
index f9b7c7cb..3ecf3ef8 100644 | |||
--- a/cmake/liblas-config-version.cmake.in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain where this change came from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this entry: #30950 (comment), where I have also noted from where I copied this solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MonicaLiu0311: I could reproduce your issue. It seems to be the same issue like here: #8104 As this only happens when compiling with vcpkg it seems to be a vcpkg issue and no libLAS issue (compiling libLAS without vcpkg: CMAKE_CROSSCOMPILING is replaced by FALSE; compiling libLAS via vcpkg: CMAKE_CROSSCOMPILING is replaced by OFF). Therefore added a similar patch.
FALSE and OFF are both 'falsy' as far as CMake is concerned. It looks like this config is just broken by trying to use STREQUAL for a boolean test.
Importantly, this patch breaks what upstream is trying to do, since if CMAKE_CROSSCOMPILING is true when building the thing, the test is damaged.
It seems the correct fix is:
-elseif (NOT CMAKE_CROSSCOMPILING STREQUAL "@CMAKE_CROSSCOMPILING@")
+elseif (NOT CMAKE_CROSSCOMPILING EQUAL "@CMAKE_CROSSCOMPILING@")
and the line below should not be messed with at all since it's just logging output and it should record the real values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternately, if EQUAL
does not work becuase that wants them to be numbers it needs to be built out of boolean tests, like:
-elseif (NOT CMAKE_CROSSCOMPILING STREQUAL "@CMAKE_CROSSCOMPILING@")
+elseif ((CMAKE_CROSSCOMPILING AND NOT "@CMAKE_CROSSCOMPILING@")
+ OR (NOT CMAKE_CROSSCOMPILING AND "@CMAKE_CROSSCOMPILING@"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EQUAL
works indeed not (like expected):
set(varOff OFF)
set(varFALSE FALSE)
if(varOFF)
message("varOff: true")
else()
message("varOff: false")
endif()
if(varFALSE)
message("varFALSE: true")
else()
message("varFALSE: false")
endif()
if(OFF EQUAL FALSE)
message("Equal")
else()
message("Not equal")
endif()
Returned:
varOff: false
varFALSE: false
Not equal
Btw: Die real fix would be to fix vcpkg, as :
cmake_minimum_required(VERSION 3.15)
project(...)
message(${CMAKE_CROSSCOMPILING})
Returns FALSE
and not OFF
, but somehow vcpkg sets this variable to OFF
. So we wouldn't need a fix here, when vcpkg would do it correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this particular elseif
can be simplified to elseif(0)
. Its benefit is close to zero in a vcpkg triplet universe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BillyONeal I created a separate issue for this, as I think it is better, when this issue is fixed in vcpkg #31209
@dg0yt: As I have not set up cross compilation locally, I can't say anything about it since I can't really test it and have no experience with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns FALSE and not OFF, but somehow vcpkg sets this variable to OFF. So we wouldn't need a fix here, when vcpkg would do it correct.
CMAKE_CROSSCOMPILING
is documented as being 'boolish' so all of 0
, OFF
, NO
, FALSE
, N
, and IGNORE
are acceptable and equivalent, see https://cmake.org/cmake/help/latest/command/if.html#basic-expressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I agree with @dg0yt in that making this elseif(0)
could be fine. Just acting like CMAKE_CROSSCOMPILING is always false, even when it is actually true as in e.g. x64-uwp, is not the correct fix)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to the elseif(0)
patch
The usage test passed (header files found):
|
Dropping the upstream changes tag because they merged it. I did respond about the CMAKE_CROSSCOMPILING patch because that does not look correct to me. |
581ea8a
to
0afe350
Compare
Tried to update our manifest file and got a compile issue on liblas:
Also removed unnecessary dependency (searched the code via
#include.*boost
to check which boost modules are really required).This issue can reproduced on the current master by calling
vcpkg install liblas
./vcpkg x-add-version --all
and committing the result.