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

[alicevision] Add new port #38034

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Conversation

JackBoosY
Copy link
Contributor

@JackBoosY JackBoosY commented Apr 8, 2024

Continue PR #8829

Fixes #8819.
Related: alicevision/AliceVision#767

@WangWeiLin-MV WangWeiLin-MV self-assigned this Apr 8, 2024
@WangWeiLin-MV WangWeiLin-MV added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Apr 8, 2024
@JackBoosY
Copy link
Contributor Author

Waiting for liblzma issue to be fixed.

@JackBoosY
Copy link
Contributor Author

JackBoosY commented Apr 8, 2024

CMake Error at /Users/vcpkg/Data/installed/x64-osx/share/openimageio/OpenImageIOTargets.cmake:71 (set_target_properties):
  The link interface of target "OpenImageIO::OpenImageIO" contains:

    lcms2::lcms2

  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.

Call Stack (most recent call first):
  /Users/vcpkg/Data/installed/x64-osx/share/openimageio/OpenImageIOConfig.cmake:118 (include)
  /Users/vcpkg/Data/work/1/s/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
  src/CMakeLists.txt:333 (find_package)

@WangWeiLin-MV can you plz check whether find_package(lcms2) is in OpenImageIOConfig.cmake (non-Windows)?

@JackBoosY
Copy link
Contributor Author

Depends on #38071

@JackBoosY
Copy link
Contributor Author

@fabiencastan Can you please review this PR?

@JackBoosY JackBoosY marked this pull request as ready for review April 13, 2024 05:42
Copy link
Contributor

@WangWeiLin-MV WangWeiLin-MV left a comment

Choose a reason for hiding this comment

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

Indent needs to be unified for portfile.cmake.

ports/alicevision/portfile.cmake Outdated Show resolved Hide resolved
ports/alicevision/portfile.cmake Show resolved Hide resolved
ports/alicevision/portfile.cmake Show resolved Hide resolved
@JackBoosY
Copy link
Contributor Author

Waiting for the upstream review this PR.

@fabiencastan
Copy link
Contributor

Is there a problem to enable the SFM? It's at the core of alicevision, so it will limit a lot the usage.

Copy link
Contributor

@simogasp simogasp left a comment

Choose a reason for hiding this comment

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

just a few remarks

ports/alicevision/portfile.cmake Show resolved Hide resolved
ports/alicevision/portfile.cmake Outdated Show resolved Hide resolved
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DALICEVISION_BUILD_SFM=OFF
-DALICEVISION_BUILD_MVS=ON
Copy link
Contributor

Choose a reason for hiding this comment

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

This on the other hand can be ON or OFF depending on the availability of CUDA (related to ALICEVISION_USE_CUDA) and GPU on the machine. Maybe we can leave it as a documentation note, the user might be able to build but not to execute without an NVidia card

ports/alicevision/portfile.cmake Outdated Show resolved Hide resolved
@fabiencastan
Copy link
Contributor

@JackBoosY have you seen the review from @simogasp ?

@JackBoosY
Copy link
Contributor Author

@fabiencastan vacation now, will continue this PR several days later.

@JackBoosY
Copy link
Contributor Author

JackBoosY commented May 5, 2024

@fabiencastan Alicevision does not provide FindCoinUtils.cmake, so how can we find coinutils by cmake now?
I saw coinutils is adding cmake support in coin-or/CoinUtils#101 but not land.

Edit: I saw a copy of FindCoinUtils.cmake in https://github.com/open-anatomy/SfM_gui_for_openMVG/blob/master/src/cmakeFindModules/FindCoinUtils.cmake, no idea whether we can use this with license.

@fabiencastan
Copy link
Contributor

Currently we are using a fork: https://github.com/alicevision/CoinUtils/commits/av_develop/
with all the cmake stuff.

There is also another PR on the official coinutils that has not been merged to add cmake.

The best would be to get something merged and maybe in the meantime add the cmage config in the vcpkg patch of coinuils.

@JackBoosY
Copy link
Contributor Author

Currently we are using a fork: https://github.com/alicevision/CoinUtils/commits/av_develop/ with all the cmake stuff.

There is also another PR on the official coinutils that has not been merged to add cmake.

The best would be to get something merged and maybe in the meantime add the cmage config in the vcpkg patch of coinuils.

Since such ports now use makefile, we may need to wait for the upstream PRs or add vcpkg-wrapper & Find.cmake.

@simogasp
Copy link
Contributor

simogasp commented May 5, 2024

Currently we are using a fork: https://github.com/alicevision/CoinUtils/commits/av_develop/ with all the cmake stuff.
There is also another PR on the official coinutils that has not been merged to add cmake.
The best would be to get something merged and maybe in the meantime add the cmage config in the vcpkg patch of coinuils.

Since such ports now use makefile, we may need to wait for the upstream PRs or add vcpkg-wrapper & Find.cmake.

That's unfortunate because we moved to that fork cmake-based system (we used the CMakeLists from vcpkg at that time) hoping that someday the official repos would also move to cmake. Since we use vcpkg for the Windows CI it also made sense.

How do you consume those libs built with make in vcpkg now in a project with cmake? Do you have to provide your own FindX.cmake?

@JackBoosY
Copy link
Contributor Author

How do you consume those libs built with make in vcpkg now in a project with cmake? Do you have to provide your own FindX.cmake?

Yeah we currently may pick one of two ways:

  • The cmake build system, based on alincevision provided or the upstream PRs.
  • I got some Find.cmake files in github, we can use them and each related vcpkg-cmake-wrapper.

@simogasp
Copy link
Contributor

simogasp commented May 5, 2024

How do you consume those libs built with make in vcpkg now in a project with cmake? Do you have to provide your own FindX.cmake?

Yeah we currently may pick one of two ways:

  • The cmake build system, based on alincevision provided or the upstream PRs.
  • I got some Find.cmake files in github, we can use them and each related vcpkg-cmake-wrapper.

ok, but I meant more generally, if your project is cmake-based, how are you supposed to import a library built using vcpkg_configure_make()? Vcpkg was meant to use cmake as it was easy then to import the libs through the cmake targets (whether the orig repo provided them or not). How is it now, you need to deal with that part for those libraries built with make?

@JackBoosY
Copy link
Contributor Author

ok, but I meant more generally, if your project is cmake-based, how are you supposed to import a library built using vcpkg_configure_make()? Vcpkg was meant to use cmake as it was easy then to import the libs through the cmake targets (whether the orig repo provided them or not). How is it now, you need to deal with that part for those libraries built with make?

  • Use make system, provide vcpkg-cmake-wrapper.cmake and FindXXX.cmake adapt to the generated files.
  • Switch to cmake system and export the cmake targets.

@Neumann-A
Copy link
Contributor

@simogasp:

  • if the build system generates pc files use FindPkgConfig.cmake
  • otherwise create a FindXXX.cmake in your project for XXX you want to use and manually use find_library. Use the result to setup targets for XXX etc. which then can be used downstream.

@JackBoosY
Copy link
Contributor Author

JackBoosY commented May 6, 2024

I resolved the coinutils / clp /osi couldn't be found issue using pkgconfig, but got new issue about boost:

[312/564] E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe   /TP -DALICEVISION_EIGEN_REQUIRE_ALIGNMENT=1 -DBOOST_ALL_DYN_LINK -DBOOST_BIND_GLOBAL_PLACEHOLDERS=1 -DBOOST_TEST_DYN_LINK -DGFLAGS_IS_A_DLL=1 -DGLOG_NO_ABBREVIATED_SEVERITIES -DGLOG_USE_GFLAGS -DGLOG_USE_GLOG_EXPORT -DIMATH_DLL -DNOMINMAX -D_USE_MATH_DEFINES -D__SSE2__ -D__SSE3__ -D__SSSE3__ -DaliceVision_mvsUtils_EXPORTS -IJ:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src -IJ:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\generated -IJ:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\dependencies -IJ:\vcpkg_commit\vcpkg\installed\x64-windows\share\lemon\..\..\include -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\eigen3 -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\debug\..\include\coin-or -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\debug\..\include\openblas -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\Imath -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\suitesparse -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\GKlib -external:W0 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP  /Zc:alignedNew -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -std:c++17 /bigobj /MP /EHsc /Zc:__cplusplus /showIncludes /Fosrc\aliceVision\mvsUtils\CMakeFiles\aliceVision_mvsUtils.dir\mapIO.cpp.obj /Fdsrc\aliceVision\mvsUtils\CMakeFiles\aliceVision_mvsUtils.dir\ /FS -c J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp
FAILED: src/aliceVision/mvsUtils/CMakeFiles/aliceVision_mvsUtils.dir/mapIO.cpp.obj 
E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe   /TP -DALICEVISION_EIGEN_REQUIRE_ALIGNMENT=1 -DBOOST_ALL_DYN_LINK -DBOOST_BIND_GLOBAL_PLACEHOLDERS=1 -DBOOST_TEST_DYN_LINK -DGFLAGS_IS_A_DLL=1 -DGLOG_NO_ABBREVIATED_SEVERITIES -DGLOG_USE_GFLAGS -DGLOG_USE_GLOG_EXPORT -DIMATH_DLL -DNOMINMAX -D_USE_MATH_DEFINES -D__SSE2__ -D__SSE3__ -D__SSSE3__ -DaliceVision_mvsUtils_EXPORTS -IJ:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src -IJ:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\generated -IJ:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\dependencies -IJ:\vcpkg_commit\vcpkg\installed\x64-windows\share\lemon\..\..\include -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\eigen3 -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\debug\..\include\coin-or -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\debug\..\include\openblas -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\Imath -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\suitesparse -external:IJ:\vcpkg_commit\vcpkg\installed\x64-windows\include\GKlib -external:W0 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP  /Zc:alignedNew -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -std:c++17 /bigobj /MP /EHsc /Zc:__cplusplus /showIncludes /Fosrc\aliceVision\mvsUtils\CMakeFiles\aliceVision_mvsUtils.dir\mapIO.cpp.obj /Fdsrc\aliceVision\mvsUtils\CMakeFiles\aliceVision_mvsUtils.dir\ /FS -c J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/mvsData/ROI.hpp(148): warning C4244: 'argument': conversion from 'float' to 'unsigned int', possible loss of data
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/mvsData/ROI.hpp(148): warning C4244: 'argument': conversion from 'float' to 'unsigned int', possible loss of data
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/mvsData/ROI.hpp(159): warning C4244: 'argument': conversion from 'float' to 'unsigned int', possible loss of data
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/mvsData/ROI.hpp(159): warning C4244: 'argument': conversion from 'float' to 'unsigned int', possible loss of data
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/mvsData/ROI.hpp(172): warning C4244: 'argument': conversion from 'float' to 'unsigned int', possible loss of data
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/mvsData/ROI.hpp(172): warning C4244: 'argument': conversion from 'float' to 'unsigned int', possible loss of data
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/prettyprint.hpp(489): warning C4099: 'Eigen::EigenBase': type name first seen using 'struct' now seen using 'class'
J:\vcpkg_commit\vcpkg\installed\x64-windows\include\Eigen\src/Core/EigenBase.h(30): note: see declaration of 'Eigen::EigenBase'
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/mvsUtils/MultiViewParams.hpp(161): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/image/io.hpp(24): warning C4099: 'aliceVision::rgb': type name first seen using 'struct' now seen using 'class'
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision/image/Rgb.hpp(11): note: see declaration of 'aliceVision::rgb'
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp(145): error C2039: 'make_iterator_range': is not a member of 'boost'
J:\vcpkg_commit\vcpkg\installed\x64-windows\include\boost/regex/v5/regex_split.hpp(24): note: see declaration of 'boost'
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp(145): error C2530: 'entry': references must be initialized
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp(145): error C3531: 'entry': a symbol whose type contains 'auto' must have an initializer
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp(145): error C2143: syntax error: missing ';' before ':'
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp(145): error C3861: 'make_iterator_range': identifier not found
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp(145): error C2143: syntax error: missing ';' before ')'
J:\vcpkg_commit\vcpkg\buildtrees\alicevision\src\v3.2.0-4ba1530adf\src\aliceVision\mvsUtils\mapIO.cpp(147): error C2672: 'boost::regex_match': no matching overloaded function found

AFAIK, make_iterator_range should in boost-range right? But I couldn't find it in find_package(Boost).

@fabiencastan
Copy link
Contributor

The error seems to come from Boost::regex which is missing here:
https://github.com/alicevision/AliceVision/blob/develop/src/aliceVision/mvsUtils/CMakeLists.txt#L32

@JackBoosY
Copy link
Contributor Author

The error seems to come from Boost::regex which is missing here: https://github.com/alicevision/AliceVision/blob/develop/src/aliceVision/mvsUtils/CMakeLists.txt#L32

No, boost-regex was already added into dependencies and found in
https://github.com/alicevision/AliceVision/blob/4eb30dfa3c9054de183e335f08c21c4536cb52aa/src/CMakeLists.txt#L287

@JackBoosY
Copy link
Contributor Author

make_iterator_range should be included in boost-range, no idea whether it caused by the boost update their code.

@fabiencastan
Copy link
Contributor

No, boost-regex was already added into dependencies and found in https://github.com/alicevision/AliceVision/blob/4eb30dfa3c9054de183e335f08c21c4536cb52aa/src/CMakeLists.txt#L287

In the find_package, we list all the modules that we will need globally in the project, but then we need to list the boost modules that we are using in each element, like here:
https://github.com/alicevision/AliceVision/blob/4eb30dfa3c9054de183e335f08c21c4536cb52aa/src/aliceVision/calibration/CMakeLists.txt#L34

@JackBoosY
Copy link
Contributor Author

No, boost-regex was already added into dependencies and found in https://github.com/alicevision/AliceVision/blob/4eb30dfa3c9054de183e335f08c21c4536cb52aa/src/CMakeLists.txt#L287

In the find_package, we list all the modules that we will need globally in the project, but then we need to list the boost modules that we are using in each element, like here: https://github.com/alicevision/AliceVision/blob/4eb30dfa3c9054de183e335f08c21c4536cb52aa/src/aliceVision/calibration/CMakeLists.txt#L34

Add #include <boost/range/iterator_range.hpp> to mapIO.cpp fixed this issue, but got another link issue with target aliceVision_sfm:

[392/564] C:\WINDOWS\system32\cmd.exe /C "C:\WINDOWS\system32\cmd.exe /C "J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E __create_def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir\.\exports.def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir\.\exports.def.objs && cd J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg" && J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe  @CMakeFiles\aliceVision_sfm.rsp  /out:Windows-AMD64\aliceVision_sfm.dll /implib:Windows-AMD64\aliceVision_sfm.lib /pdb:Windows-AMD64\aliceVision_sfm.pdb /dll /version:3.2 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir\.\exports.def && cd ."
FAILED: Windows-AMD64/aliceVision_sfm.dll Windows-AMD64/aliceVision_sfm.lib 
C:\WINDOWS\system32\cmd.exe /C "C:\WINDOWS\system32\cmd.exe /C "J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E __create_def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir\.\exports.def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir\.\exports.def.objs && cd J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg" && J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe  @CMakeFiles\aliceVision_sfm.rsp  /out:Windows-AMD64\aliceVision_sfm.dll /implib:Windows-AMD64\aliceVision_sfm.lib /pdb:Windows-AMD64\aliceVision_sfm.pdb /dll /version:3.2 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir\.\exports.def && cd ."
LINK Pass 1: command "E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe @CMakeFiles\aliceVision_sfm.rsp /out:Windows-AMD64\aliceVision_sfm.dll /implib:Windows-AMD64\aliceVision_sfm.lib /pdb:Windows-AMD64\aliceVision_sfm.pdb /dll /version:3.2 /machine:x64 /nologo /debug /INCREMENTAL /DEF:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir\.\exports.def /MANIFEST /MANIFESTFILE:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir/intermediate.manifest src\aliceVision\sfm\CMakeFiles\aliceVision_sfm.dir/manifest.res" failed (exit code 1189) with the following output:
LINK : fatal error LNK1189: library limit of 65535 objects exceeded

@JackBoosY
Copy link
Contributor Author

@fabiencastan @simogasp Any thought?

@fabiencastan
Copy link
Contributor

fabiencastan commented May 17, 2024

@simogasp
Copy link
Contributor

I think add_compile_options() is working fine as this is happening at linking time, right?
https://developercommunity.visualstudio.com/t/fix-msvc-65535-symbol-limit-in-lib-files-lnk1189/220174
not sure there is a solution to this other than splitting up the library?
How was it working till now?

@JackBoosY
Copy link
Contributor Author

Maybe we should replace add_compile_options(/bigobj) with append("/bigobj" CMAKE_CXX_FLAGS) https://github.com/alicevision/AliceVision/blob/4eb30dfa3c9054de183e335f08c21c4536cb52aa/src/CMakeLists.txt#L140 As done here: https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/HandleLLVMOptions.cmake#L655C3-L655C36

This doesn't work since add_compile_options(/bigobj) == append("/bigobj" CMAKE_CXX_FLAGS).

@servantftechnicolor
Copy link

Could you please try using this PR :

alicevision/AliceVision#1717

Briefly tested on msvc 2022.

@JackBoosY
Copy link
Contributor Author

Could you please try using this PR :

alicevision/AliceVision#1717

Briefly tested on msvc 2022.

Will try later.

@JackBoosY
Copy link
Contributor Author

Current: cannot find openmp on x64-windows, trying to fix this.

@JackBoosY
Copy link
Contributor Author

JackBoosY commented Jun 16, 2024

@simogasp It's wired that openmp_cxx is not found in Windows but other ports which configured with openmp can find it, any idea on this?

Edit: I tried to copy find_package(OpenMP) to top of root/CMakeLists.txt and openmp_cxx could be found:

-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")

But the same code doesn't work in root/src/CMakeLists.txt:

-- Found OpenMP_C: -openmp (found version "2.0")
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_CXX_FOUND) (found version "2.0")

@JackBoosY
Copy link
Contributor Author

Could you please try using this PR :

alicevision/AliceVision#1717

Briefly tested on msvc 2022.

Tried with this PR changes but failed on link process:

[295/566] C:\WINDOWS\system32\cmd.exe /C "C:\WINDOWS\system32\cmd.exe /C "J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E __create_def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir\.\exports.def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir\.\exports.def.objs && cd J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg" && J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe  @CMakeFiles\aliceVision_sfm_bundle.rsp  /out:Windows-AMD64\aliceVision_sfm_bundle.dll /implib:Windows-AMD64\aliceVision_sfm_bundle.lib /pdb:Windows-AMD64\aliceVision_sfm_bundle.pdb /dll /version:3.2 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir\.\exports.def && cd ."
FAILED: Windows-AMD64/aliceVision_sfm_bundle.dll Windows-AMD64/aliceVision_sfm_bundle.lib 
C:\WINDOWS\system32\cmd.exe /C "C:\WINDOWS\system32\cmd.exe /C "J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E __create_def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir\.\exports.def J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg\src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir\.\exports.def.objs && cd J:\vcpkg_commit\vcpkg\buildtrees\alicevision\x64-windows-dbg" && J:\vcpkg_commit\vcpkg\downloads\tools\cmake-3.29.0-windows\cmake-3.29.0-windows-i386\bin\cmake.exe -E vs_link_dll --intdir=src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe  @CMakeFiles\aliceVision_sfm_bundle.rsp  /out:Windows-AMD64\aliceVision_sfm_bundle.dll /implib:Windows-AMD64\aliceVision_sfm_bundle.lib /pdb:Windows-AMD64\aliceVision_sfm_bundle.pdb /dll /version:3.2 /machine:x64 /nologo    /debug /INCREMENTAL  /DEF:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir\.\exports.def && cd ."
LINK Pass 1: command "E:\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\link.exe @CMakeFiles\aliceVision_sfm_bundle.rsp /out:Windows-AMD64\aliceVision_sfm_bundle.dll /implib:Windows-AMD64\aliceVision_sfm_bundle.lib /pdb:Windows-AMD64\aliceVision_sfm_bundle.pdb /dll /version:3.2 /machine:x64 /nologo /debug /INCREMENTAL /DEF:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir\.\exports.def /MANIFEST /MANIFESTFILE:src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir/intermediate.manifest src\aliceVision\sfm\CMakeFiles\aliceVision_sfm_bundle.dir/manifest.res" failed (exit code 1120) with the following output:
   Creating library Windows-AMD64\aliceVision_sfm_bundle.lib and object Windows-AMD64\aliceVision_sfm_bundle.exp
BundleAdjustmentCeres.cpp.obj : error LNK2019: unresolved external symbol "public: class std::map<int,unsigned __int64,struct std::less<int>,class std::allocator<struct std::pair<int const ,unsigned __int64> > > __cdecl aliceVision::sfm::LocalBundleAdjustmentGraph::getDistancesHistogram(void)const " (?getDistancesHistogram@LocalBundleAdjustmentGraph@sfm@aliceVision@@QEBA?AV?$map@H_KU?$less@H@std@@V?$allocator@U?$pair@$$CBH_K@std@@@2@@std@@XZ) referenced in function "public: virtual bool __cdecl aliceVision::sfm::BundleAdjustmentCeres::adjust(class aliceVision::sfmData::SfMData &,enum aliceVision::sfm::BundleAdjustment::ERefineOptions)" (?adjust@BundleAdjustmentCeres@sfm@aliceVision@@UEAA_NAEAVSfMData@sfmData@3@W4ERefineOptions@BundleAdjustment@23@@Z)
BundleAdjustmentSymbolicCeres.cpp.obj : error LNK2001: unresolved external symbol "public: class std::map<int,unsigned __int64,struct std::less<int>,class std::allocator<struct std::pair<int const ,unsigned __int64> > > __cdecl aliceVision::sfm::LocalBundleAdjustmentGraph::getDistancesHistogram(void)const " (?getDistancesHistogram@LocalBundleAdjustmentGraph@sfm@aliceVision@@QEBA?AV?$map@H_KU?$less@H@std@@V?$allocator@U?$pair@$$CBH_K@std@@@2@@std@@XZ)

Windows-AMD64\aliceVision_sfm_bundle.dll : fatal error LNK1120: 1 unresolved externals

@simogasp
Copy link
Contributor

@simogasp It's wired that openmp_cxx is not found in Windows but other ports which configured with openmp can find it, any idea on this?

Edit: I tried to copy find_package(OpenMP) to top of root/CMakeLists.txt and openmp_cxx could be found:

-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")

But the same code doesn't work in root/src/CMakeLists.txt:

-- Found OpenMP_C: -openmp (found version "2.0")
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_CXX_FOUND) (found version "2.0")

That's very strange indeed. It's true that we have a useless project nesting and we should change that, but it should not be an issue when finding dependencies.
Which version of CMake are you using? Does it happen only on windows?

Copy link
Contributor

@dg0yt dg0yt left a comment

Choose a reason for hiding this comment

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

Edit: I tried to copy find_package(OpenMP) to top of root/CMakeLists.txt and openmp_cxx could be found:

To the top? Before project(), languages and the corresponding cmake variables are not initialized. This doesn't deliver valid information.

CMakeFiles/CMakeConfigureLog.yaml should be a good report of cmake configure checks. And there is --trace-expand.


vcpkg_cmake_install()

vcpkg_cmake_config_fixup(PACKAGE_NAME AliceVision CONFIG_PATH share/aliceVision/cmake)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
vcpkg_cmake_config_fixup(PACKAGE_NAME AliceVision CONFIG_PATH share/aliceVision/cmake)
vcpkg_cmake_config_fixup(CONFIG_PATH share/aliceVision/cmake)

@simogasp
Copy link
Contributor

Edit: I tried to copy find_package(OpenMP) to top of root/CMakeLists.txt and openmp_cxx could be found:

To the top? Before project(), languages and the corresponding cmake variables are not initialized. This doesn't deliver valid information.

CMakeFiles/CMakeConfigureLog.yaml should be a good report of cmake configure checks. And there is --trace-expand.

Yeah, the thing is that we have 2 project(AliceVision...), one at the root that allows the user to also build the dependencies and the "real" project to build the library in the src directory like project(AliceVisionSrc...). This is not ideal at all (to say the least), we should change it. But that does not explain the behaviour of findOpenMP.

@dg0yt
Copy link
Contributor

dg0yt commented Jun 17, 2024

I don't complain about a second project.
I refer to "to top of root/CMakeLists.txt" which is before all project.

@JackBoosY
Copy link
Contributor Author

Edit: I tried to copy find_package(OpenMP) to top of root/CMakeLists.txt and openmp_cxx could be found:

To the top? Before project(), languages and the corresponding cmake variables are not initialized. This doesn't deliver valid information.

CMakeFiles/CMakeConfigureLog.yaml should be a good report of cmake configure checks. And there is --trace-expand.

I mean add it after all option.

@BillyONeal BillyONeal marked this pull request as draft June 27, 2024 20:56
@BillyONeal
Copy link
Member

I changed this to draft because the build is broken; please feel free to mark 'Ready for review' when it's working and you're happy with it

@JackBoosY
Copy link
Contributor Author

JackBoosY commented Jul 1, 2024

@fabiencastan @simogasp Any help on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[New Port Request] AliceVision
8 participants