We're Hiring!

VS2015 Build Problems

Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats
Please note:
Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats

If you are having trouble with image files, there is information about reporting bugs in the Bio-Formats documentation. Please send us the data and let us know what version of Bio-Formats you are using. For issues with your code, please provide a link to a public repository, ideally GitHub.

VS2015 Build Problems

Postby jm88 » Thu Mar 02, 2017 12:50 pm

Hello there!

I am trying to use OME to read in a TIFF, but I cannot get the example file working with the self-contained "super" builds after two days of trying. I am using C++ VS2015 on Windows 10.
I've dealt with some of the errors that seems to be Bosst issues, but am stumped

This is the super build
http://downloads.openmicroscopy.org/ome-files-cpp/0.3.1/21/binaries/ome-files-bundle-0.3.1-VC14-x64-Debug-b21.zip

And the sample code
http://downloads.openmicroscopy.org/ome-files-cpp/0.3.1/21/docs/ome-files-bundle-docs-0.3.1-b21/ome-files/manual/html/_downloads/metadata-formatreader.cpp

I've dealt with a few errors along the way and somewhat have dealt with them.

I get three errors like this.
Error C4996 'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS.
I deal with this by adding -D_SCL_SECURE_NO_WARNINGS to C/C++ Command Line

I then get this error, which seems to be looking for a file that does not exist in the super build.
LNK1104 cannot open file 'libboost_filesystem-vc140-mt-gd-1_63.lib' TiFFReader C:\omeVC14-x64\TiFFReader\TiFFReader\LINK 1

After a bit more reading, I enable the boost/config/user.hpp BOOST_ALL_DYN_LINK
#define BOOST_ALL_DYN_LINK
which then gets me to a bunch of unresolved externals (see below)

Any ideas? Apologies if I am missing something really basic. A working sample project on the tutorial page would be most helpful. I'd be most happy to contribute one if I can get it working.

Cheers
Justin




rror (active) a reference of type "boost::filesystem::path::iterator &" (not const-qualified) cannot be initialized with a value of type "boost::filesystem::path::iterator" TiFFReader c:\omeVC14-x64\include\boost\filesystem\path.hpp 691
Error (active) a reference of type "boost::filesystem::path::iterator &" (not const-qualified) cannot be initialized with a value of type "boost::filesystem::path::iterator" TiFFReader c:\omeVC14-x64\include\boost\filesystem\path.hpp 692
Error (active) member "boost::filesystem::path::dot" may not be initialized TiFFReader c:\omeVC14-x64\include\boost\filesystem\path.hpp 67
Error (active) member "boost::filesystem::path::preferred_separator" may not be initialized TiFFReader c:\omeVC14-x64\include\boost\filesystem\path.hpp 66
Error (active) member "boost::filesystem::path::separator" may not be initialized TiFFReader c:\omeVC14-x64\include\boost\filesystem\path.hpp 65
Error LNK2019 unresolved external symbol "public: static class boost::general_storage_order<9> __cdecl ome::files::PixelBufferBase::default_storage_order(void)" (?default_storage_order@PixelBufferBase@files@ome@@SA?AV?$general_storage_order@$08@boost@@XZ) referenced in function "public: __cdecl ome::files::VariantPixelBuffer::VariantPixelBuffer(void)" (??0VariantPixelBuffer@files@ome@@QEAA@XZ) TiFFReader C:\omeVC14-x64\TiFFReader\TiFFReader\TiFFReader.obj 1
Error LNK2019 unresolved external symbol "public: unsigned __int64 __cdecl ome::files::VariantPixelBuffer::num_elements(void)const " (?num_elements@VariantPixelBuffer@files@ome@@QEBA_KXZ) referenced in function "void __cdecl `anonymous namespace'::readPixelData(class ome::files::FormatReader const &,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?readPixelData@?A0x23f25ee6@@YAXAEBVFormatReader@files@ome@@AEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) TiFFReader C:\omeVC14-x64\TiFFReader\TiFFReader\TiFFReader.obj 1
Error LNK2019 unresolved external symbol "public: __cdecl ome::files::in::TIFFReader::TIFFReader(void)" (??0TIFFReader@in@files@ome@@QEAA@XZ) referenced in function "public: __cdecl std::_Ref_count_obj<class ome::files::in::TIFFReader>::_Ref_count_obj<class ome::files::in::TIFFReader><>(void)" (??$?0$$V@?$_Ref_count_obj@VTIFFReader@in@files@ome@@@std@@QEAA@XZ) TiFFReader C:\omeVC14-x64\TiFFReader\TiFFReader\TiFFReader.obj 1
Error LNK2019 unresolved external symbol "public: __cdecl ome::xml::model::enums::PixelType::PixelType(class ome::xml::model::enums::PixelType const &)" (??0PixelType@enums@model@xml@ome@@QEAA@AEBV01234@@Z) referenced in function "protected: static class boost::variant<struct boost::detail::variant::over_sequence<struct boost::mpl::vector11<class std::shared_ptr<class ome::files::PixelBuffer<signed char> >,class std::shared_ptr<class ome::files::PixelBuffer<short> >,class std::shared_ptr<class ome::files::PixelBuffer<int> >,class std::shared_ptr<class ome::files::PixelBuffer<unsigned char> >,class std::shared_ptr<class ome::files::PixelBuffer<unsigned short> >,class std::shared_ptr<class ome::files::PixelBuffer<unsigned int> >,class std::shared_ptr<class ome::files::PixelBuffer<bool> >,class std::shared_ptr<class ome::files::PixelBuffer<float> >,class std::shared_ptr<class ome::files::PixelBuffer<double> >,class std::shared_ptr<class ome::files::PixelBuffer<class std::complex<float> > >,class std::shared_ptr<class ome::files::PixelBuffer<class std::complex<double> > > > >,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_,struct boost::detail::variant::void_> __cdecl ome::files::VariantPixelBuffer::makeBuffer<signed char>(class boost::detail::multi_array::extent_gen<9> const &,class boost::general_storage_order<9> const &,class ome::xml::model::enums::PixelType)" (??$makeBuffer@C@VariantPixelBuffer@files@ome@@KA?AV?$variant@U?$over_sequence@U?$vector11@V?$shared_ptr@V?$PixelBuffer@C@files@ome@@@std@@V?$shared_ptr@V?$PixelBuffer@F@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@H@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@E@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@G@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@I@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@_N@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@M@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@N@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@V?$complex@M@std@@@files@ome@@@2@V?$shared_ptr@V?$PixelBuffer@V?$complex@N@std@@@files@ome@@@2@@mpl@boost@@@0detail@boost@@Uvoid_@023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@U4023@@boost@@AEBV?$extent_gen@$08@multi_array@detail@4@AEBV?$general_storage_order@$08@4@VPixelType@enums@model@xml@2@@Z) TiFFReader C:\omeVC14-x64\TiFFReader\TiFFReader\TiFFReader.obj 1
Error LNK2019 unresolved external symbol "public: __cdecl ome::xml::model::enums::PixelType::PixelType(enum ome::xml::model::enums::PixelType::enum_value)" (??0PixelType@enums@model@xml@ome@@QEAA@W4enum_value@01234@@Z) referenced in function "public: __cdecl ome::files::VariantPixelBuffer::VariantPixelBuffer(void)" (??0VariantPixelBuffer@files@ome@@QEAA@XZ) TiFFReader C:\omeVC14-x64\TiFFReader\TiFFReader\TiFFReader.obj 1
Error LNK2019 unresolved external symbol "void __cdecl ome::common::setLogLevel(enum boost::log::v2_mt_nt6::trivial::severity_level)" (?setLogLevel@common@ome@@YAXW4severity_level@trivial@v2_mt_nt6@log@boost@@@Z) referenced in function main TiFFReader C:\omeVC14-x64\TiFFReader\TiFFReader\TiFFReader.obj 1
jm88
 
Posts: 6
Joined: Thu Mar 02, 2017 4:02 am

Re: VS2015 Build Problems

Postby dgault » Fri Mar 03, 2017 12:19 pm

Hi,

Sorry to hear your having issues, some better documentation for building a Visual Studio project may indeed be useful. I was wondering how you had configured boost with your project in this case?

I tried building the sample code locally and did notice that the boost path in the sample code was not being picked up correctly.
Usually I would expect that all I have to add would be under Project Properties -> VC++ directories add the following:
- bundle_path/include to Include Directories
- bundle_path/lib to Library Directories

As the boost path in the includes directory is in a sub folder(boost-1_63 in the bundle I used) I also had to add:
- bundle_path/include/boost-1_63 to Include Directories

David Gault
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: VS2015 Build Problems

Postby jm88 » Mon Mar 06, 2017 1:38 am

Hi David,

Yes I initially tried what you suggested. Just to be sure I have ran through it step by step again...

--------------------------------------------------------------------------------------------------

Fresh installation of ome-files-bundle-0.3.2-VC14-x86-Debug-b22.zip to C:\bundle_path\

VS2015 Configuration
Console Application, Precompiled Header On
Build in Debug x64
Additional Include Directories : C:\bundle_path\include;C:\bundle_path\include\boost-1_63;%(AdditionalIncludeDirectories)
Additional Library Directories : C:\bundle_path\lib;%(AdditionalLibraryDirectories);

Use metadata-formatreader.cpp sample code.

When I build, 1st error I get is.
Error LNK1104 cannot open file 'libboost_thread-vc140-mt-gd-1_63.lib' example C:\bundleOME\example\example\LINK 1

--------------------------------------------------------------------------------------------------

I notice that this file does not exist in the C:\bundle_path\lib directory .

I do notice that in downloadable versions of Boost libraries that the file does exist. Is it possible that the superbuild only builds a subset of the files?

Thanks
Justin
jm88
 
Posts: 6
Joined: Thu Mar 02, 2017 4:02 am

Re: VS2015 Build Problems

Postby dgault » Mon Mar 06, 2017 3:45 pm

I have been trying to reproduce the same conditions that you are seeing but have been unsuccessful so far. The naming convention for boost on Windows is that static libraries use the lib prefix (the expected missing file in your case) while import libraries do not (as in the expected boost_thread-vc140-mt-gd-1_63.lib present in the OME Files lib folder).

For some reason the lib file provided in the bundle is not being picked up and it is looking for the static file. Earlier you had mentioned using BOOST_ALL_DYN_LINK which from my understanding should have ensured that the correct file was being used from the lib folder.

One other point that might also be worth considering is that you have the x86 OME Files bundle but the build output is for x64. It might be worth checking if a 32 bit build picks up the correct library.

I will continue investigating to see if I can find an explanation for what is occurring here.

David Gault
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: VS2015 Build Problems

Postby jm88 » Tue Mar 07, 2017 3:01 am

David,

That was a typo on my part. I did use the X64 bundle.

In the super-build, I also noticed that the DLLs are in a bin folder (e.g. C:\bundle_path\bin). I've tried specifying this in lib and include to no avail and also tried moving it to the boost\stage\lib folder as that is what Boost seems to do if I install/build it by itself.

Do you have any other environment variables nominated on your system? Perhaps that is what is missing.

And also to be clear - are you compiling the metadata-formatreader.cpp code?

One other thing - I am using the Community edition - wondering if that is the cause of the issues.

Thanks
Justin
jm88
 
Posts: 6
Joined: Thu Mar 02, 2017 4:02 am

Re: VS2015 Build Problems

Postby dgault » Tue Mar 07, 2017 4:38 pm

Hi Justin,

Just to provide you with an update, with a fresh install of Visual Studio 2015 Community edition I am now able to reproduce the exact same error messages that you have been seeing (cannot open file 'libboost_thread-vc140-mt-gd-1_63.lib', and then the linker errors when using BOOST_ALL_DYN_LINK).

I will continue investigating this afternoon and hopefully have a resolution for you shortly.
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: VS2015 Build Problems

Postby jm88 » Wed Mar 08, 2017 11:05 pm

Hi David,

Good to hear you can reproduce the error.

Apologies for not mentioning Community Version earlier.

Cheers
Justin
jm88
 
Posts: 6
Joined: Thu Mar 02, 2017 4:02 am

Re: VS2015 Build Problems

Postby jm88 » Fri Mar 10, 2017 4:27 am

David,

I installed VS2015 Professional and still get build errors similar to the previous ones (missing libraries, symbol errors, etc)

I will try on another machine to see if I get the same behavior.

Was wondering if you had a project file you could share, along with environment variables/set.

Thanks
Justin
jm88
 
Posts: 6
Joined: Thu Mar 02, 2017 4:02 am

Re: VS2015 Build Problems

Postby dgault » Fri Mar 10, 2017 5:18 pm

Hi Justin,

Sorry for the delayed response, I now have a working solution built in 2015 community available at the link below (upload currently in progress, will be available shortly):
https://github.com/dgault/OME-Files-Bundle_VisualStudio

This is certainly a process which we will be looking at improving in the near future as it is not as easy to setup as it should be.

So the full list of settings should be as follow:
  • In C/C++ -> Preprocessor -> Preprocessor Definitions add: BOOST_ALL_NO_LIB and BOOST_ALL_DYN_LINK
  • In VC++ Directories -> Include Directories add the include folder from the bundle and the include/boost-1_63 folder
  • In VC++ Directories -> Library Directories add the lib folder from the bundle
  • In Linker -> Input -> Additional Dependencies add a list of the lib files used

To save you the effort there is a full list of libs below which can be copied and pasted into the Additional Dependencies settings:

Code: Select all
boost_atomic-vc140-mt-gd-1_63.lib;boost_chrono-vc140-mt-gd-1_63.lib;boost_container-vc140-mt-gd-1_63.lib;boost_context-vc140-mt-gd-1_63.lib;boost_coroutine-vc140-mt-gd-1_63.lib;boost_date_time-vc140-mt-gd-1_63.lib;boost_fiber-vc140-mt-gd-1_63.lib;boost_filesystem-vc140-mt-gd-1_63.lib;boost_graph-vc140-mt-gd-1_63.lib;boost_iostreams-vc140-mt-gd-1_63.lib;boost_locale-vc140-mt-gd-1_63.lib;boost_log-vc140-mt-gd-1_63.lib;boost_log_setup-vc140-mt-gd-1_63.lib;boost_math_c99-vc140-mt-gd-1_63.lib;boost_math_c99f-vc140-mt-gd-1_63.lib;boost_math_c99l-vc140-mt-gd-1_63.lib;boost_math_tr1-vc140-mt-gd-1_63.lib;boost_math_tr1f-vc140-mt-gd-1_63.lib;boost_math_tr1l-vc140-mt-gd-1_63.lib;boost_prg_exec_monitor-vc140-mt-gd-1_63.lib;boost_program_options-vc140-mt-gd-1_63.lib;boost_random-vc140-mt-gd-1_63.lib;boost_regex-vc140-mt-gd-1_63.lib;boost_serialization-vc140-mt-gd-1_63.lib;boost_signals-vc140-mt-gd-1_63.lib;boost_system-vc140-mt-gd-1_63.lib;boost_thread-vc140-mt-gd-1_63.lib;boost_timer-vc140-mt-gd-1_63.lib;boost_type_erasure-vc140-mt-gd-1_63.lib;boost_unit_test_framework-vc140-mt-gd-1_63.lib;boost_wave-vc140-mt-gd-1_63.lib;boost_wserialization-vc140-mt-gd-1_63.lib;bz2d.lib;icudt.lib;icuind.lib;icuiod.lib;iculed.lib;iculxd.lib;icutestd.lib;icutud.lib;icuucd.lib;libboost_chrono-vc140-mt-gd-1_63.lib;libboost_exception-vc140-mt-gd-1_63.lib;libboost_system-vc140-mt-gd-1_63.lib;libboost_test_exec_monitor-vc140-mt-gd-1_63.lib;libboost_timer-vc140-mt-gd-1_63.lib;libboost_unit_test_framework-vc140-mt-gd-1_63.lib;libpng16d.lib;libpng16_staticd.lib;ome-commond.lib;ome-filesd.lib;ome-xmld.lib;tiffd.lib;Xalan-C_1D.lib;XalanExe.lib;XalanMsgLib.lib;xerces-c_3D.lib;zlibd.lib;zlibstaticd.lib;


With Thanks,
David Gault
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: VS2015 Build Problems

Postby jm88 » Wed Mar 15, 2017 3:37 am

David,

Thanks for the effort - finally I could compile it. Hurrah!

Many thanks
Justin
jm88
 
Posts: 6
Joined: Thu Mar 02, 2017 4:02 am


Return to User Discussion [Legacy]

Who is online

Users browsing this forum: No registered users and 1 guest

cron