Closed ShikiGami closed 6 years ago
Have you tried the instructions here: https://github.com/cdcseacave/openMVS/wiki/Building
Yes, but it doesn't tell you what options you need on the dependencies, it only tells you to pre-compile the necessary dependencies without any specifics. After working for hours I was able to compile it using shared libraries, but when I try to do it with static libraries, I get errors with CGAL, that even thou it compiles as static, for some reason it marks it as dynamic, and a bunch of other problems. CGAL for windows is a nightmare, since it has it's own dependencies that need to be pre-compiled, the installation has it's own "auxiliaries" for windows with pre-compiled libraries, but these are dynamic. Ceres and boost are also problems waiting to happen.
Even getting it to compile with dynamic libraries isn't straight-forward at all.
It would be nice if there was any kind of advice to actually getting to compile this without wasting hours of time just to get it right. The Wiki says that they are using Windows for development, so why are the Windows instructions so lacking?. CMake never plays nice in windows, so it should be more specific, specially with dependencies that are not included and REQUIRE to be compiled by you because no binaries exist.
Oh I see what you mean. I assume that since no specifications for the exact compilation instructions for the third party dependencies are given, that the default compilation instructions for those libraries should work fine.
like in OpenMVS/Eigen, OpenMVS/Ceres, etc
I haven't tried building on Windows before but maybe I will give it a try.
the default compilation instructions for those libraries should work fine.
They don't, I tried
What errors do you get when you try to compile OpenMVS after compiling all the dependencies with their default configurations?
I'm almost positive that without that specific information you will not get any help from someone in the "know" in this community.
Also I feel it necessary to admonish you; starting off your issue with "The way necessary dependencies are used inside OpenMVS is a mess.", is unnecessarily rude and doesn't acknowledge the time and effort that has gone into the project. All in all a very poor way to approach asking for help.
You can also try to compile and run in a VM thanks Docker https://hub.docker.com/r/freakthemighty/openmvs/~/dockerfile/
Thanks for the response @pmoulon , and for the docker info. The problem is that I need to compile it as a windows executable.
I would like to know the configuration the people who are mainly developing this, who say they are doing it in Windows, are using, and to update the wiki with the actual configuration they are using for their work.
I'm also making the report that it doesn't work like the wiki says.
I'm a little tired and annoyed because I've been working for hours to get this working without much progress, and maybe my words are not the prettiest, and I'm sorry if anyone feels I've been rude, or feel that it doesn't acknowledge the time and effort that has gone into the project. I would like to think that the fact that I'm not using some other MVS library that will build easier than this one is proof enough that I actually appreciate the work being done here.
There are many many many errors, so I'm just going with the most common I get every single time, that is, if you compile CGAL with standard windows config, you will get the shared libraries, but for some reason, using everything as default config, you get a "mixing shared and static libraries is not a good idea" error. The only solution to this that I've been able to come up is to compile CGAL with the non-default option of making the library static, but for some reason, the naming comes wrong using a *-mt.lib
ending for the library, but at the time of building OpenMVS, the name it looks for is *-mt-s.lib
, and it also tries to look for it in the wrong directory, so you have to manually add that library to the project.
Dear @ShikiGami thank you for your interest in OpenMVS. Building OpenMVS on Windows is as much of a "mess" as of building any other project with dependencies on Windows. It seems to me though that the mess is on your side, in the way you organize yourself. Here are some basic tips for compiling anything on Windows (and any platform for that matter):
Following only these 2 rules is all you need. The easiest way to accomplish 1 is to use static or dynamic for ALL dependencies. Though this is not a rule; you can mix as log as you know what are you doing.
I'm sorry @cdcseacave , but that is not true. I've built other projects like OpenCV, OpenMVG, PCL, and I've never had this kind of problems. Specially CGAL is a problem library for the reasons I said before.
I don't understand what is so wrong about warning people about how to properly compile CGAL, or even provide the libraries in the repository to avoid problems and people wasting their time. Not to mention that unlike linux, there is not just one single way to handle CMake in Windows, there are a bunch of generators with their own rules.
Another big problem I had, and I was never able to fix is that when you use Ninja, which is standard in the Visual Studio 2017 implementation of CMake, it would just fail with a parsing error.
I can understand that for you it maybe easy to understand, because you have been working with this library, but for people who do not know how this library works, or some of their dependencies (like CGAL) it would be nice if there was some extra info instead of having to waste hours trying to understand something that someone else already solved.
I'm sorry @ShikiGami, but all the examples of libraries you gave above have all compulsory dependencies integrated, they do not use external dependencies unless you want to. That is not a nice thing to do, although it is indeed easy for the occasional user.
"warning people about how to properly compile CGAL"
What that even means? There is no proper way of compiling anything. Any library needs to be compiled as the developer of that library specifies. I develop OpenMVS on Windows and I compiled CGAL exactly as it is indicated in their documentation. What exactly do you want me to warn you about???!?!?!?!
I was trying to help you: all you need to do is to compile everything the same way: static/dynamic, MT/MD, etc.
@cdcseacave I post it above, but by compiling CGAL "exactly as indicated in their documentation", you will get an LNK1104
file not found error every single time, either if dynamic or static. If it's dynamic it will link to a wrong folder, and if static, to a wrong folder with a wrong name.
If static, it continues to ask me for libCGAL-vc140-mt-s-4.11.lib
when the library you get is libCGAL-vc140-mt-4.11.lib
with /MT
.
Not to mention that the integrated dependencies for CGAL; GMP and MPFR only come as dynamic libraries, and compiling them by yourself in Windows is difficult.
And yes, those examples I gave include the dependencies in their repository, which is why I also made the suggestion that maybe it would be a good idea to do the same for OpenMVS. The "not a nice thing to do" thing I really don't get, specially for Windows. In Linux you can get the libraries just by downloading them from the OS repository most of the time, and it will be really straightforward, but in windows it is never as clean or pretty.
Sorry you have problems compiling CGAL, pls try to find a solution from the CGAL developers.
There are pros and cons to include dependencies: (pros) it is easier to compile for a quick test; (cons) for a real user that plans to include that library in his own framework this is the source of many strange problems hard to detect (and even harder to solve if you got on the (pros) path) caused by mixing various versions of the same library, which can happen easily in a big project.
As an example of this (cons) issue, pls see only the bunch of issues reported here by people having strange behavior after using OpenCV with the built in JPEG library and the JPEG library used by OpenMVS. The solution was to either compile OpenCV with the out-of-repo JPEG library, or change the out-of-repo JPEG library to match the version used inside OpenCV.
There is also a problem with OpenCV. If you try to build as Release or RelWithDebInfo, it will fail because MVS.lib is looking for symbols only available in the Debug libraries for OpenCV, but if you try to add them you get a LNK2038 error because of the difference in RuntimeLibrary of MTd_StaticDebug
being MT_StaticRelease
That is indeed a problem of compatibility with the latest OpenCV. Just pushed a fix, pls update.
I experienced the same issue in building openMVS on windows regarding CGAL. Specifically, I got the following error message for each project under Apps (RefineMesh ...).
4>LINK : fatal error LNK1104: cannot open file 'libCGAL-vc140-mt-s-4.11.lib'
In building CGAL, I made sure to specify "Multi-threaded (/MT)" under "code generation / Runtime Library", but only "libCGAL-vc140-mt-4.11.lib" was generated not "libCGAL-vc140-mt-s-4.11.lib".
It would be great someone point out where I got wrong. Thanks.
the extra s
in the name states that the static version of the lib is looked for; as I said so many times before, if you compile a library as shared and try to use it as static it will never work
Thanks for the reply. I tried the following settings already in VisualStudio and it still did not work. What do I miss to create a CGAL static library, please?
"Configuration Type" is set to to "Static library (.lib)" "Use of MFC" is set to "Use MFC in a Static Library" "Runtime library" is set to "Multi-threaded (/MT)" "Link Library Dependencies" is set to "Yes"
In case it helps to explain, I had the following output from Cmake-gui:
== Setting paths == Build CGAL from release in directory CGAL-4.11 Packagenames: CGAL-4.11 == Setting paths (DONE) ==
== Generate version files == CGAL_MAJOR_VERSION=4 CGAL_MINOR_VERSION=11 CGAL_BUGFIX_VERSION=0 CGAL_SONAME_VERSION=13 CGAL_SOVERSION =13.0.1 CGAL_REFERENCE_CACHE_DIR= Building static libraries Visual Leak Detector (VLD) is not found. Targetting Visual Studio 14 2015 Win64 Target build enviroment supports auto-linking Using VC14 compiler. Generator uses intermediate configuration directory: $(Configuration) USING CMake version: 3.9.4 System: Windows == Generate version files (DONE) ==
== Set up flags == Build type: Release USING CXXFLAGS = '/DWIN32 /D_WINDOWS /W3 /GR /EHsc /MP /wd4267 -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /fp:strict /fp:except- /wd4503 /bigobj /MT /O2 /Ob2 /DNDEBUG' USING LDFLAGS = '/machine:x64 ' == Set up flags (DONE) ==
== Detect external libraries ==
External libraries supported: GMP;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE
Preconfiguring library: GMP ...
GMP has been preconfigured:
UseGMP-file:
GMP include: C:/CGAL-4.11/auxiliary/gmp/include
GMP libraries: C:/CGAL-4.11/auxiliary/gmp/lib/libgmp-10.lib
GMP definitions:
USING GMP_VERSION = '5.0.1'
Preconfiguring library: MPFR ...
MPFR has been preconfigured:
UseMPFR-file:
MPFR include: C:/CGAL-4.11/auxiliary/gmp/include
MPFR libraries: C:/CGAL-4.11/auxiliary/gmp/lib/libmpfr-4.lib
MPFR definitions:
USING MPFR_VERSION = '3.0.0'
Boost version: 1.65.1
Boost include: C:/boost_1_65_1
Boost libraries:
Boost definitions:
USING BOOST_VERSION = '1.65.1'
== Detect external libraries (DONE) ==
== Write compiler_config.h == Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Failed Performing Test CGAL_CFG_IEEE_754_BUG - Success Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success Performing Test CGAL_CFG_MATCHING_BUG_5 - Success Performing Test CGAL_CFG_MATCHING_BUG_6 - Failed Performing Test CGAL_CFG_MATCHING_BUG_7 - Success Performing Test CGAL_CFG_MATCHING_BUG_8 - Success Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Failed Performing Test CGAL_CFG_NO_LIMITS - Success Performing Test CGAL_CFG_NO_NEXTAFTER - Success Performing Test CGAL_CFG_NO_STL - Success Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success == Write compiler_config.h (DONE) ==
== Generating build files == Configuring libCGAL Requested component: MPFR Requested component: GMP libCGAL is configured Sources for CGAL component library 'CGAL_Core' detected Configuring libCGAL_Core Requested component: MPFR Requested component: GMP libCGAL_Core is configured Sources for CGAL component library 'CGAL_ImageIO' detected Configuring libCGAL_ImageIO Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) Requested component: MPFR Requested component: GMP libCGAL_ImageIO is configured NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated. Sources for CGAL component library 'CGAL_Qt5' detected Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt5' detected == Generating build files (DONE) ==
Configuring done Generating done
The file name is generated by CMake, so it does not matter if you configure Visual Studio correct, the name does not change.
@cdcseacave Thanks.
Then, exactly which settings were wrong in Cmake? I do have "BUILD_SHARED_LIBS" set as unchecked.
Thanks.
The way the necesary libraries are used inside OpenMVS is a mess. I've recompiled and reused all the dependencies in many different ways, and I still get errors. Static/dynamic problems, not linking the necesary libraries with a lot of symbol not found problems, include files not being found. I've got DensifyPointCloud to compile, but RefineMesh and Viewer have just not compiled in any of the configurations I've tried. It is completely a problem with the dependencies. I tried to switch to vcpkg, and even then I get errors. I tried making OpenMVS static, and it just gave me even more errors.
Can anyone who has actually compiled this give a breakdown of what is ACTUALLY necesary for this to compile?
I've been for like 4 days now trying to get it to compile without any luck.
Thanks.