Home › Forum › SOFA › Building SOFA › [SOLVED] Linker Errors while compiling v15.12 in VS 2015 on Windows 8.1
Tagged: 32_bits, SOFA_1512, vs2015, Windows_81
- This topic has 7 replies, 4 voices, and was last updated 8 years, 4 months ago by Hugo.
-
AuthorPosts
-
29 March 2016 at 16:01 #6399MichaelBlocked
I am a new to SOFA, and I have been trying compile the source code. I have tried following the build instructions for Windows, but I keep running into errors while building. The main problem seems to be that Visual Studio can’t open ‘boost_thread-vc140-mt-gd-1_60.lib’. After that is a series of linker based on not being able to open the previous .lib.
I am working with the 32-bit version of Visual Studio 2015 Community Edition on Windows 8.1.
I am using CMake 3.5.0. I downloaded Qt 5.6.0 32-bit build. I also downloaded Boost for Visual Stuio 2015 32-bit.
I cloned the v15.12 branch and the Windows dependencies as suggested on the build instructions page.
The errors I specifically get is:
2>------ Build started: Project: SofaHelper, Configuration: Debug Win32 ------ 2>LINK : fatal error LNK1104: cannot open file 'boost_thread-vc140-mt-gd-1_60.lib' 3>------ Build started: Project: SofaDefaultType, Configuration: Debug Win32 ------ 3>LINK : fatal error LNK1104: cannot open file '..\..\lib\Debug\SofaHelper_d.lib' 4>------ Build started: Project: SofaCore, Configuration: Debug Win32 ------ 4>LINK : fatal error LNK1104: cannot open file '..\..\lib\Debug\SofaDefaultType_d.lib' … 6>LINK : fatal error LNK1104: cannot open file '..\..\lib\Debug\SofaCore_d.lib' 7>LINK : fatal error LNK1104: cannot open file '..\..\lib\Debug\SofaCore_d.lib'
This pattern goes on.
Boost CMakeCache Entries:
//Boost atomic library (debug) Boost_ATOMIC_LIBRARY_DEBUG:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_atomic-vc140-mt-gd-1_60.lib //Boost atomic library (release) Boost_ATOMIC_LIBRARY_RELEASE:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_atomic-vc140-mt-1_60.lib //Boost chrono library (debug) Boost_CHRONO_LIBRARY_DEBUG:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_chrono-vc140-mt-gd-1_60.lib //Boost chrono library (release) Boost_CHRONO_LIBRARY_RELEASE:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_chrono-vc140-mt-1_60.lib //Boost date_time library (debug) Boost_DATE_TIME_LIBRARY_DEBUG:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_date_time-vc140-mt-gd-1_60.lib //Boost date_time library (release) Boost_DATE_TIME_LIBRARY_RELEASE:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_date_time-vc140-mt-1_60.lib //The directory containing a CMake configuration file for Boost. Boost_DIR:PATH=Boost_DIR-NOTFOUND //Path to a file. Boost_INCLUDE_DIR:PATH=E:/boost_1_60_0 //Boost library directory DEBUG Boost_LIBRARY_DIR_DEBUG:PATH=E:/boost_1_60_0/lib32-msvc-14.0 //Boost library directory RELEASE Boost_LIBRARY_DIR_RELEASE:PATH=E:/boost_1_60_0/lib32-msvc-14.0 //Boost system library (debug) Boost_SYSTEM_LIBRARY_DEBUG:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_system-vc140-mt-gd-1_60.lib //Boost system library (release) Boost_SYSTEM_LIBRARY_RELEASE:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/boost_system-vc140-mt-1_60.lib //Boost thread library (debug) Boost_THREAD_LIBRARY_DEBUG:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/libboost_thread-vc140-mt-1_60.lib //Boost thread library (release) Boost_THREAD_LIBRARY_RELEASE:FILEPATH=E:/boost_1_60_0/lib32-msvc-14.0/libboost_thread-vc140-mt-gd-1_60.lib
I have gotten the binaries download to work on my machine.
If there is any more info I should post, please tell me.
Thanks You,
Michael Cooper1 April 2016 at 13:28 #6419GuillaumeKeymasterHi Michael,
Thank you for working with SOFA !
In CMake-GUI:
– ChangeBoost_THREAD_LIBRARY_DEBUG
value toE:/boost_1_60_0/lib32-msvc-14.0/boost_thread-vc140-mt-gd-1_60.lib
– ChangeBoost_THREAD_LIBRARY_RELEASE
value toE:/boost_1_60_0/lib32-msvc-14.0/boost_thread-vc140-mt-1_60.lib
I corrected this error in the documentation 😉
Hope this helps,
Guillaume1 April 2016 at 18:10 #6445MichaelBlockedThanks Guillaume,
That did seem to fix the error I was having. However, I am now getting another set of errors. The main cause of this seems to be a conflict with MSVCRT. This prevents
SofaLoader_d.dll
,SofaExporter_d.dll
, andSofaMiscTopology_d.dll
from being built. This is from building the debug version.Unlike before, most of the .dlls build successfully and the
runSofa_d.exe
is made. However,runSofa_d.exe
creates an error becauseSofaLoader_d.dll
is missing.I’ll try some of the suggestions I found online for dealing with LNK4098. In the meantime, here are the error messages I am getting.
Build Log:
23>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 23>zlib.lib(gzlib.obj) : error LNK2019: unresolved external symbol __imp__sprintf referenced in function _gzdopen 23>zlib.lib(gzwrite.obj) : error LNK2019: unresolved external symbol __imp__vsnprintf referenced in function _gzprintf 23>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp__vsnprintf 23>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp___vsnprintf 23>E:\sofa\v15.12\build\bin\Debug\SofaLoader_d.dll : fatal error LNK1120: 3 unresolved externals ... 26>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 26>zlib.lib(gzwrite.obj) : error LNK2019: unresolved external symbol __imp__vsnprintf referenced in function _gzprintf 26>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp__vsnprintf 26>zlib.lib(gzlib.obj) : error LNK2019: unresolved external symbol __imp__sprintf referenced in function _gzdopen 26>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp___vsnprintf 26>E:\sofa\v15.12\build\bin\Debug\SofaExporter_d.dll : fatal error LNK1120: 3 unresolved externals ... 37>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 37>zlib.lib(gzlib.obj) : error LNK2019: unresolved external symbol __imp__sprintf referenced in function _gzdopen 37>zlib.lib(gzwrite.obj) : error LNK2019: unresolved external symbol __imp__vsnprintf referenced in function _gzprintf 37>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp__vsnprintf 37>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp___vsnprintf 37>E:\sofa\v15.12\build\bin\Debug\SofaMiscTopology_d.dll : fatal error LNK1120: 3 unresolved externals
Error List:
Code Description Project File LNK2019 unresolved external symbol __imp__sprintf referenced in function _gzdopen SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\zlib.lib(gzlib.obj) LNK2019 unresolved external symbol __imp__vsnprintf referenced in function _gzprintf SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\zlib.lib(gzwrite.obj) LNK2001 unresolved external symbol __imp__vsnprintf SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\MSVCRTD.lib(vsnprintf.obj) LNK2001 unresolved external symbol __imp___vsnprintf SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\MSVCRTD.lib(vsnprintf.obj) LNK1120 3 unresolved externals SofaLoader E:\sofa\v15.12\build\bin\Debug\SofaLoader_d.dll LNK2019 unresolved external symbol __imp__vsnprintf referenced in function _gzprintf SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\zlib.lib(gzwrite.obj) LNK2001 unresolved external symbol __imp__vsnprintf SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\MSVCRTD.lib(vsnprintf.obj) LNK2019 unresolved external symbol __imp__sprintf referenced in function _gzdopen SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\zlib.lib(gzlib.obj) LNK2001 unresolved external symbol __imp___vsnprintf SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\MSVCRTD.lib(vsnprintf.obj) LNK1120 3 unresolved externals SofaExporter E:\sofa\v15.12\build\bin\Debug\SofaExporter_d.dll LNK2019 unresolved external symbol __imp__sprintf referenced in function _gzdopen SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\zlib.lib(gzlib.obj) LNK2019 unresolved external symbol __imp__vsnprintf referenced in function _gzprintf SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\zlib.lib(gzwrite.obj) LNK2001 unresolved external symbol __imp__vsnprintf SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\MSVCRTD.lib(vsnprintf.obj) LNK2001 unresolved external symbol __imp___vsnprintf SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\MSVCRTD.lib(vsnprintf.obj) LNK1120 3 unresolved externals SofaMiscTopology E:\sofa\v15.12\build\bin\Debug\SofaMiscTopology_d.dll
Thanks for the help,
Michael Cooper5 April 2016 at 15:03 #6517FabienBlockedHi Michael,
I faced this issue today by building on VS2015 on Windows10.
The issue comes from the zlib in the dependencies package. You have to find a version built with VS2015 or simply build it from sources from https://github.com/madler/zlibThen you need to place the zlib.dll zlib.lib produced in the corresponding sofa folder. Then that should fix the link issues you gave in the precedent post.
Cheers,
Fabien12 April 2016 at 15:20 #6532MichaelBlockedI have tried recompiling zlib from the sources, however I am still getting errors when I try to compiling SOFA. I followed this guide for compiling zlib, and that seemed to be successful. I end up with a file named “zlibwapi.dll”, however the zlib readme says that I may rename the file to “zlib.dll”.
I am going to keep trying.
Here is the new set of errors I am encountering. Hopefully this should help diagnose the error:
LNK1120 5 unresolved externals SofaMiscTopology E:\sofa\v15.12\build\bin\Debug\SofaMiscTopology_d.dll LNK1120 4 unresolved externals SofaExporter E:\sofa\v15.12\build\bin\Debug\SofaExporter_d.dll LNK1120 5 unresolved externals SofaLoader E:\sofa\v15.12\build\bin\Debug\SofaLoader_d.dll LNK2001 unresolved external symbol _gzputs SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteTopology.obj LNK2001 unresolved external symbol _gzflush SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteTopology.obj LNK2001 unresolved external symbol _gzclose SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteTopology.obj LNK2001 unresolved external symbol _gzopen SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteTopology.obj LNK2001 unresolved external symbol _gzgets SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadTopology.obj LNK2001 unresolved external symbol _gzrewind SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadTopology.obj LNK2001 unresolved external symbol _gzeof SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadTopology.obj LNK2001 unresolved external symbol _gzclose SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadTopology.obj LNK2001 unresolved external symbol _gzopen SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadTopology.obj LNK2019 unresolved external symbol _gzgets referenced in function "public: bool __thiscall sofa::component::misc::TopologicalChangeProcessor::readNext(double,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?readNext@TopologicalChangeProcessor@misc@component@sofa@@QAE_NNAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\TopologicalChangeProcessor.obj LNK2019 unresolved external symbol _gzrewind referenced in function "public: bool __thiscall sofa::component::misc::TopologicalChangeProcessor::readNext(double,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?readNext@TopologicalChangeProcessor@misc@component@sofa@@QAE_NNAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\TopologicalChangeProcessor.obj LNK2019 unresolved external symbol _gzeof referenced in function "public: bool __thiscall sofa::component::misc::TopologicalChangeProcessor::readNext(double,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?readNext@TopologicalChangeProcessor@misc@component@sofa@@QAE_NNAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\TopologicalChangeProcessor.obj LNK2019 unresolved external symbol _gzclose referenced in function "protected: virtual __thiscall sofa::component::misc::TopologicalChangeProcessor::~TopologicalChangeProcessor(void)" (??1TopologicalChangeProcessor@misc@component@sofa@@MAE@XZ) SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\TopologicalChangeProcessor.obj LNK2019 unresolved external symbol _gzopen referenced in function "public: virtual void __thiscall sofa::component::misc::TopologicalChangeProcessor::readDataFile(void)" (?readDataFile@TopologicalChangeProcessor@misc@component@sofa@@UAEXXZ) SofaMiscTopology E:\sofa\v15.12\build\SofaMisc\SofaMiscTopology\TopologicalChangeProcessor.obj LNK2019 unresolved external symbol _gzputs referenced in function "public: virtual void __thiscall sofa::component::misc::WriteState::handleEvent(class sofa::core::objectmodel::Event *)" (?handleEvent@WriteState@misc@component@sofa@@UAEXPAVEvent@objectmodel@core@4@@Z) SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteState.obj LNK2019 unresolved external symbol _gzflush referenced in function "public: virtual void __thiscall sofa::component::misc::WriteState::handleEvent(class sofa::core::objectmodel::Event *)" (?handleEvent@WriteState@misc@component@sofa@@UAEXPAVEvent@objectmodel@core@4@@Z) SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteState.obj LNK2019 unresolved external symbol _gzclose referenced in function "protected: virtual __thiscall sofa::component::misc::WriteState::~WriteState(void)" (??1WriteState@misc@component@sofa@@MAE@XZ) SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteState.obj LNK2019 unresolved external symbol _gzopen referenced in function "public: virtual void __thiscall sofa::component::misc::WriteState::init(void)" (?init@WriteState@misc@component@sofa@@UAEXXZ) SofaExporter E:\sofa\v15.12\build\SofaGeneral\SofaExporter\WriteState.obj LNK2019 unresolved external symbol _gzgets referenced in function "public: bool __thiscall sofa::component::misc::ReadState::readNext(double,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?readNext@ReadState@misc@component@sofa@@QAE_NNAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadState.obj LNK2019 unresolved external symbol _gzrewind referenced in function "public: bool __thiscall sofa::component::misc::ReadState::readNext(double,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?readNext@ReadState@misc@component@sofa@@QAE_NNAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadState.obj LNK2019 unresolved external symbol _gzeof referenced in function "public: bool __thiscall sofa::component::misc::ReadState::readNext(double,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?readNext@ReadState@misc@component@sofa@@QAE_NNAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadState.obj LNK2019 unresolved external symbol _gzclose referenced in function "protected: virtual __thiscall sofa::component::misc::ReadState::~ReadState(void)" (??1ReadState@misc@component@sofa@@MAE@XZ) SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadState.obj LNK2019 unresolved external symbol _gzopen referenced in function "public: virtual void __thiscall sofa::component::misc::ReadState::reset(void)" (?reset@ReadState@misc@component@sofa@@UAEXXZ) SofaLoader E:\sofa\v15.12\build\SofaCommon\SofaLoader\ReadState.obj
– Michael Cooper
12 April 2016 at 16:55 #6533FabienBlockedDid you copy the generated zlib.dll and zlib.lib into the windows dependency folder of your sofa source folder ? (i.e. should something like sofa/v15.12/src/lib/win32 or win64 depending for what arch you build)
Also, did you also copy the zlib.dll into the bin/Debug/ folder where your runSofa.exe is located ?If you have done both well then I cannot tell you more except that it seems to be a zlib linking issue, and… good luck !
Cheers,
Fabien21 April 2016 at 14:11 #6557HugoKeymaster8 August 2016 at 17:17 #7293HugoKeymasterHi @mtcooper115,
How is it going?
Could you let us know whether the topic is solved.FYI a new release of SOFA (v16.08) is now available.
Cheers,Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.