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

Windows Build/Test Data #392

Closed
johnhable opened this issue May 15, 2018 · 28 comments
Closed

Windows Build/Test Data #392

johnhable opened this issue May 15, 2018 · 28 comments

Comments

@johnhable
Copy link

Hi!

Do you have any test data for the pipeline steps? After quite a bit of tweaking I've been able to build the main AliceVision (not Meshroom) project on windows. I'm currently in the process of trying to run the whole pipeline but I'm unable to get the alicevision_incrementalSfM or alicevision_globalSfM commands to work. I'm a bit baffled because it could be something wrong with my sample data, my params, or the actual build might be broken on my end.

Since all the pipeline steps can be run from the command line, would it be possible to include some known good test data? The ideal would be to post some images (such as the tree from the Meshroom video) as well as the command line for each of the nodes. Then we can just run the script and that would give us a simple way to verify that all the pipeline steps work.

Also, I was able to build Windows, but I had to make a lot of manual fixes, especially to make it work as a static library (MT/MTd). Has anyone actually gone through this process yet? If not, would it help to post the issues I ran into?

Thanks!

John

@fabiencastan
Copy link
Member

Hi John,
Thanks for your message.

  1. Dataset
    Yes, I will upload some sample images.

  2. Run the pipeline without the UI
    You can still clone meshroom and launch:
    python MESHROOM_REPO/bin/meshroom_photogrammetry --input INPUT_IMAGES_FOLDER -- output OUTPUT_FOLDER

  3. Build troubles
    Yes, please send the problems you encountered when building the project. The build is suppose to work without tweaks.

@fabiencastan
Copy link
Member

Here is the link to the monstree images:
https://github.com/alicevision/dataset_monstree

@johnhable
Copy link
Author

Hi Fabien,

Thanks for the info. I'll try that shortly. Here are the issues that came up while building for windows.

As a primer, I'm using the alicevision branch of vcpkg. Also, I'm trying to build the x64-windows-static triplet (I believe the default is x86-windows). Personally, I try to statically link everything and I think that caused a few issues. Here is my cmake command line for reference:

cmake -DCMAKE_TOOLCHAIN_FILE=D:/Projects/AliceVision_v3/vcpkg-alicevision_master/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DALICEVISION_USE_CUDA=ON -DALICEVISION_USE_OPENCV=ON -DBOOST_NO_CXX11=1 -DCMAKE_INSTALL_PREFIX=../install ../AliceVision -G "Visual Studio 15 2017 Win64" -T v140

The first issue I ran into was link library paths. All the vcpkg libraries were in this directory for release mode:
D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\lib\

And a debug\ subfolder should have all the other debug versions.
D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\lib\debug\

  1. Most of them were in the right place, but the project thought ippicmvt.lib was in an extra subfolder (x64\vc15\staticlib):
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\x64\vc15\staticlib\ippicvmt.lib

  2. In debug mode, in the project, some of the libraries were being picked from the release folder. I.e. it's building the correct libwepbpd.lib, but the wrong jpeg.lib, libpng16.lib, etc.
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\lib\jpeg.lib
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\debug\lib\libwebpd.lib
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\lib\libpng16.lib
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\lib\tiff.lib
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\debug\lib\libjasperd.lib
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\debug\lib\IlmImfd.lib
    D:\Projects\AliceVision_v3\vcpkg-alicevision_master\installed\x64-windows-static\lib\zlib.lib

  1. Since I was building static, I was getting linker errors from the logger. That's because of this line in Logger.hpp, which should probably be #ifdef'd out for a static windows build:
    #define BOOST_LOG_DYN_LINK 1

  2. Also, when building static, you need to add gflags_static.lib as well as Shlwapi.lib.

  3. One random issue. In connectedComponent.hpp, it compiles with 2015 (v140) but fails in 2017 (v141) at line 66:

    for (EdgeMapAlias::MapIt it(cutMap); it!=lemon::INVALID; ++it, ++itEdge)

For some reason, the compiler can't figure out what an EdgeMapAlias is, so to fix it just replace with the line:

for (Graph::EdgeMap<bool>::MapIt it(cutMap); it!=lemon::INVALID; ++it, ++itEdge)

This one seems like a compiler bug, but fortunately there is a simple workaround.

That was for linking. A few more issues came up relating to the install script.

  1. Install puts both Release and Debug libraries into the same output directory and just overwrites the libs with whatever was build last. But on Windows we need to have a separate Release and Debug builds because of MT/MTd and MD/MDd conflicts.

  2. The install script doesn't copy over Lemon/config.h

  3. Some of the files include directly from "dependencies/", which is a problem because the INSTALL step puts them into "aliceVision_dependencies". For example, aliceVision/matching/pairwiseAdjacencyDisplay.hpp includes the line:

#include "dependencies/vectorGraphics/svgDrawer.hpp"

When doing a make install and including this file, an error occurs because the "dependencies" directory is actually called "aliceVision_dependencies" in the install location.

  1. I'm not sure if this is a bug, but the osi_clip and lemon headers include files with incorrect relative paths. For example, OsiClpSolverInterface.hpp includes files like:

#include "ClpSimplex.hpp"
#include "ClpLinearObjective.hpp"
#include "CoinPackedMatrix.hpp"
#include "OsiSolverInterface.hpp"

But those files are not in the same directory. To work around it you have to add the following include search paths, even though I was only using the aliceVision classes.
D:\Projects\AliceVision_v3\alice\include\aliceVision_dependencies\osi_clp\CoinUtils\src
D:\Projects\AliceVision_v3\alice\include\aliceVision_dependencies\osi_clp\Clp\src\OsiClp
D:\Projects\AliceVision_v3\alice\include\aliceVision_dependencies\osi_clp\Clp\src
D:\Projects\AliceVision_v3\alice\include\aliceVision_dependencies\osi_clp\Osi\src\Osi
D:\Projects\AliceVision_v3\alice\include\aliceVision_dependencies\lemon

It's a lower priority, but it would be much cleaner if the user didn't have to add include search directories for internal files inside the library.

Thanks for the help, and let me know if you need some extra testing.

John

@pypoulp
Copy link

pypoulp commented May 21, 2018

Hi, I'm having issues trying to build on Windows :

  • OS : Windows 10 - Visual Studio 2017 - vc140 x64 toolkit
  • AliceVision vcpkg fork for dependencies.

No errors during .sln generation.

Errors during io.cpp compilation, and seems to be related to OpenImageIO simd.h :
I also tried latest OpenImageIO (1.9.2 dev), same issues.

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2535	'OpenImageIO_v1_8::simd::vint16::vint16(int)': member function already defined or declared	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	1490	
Error	C3646	'type': unknown override specifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	294	
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	294	
Error	C3646	'type': unknown override specifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	295	
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	295	
Error	C3646	'type': unknown override specifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	296	
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	296	
Error	C2039	'type': is not a member of 'OpenImageIO_v1_8::simd::simd_bool_t<16>'	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	737	
Error	C3646	'simd_t': unknown override specifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	737	
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	737	
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	766	
Error	C2143	syntax error: missing ',' before '&'	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	766	
Error	C2535	'OpenImageIO_v1_8::simd::vbool16::vbool16(int)': member function already defined or declared	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	766	
Error	C2833	'operator simd_t' is not a recognized operator or type	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	769	
Error	C2059	syntax error: 'newline'	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	769	
Error	C2334	unexpected token(s) preceding '{'; skipping apparent function body	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	769	
Error	C3646	'simd': unknown override specifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	770	
Error	C2059	syntax error: '('	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	770	
Error	C2334	unexpected token(s) preceding '{'; skipping apparent function body	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	770	
Error	C3646	'm_simd': unknown override specifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	841	
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	841	
Error	C2065	'm_simd': undeclared identifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	754	
Error	C2039	'm_simd': is not a member of 'OpenImageIO_v1_8::simd::vbool16'	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	754	
Error	C2065	'm': undeclared identifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	766	
Error	C2614	'OpenImageIO_v1_8::simd::vbool16': illegal member initialization: 'm_simd' is not a base or member	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	766	
Error	C2039	'type': is not a member of 'OpenImageIO_v1_8::simd::simd_raw_t<int,16>'	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	1445	
Error	C3646	'simd_t': unknown override specifier	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	1445	
Error	C4430	missing type specifier - int assumed. Note: C++ does not support default-int	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	

[...]

Error	C3861	'_mm256_mask_storeu_epi32': identifier not found	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	4843	
Error	C3861	'__mmask8': identifier not found	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	5179	
Error	C3861	'_mm256_mask_storeu_epi32': identifier not found	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	5179	
Error	C3861	'__mmask8': identifier not found	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	5198	
Error	C1003	error count exceeds 100; stopping compilation	aliceVision_image	D:\vcpkg-alicevision\vcpkg\installed\x64-windows\include\OpenImageIO\simd.h	5198	

Any idea what can cause the problem ?

Thanks.

@johnhable
Copy link
Author

Hi Paul,

Can you go to one of your projects (such as aliceVision_dataio), and show the preprocessor includes? Right click the project, Properties, then Configuration Properties->C/C++/Preprocessor. Then set configuration to Release and platform to x64 (or x86) if you're building that. The copy and paste the Preprocessor Definitions? Mine look like this, but I hacked them a bit so they won't be exact.

WIN32;_WINDOWS;NDEBUG;OIIO_STATIC_BUILD;NOMINMAX;_USE_MATH_DEFINES;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;AVX;FMA;BMI2;AVX2;BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;BOOST_NO_CXX11_SCOPED_ENUMS;EIGEN_DONT_ALIGN_STATICALLY=1;EIGEN_DONT_VECTORIZE=1;GLOG_NO_ABBREVIATED_SEVERITIES;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)

In my code in simd.h, it looks like this, and the #if is false. So one way that your configuration is different from mine is that somehow you are getting OIIO_SIMD_AVX >= 512 to be true.

#if OIIO_SIMD_AVX >= 512
template<> struct simd_raw_t<int,16> { typedef __m512i type; };
template<> struct simd_raw_t<float,16> { typedef __m512 type; };
template<> struct simd_bool_t<16> { typedef __mmask16 type; };
#else
// Note: change in strategy for 16-wide SIMD: instead of int[16] for
// vbool16, it's just a plain old bitmask, and __mask16 for actual HW.
template<> struct simd_bool_t<16> { typedef uint16_t type; };
#endif

Do you have AVX512F defined somewhere? And if you hover over the code in visual studio, does it tell you what the value of OIIO_SIMD_AVX is? I have OIIO_SIMD_AVX=2.

John

@johnhable
Copy link
Author

Oops, markdown commenting changed the underscores in my post. There should be two underscores before and after AVX512F. As in __AVX512F__.

@pypoulp
Copy link

pypoulp commented May 21, 2018

Hi @johnhable thanks for your help, My Preprocessor definitions look like this (x64 Release):

WIN32
_WINDOWS
NDEBUG
NOMINMAX
_USE_MATH_DEFINES
__SSE2__
__SSE3__
__SSSE3__
__SSE4_1__
__SSE4_2__
__AVX__
__FMA__
__BMI2__
__AVX2__
__AVX512F__
__AVX512VL__
__AVX512CD__
__AVX512DQ__
__AVX512BW__
BOOST_ALL_NO_LIB
BOOST_ALL_DYN_LINK
EIGEN_DONT_ALIGN_STATICALLY=1
EIGEN_DONT_VECTORIZE=1
GLOG_NO_ABBREVIATED_SEVERITIES
CMAKE_INTDIR="Release"

I'll try to remove the AVX512 definitions.

@pypoulp
Copy link

pypoulp commented May 21, 2018

Update : removing __AVX512*__ definitions fixed all the OIIO compilations errors, almost there!

Most of the sln projects compiled, I still have some errors about cuda, like this one, seems like a version conflict with the cuda toolkit I installed :
cublas_device.lib(trmv_sp.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1900' in main_depthMapEstimation.obj ...
Could you tell me wich version of Cuda Toolik you are using ?

i'm also getting an undefined variable, maybe hardcoded path to test images ? :
AliceVision\src\samples\siftPutativeMatches\main_siftMatching.cpp(23): error C2065: 'THIS_SOURCE_DIR': undeclared identifier

Thanks.

@fabiencastan
Copy link
Member

It's surprising because there is a add_definition in CMakeLists.txt, but you can disable examples:
cmake -DALICEVISION_BUILD_EXAMPLES=OFF

@johnhable
Copy link
Author

Hi Paul,

Cool, that's good to see. For CUDA, I've got version 9.0. It looks like you are linking to the wrong version of the cuda libraries. Also, make sure that you are linking to the Visual Studio 15 version, which is v140. IIRC a value of 1600 means you are trying to link with VS 2012 cuda libs.

John

@pypoulp
Copy link

pypoulp commented May 22, 2018

Hi,
Sfm seems to work well :
image

Don't know why MSVC 2017 -v140 is not linking to the correct Cuda libs, will investigate, and try to build popSIFT too.

Thanks.

@pypoulp
Copy link

pypoulp commented May 23, 2018

Finally managed to build on Windows, quick list of the problems I encountered :

  • Had to disable AVX512 in cmake (activated by default cos my CPU is compatible), Apparently, there is a problem with OpenImageIO and AVX512.
  • There was a problem with Cuda host compiler path and MSVC2017, I performed a clean install of Cuda Toolkit 9.0, it solved the problem.

Will now test in meshroom, and try to build with openCV/popSift.

@Lhun
Copy link

Lhun commented May 23, 2018

Hey paul, once you have a working build with all hardware acceleration features can you publish the binaries somewhere? I would highly recommend that if the team wants their software to succeed, publishing a nightly x64 windows and linux binary should be a goal, much like other software kits like VLC and Mozilla. There are dozens of people I know personally looking to test this software that simply cannot expend the resources to compile on their own. Publishing a nightly as well insures people aren't locked on an older version - it's extremely common for someone to latch onto the first binary available and simply use that as none other exists - even if significant improvements to the product have been made in source.

There are hundreds of thousands of impressive and groundbreaking computer vision software packages that languish in obscurity due to simply there being no binary available.

I know of no less than 5 real-time dense mesh reconstruction algorithms from video that have been published and demonstrated that some would consider the "holy grail" of consumer 3d scanning that simply faded away into vaporware despite the code being freely available.

@pypoulp
Copy link

pypoulp commented May 23, 2018

Hi Lhun,

No problem, If I manage to build everything, I'll try to package it for windows x64.
for now :

  • popSIFT is not compiling on windows; lots of error, missing headers etc... but it's not critical cos CPU feature detection is quite fast.
  • Meshroom with OIIO & Alembic plugins : OK

@johnhable
Copy link
Author

FWIW I need to second Lhun's statement. While it would be great to have a nightly build, I would definitely settle for an occasional binary release, even if it's only once per year. Going through this build process is a non-starter for most people. This is true for many open source projects. I.e. I don't know many people on windows that compile OpenCV from source. I've done it, which is why I'm able to figure out some of these problems, but most people don't.

Also, for windows, there needs to be 4 versions, for each of the MSVC runtime libraries. It's a pain, but it's something we all have to deal with.
Dynamic-Link Release: MD
Dynamic-Link Debug: MDd
Static-Link Release: MT
Static-Link Debug: MTd

IMO, I'd estimate that 90% of users would be happy with 64bit Visual Studio 2015 (v140) binaries. A full build for that configuration would massively help AliceVision adoption. Even if we don't have a completely solid build process, duct-taping a single build together and putting it online would let most users get started.

John

@fabiencastan
Copy link
Member

Hi,
Great to see that you managed to build and run it!
Thanks a lot for your detailed feedback, we will see if we can improve the build based on these inputs. If you have ideas on changes to cmake or documentation to avoid the manual workarounds, please create a PR. If you have the setup to reproduce the OIIO AVX512 trouble, it would be very useful to submit an issue on oiio.

@Lhun and @johnhable, we fully agree with you, providing binaries for each platform is an important step for the project but it takes time to setup.
On the AliceVision side, the goal would be to:

  • add a deployment step on travis to release binaries from the develop branch
  • setup appveyor to release windows binaries from the develop branch
  • add a macos variant on travis to release macos binaries from the develop branch
    For Meshroom, we have to provide binaries with PySide, Qt, and the plugins (QtOIIO, qmlAlembic).

Recommandations or help on these aspects would be much appreciated.

@johnhable
Copy link
Author

Hi Fabien,

Here is what I would recommend:

  1. Have one user build the binaries manually.
  2. Submit them online.
  3. Done.

Having a proper automated build platform would be a great long term solution, but it's going to be a long time before any solution is in place. So a "good enough" solution for the vast majority of users is for one person to do a manual build and post it. A manual build could be uploaded tomorrow, as opposed to the automatic build which is weeks/months/years away from being ready.

John

@TechArtistG
Copy link

Yeah, I was trying to build AliceVision for our art team to evaluate it in our pipeline, even having a version of the binaries months old would be better than nothing. I can't really justify spending more than a day trying to get it to build so will just have to wait for the binaries to come out. Not hate'n , just giving feedback :)

@pmoulon
Copy link
Contributor

pmoulon commented Jun 7, 2018

OpenMVG gives some binaries for windows on the release page (https://github.com/openMVG/openMVG/releases/tag/v1.3).
AliceVision could do the same

@TechArtistG
Copy link

PS: I work for a team at Microsoft and if we could get some hand made binaries to eval the system and decide it's worth further investigation I'm sure we could wrangle some dev time to help out with the auto build process.

@fabiencastan
Copy link
Member

Thanks for the message, that would be great!

We are still working on it and made good progress. Windows and Linux binaries will be released in 2 weeks.
Meanwhile, if you need a quick idea of the quality, you can send me a dataset at faca[at]mikrosimage.eu that I can process for you.

@johnhable
Copy link
Author

Hi, just checking in. How has progress been going on the binaries? Asking for a friend. Thanks!

John

@zvrba
Copy link
Member

zvrba commented Jul 13, 2018

To make life simpler for the team, I suggest the following:

  1. Static linking should not be a supported configuration. EXEs aren't fully statically linked anyway because of ntdll.dll and a couple of other system libs. Given the default DLL search path on Windows (EXE dir first), deployment isn't a problem either.

  2. Do not try to build "Debug" (/MDd) variants. It creates unnecessary binary incompatibilities. The way I do it is to only use /MD and when I want to debug my code, I turn off all compiler optimizations and build the DLL that I want to debug. Works like a charm and I can freely mix DLLs in the same application. (In VS, I create a solution/project configuration called "RelNoOpt" that differs from "Release" only in optimization flags.)

@johnhable
Copy link
Author

Hi Zelijko,

Have to disagree. In order for a library to be useful to the developer community, the full set of MT/MD/MTd/MDd needs to be supported on windows. It's a pain, but it's something we all have to deal with.

John

@zvrba
Copy link
Member

zvrba commented Jul 13, 2018

It's a pain, but, IMO, it's also something that you / the "developer community" chooses to deal with. Compiling with /MD and disabled optimizations produces code that is no harder to debug than the code compiled with /MDd.

I've been developing for Windows only for years now and found that what I suggested is the most sane approach. I don't care about debuggability of 3rd-party dependencies (after all, a 3rd-party dependency is a black box assumed to work correctly), so I compile them with full optimizations with the added benefit that they run at full speed. Then, the only way I can use them is to use only /MD for my code... with optimizations turned on or off. The project set up got way simpler (no release/debug variants to link with), it's possible to set up unix-like bin, include, lib hierarchy, check it in in a version control and have a build environment ready, on a fresh developer machine, in a matter of minutes.

(Something is lost when not using /MDd… like debuggability of iterators and heap pointers. That alone makes code heavily based on iterators run 2x slower.. or more if you're dealing with std::list)

But to each his own.

@zvrba
Copy link
Member

zvrba commented Jul 13, 2018

PS: so what I think AliceVision team should do is to

  1. Build binary dependencies manually instead of using vcpkg
  2. Check in the resulting binaries into a VCS as a "standard" bin, include, lib hierarchy
  3. Set up the project as I suggested, with include and library paths depending on a single environment variable (location root of the precompiled dependencies)

It's a lot of work for the team, but it's a matter of minutes for anyone else to set up the build environment.

(Yes, I did once such an endeavor for OpenMVG. Took me 2-3 days. The worst dependency to build was HDF5 as it didn't compile cleanly, but now the project has switched Alembic storage to default to Ogawa format, so HDF5 is not required anymore unless you need to read "legacy" files.)

Oh, and a tip for the team: be sure to DISABLE whole-program optimizations. It can generate invalid code even with rather new MSVC (15.7.x).

@zvrba
Copy link
Member

zvrba commented Jul 13, 2018

As for why support only DLLs: because a module (DLL) is an isolation boundary and aids in managing dependencies. If component A.DLL needs LIBv1.DLL and B.DLL needs LIBv2.DLL you can load all of them into the same address space without conflicts, even if there are duplicate symbols in LIBv1.DLL and LIBv2.DLL (because A imports symbols only from LIBv1, etc.). But if you have static libraries A.LIB, B.LIB, LIBv1.LIB and LIBv2.LIB, you'll get linker errors due to symbol clashes between LIBv1 and LIBv2 when trying to link them into the same program.

So, IMO, it's pointless to build anything meant for public consumption as a static library.

EDIT: only Windows DLLs have the benefit of acting as an isolation boundary. Linux/ELF with its global symbol table search is broken in this respect, see the 1st answer here

https://softwareengineering.stackexchange.com/questions/176681/did-c11-address-concerns-passing-std-lib-objects-between-dynamic-shared-librar

and concrete examples here

https://holtstrom.com/michael/blog/post/437/Shared-Library-Symbol-Conflicts.html
http://www.fcollyer.com/2013/01/04/elf-symbol-visibility-and-the-perils-of-name-clashing/

natowi added a commit that referenced this issue Mar 10, 2020
"setup appveyor to release windows binaries from the develop branch"
#392 (comment)

Save auto builds to https://ci.appveyor.com/project/AliceVision/alicevision/build/artifacts for download to test new features.
https://www.appveyor.com/docs/packaging-artifacts/
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants