How to build a statically linked version Ceres

743 views
Skip to first unread message

Isaac Gerg

unread,
Mar 19, 2014, 6:24:44 PM3/19/14
to ceres-...@googlegroups.com
Hi,

I am on windows 7, x64 using visual studio 2010.  I would like to build Ceres statically,  but cant get past the following linker errors.  What am I doing wrong?

2>libcpmt.lib(cout.obj) : error LNK2005: "public: virtual __cdecl std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ) already defined in libglog.lib(libglog.dll)
2>libcpmt.lib(cout.obj) : error LNK2005: "protected: __cdecl std::basic_ios<char,struct std::char_traits<char> >::basic_ios<char,struct std::char_traits<char> >(void)" (??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ) already defined in libglog.lib(libglog.dll)
2>libcpmt.lib(cout.obj) : error LNK2005: "public: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z) already defined in libglog.lib(libglog.dll)
2>libcpmt.lib(cout.obj) : error LNK2005: "protected: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::init(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" (?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z) already defined in libglog.lib(libglog.dll)
2>C:\Users\PSU\Desktop\ceres\ceres-bin\bin\Release\helloworld.exe : fatal error LNK1169: one or more multiply defined symbols found

I have verified that glog is compiled using libcmt.

Thanks in advance,
Isaac

Sameer Agarwal

unread,
Mar 19, 2014, 6:29:24 PM3/19/14
to ceres-...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/fd3f7c83-ac44-4719-975f-ed67a4c5ae38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Isaac Gerg

unread,
Mar 19, 2014, 6:40:10 PM3/19/14
to ceres-...@googlegroups.com
Already read and investigated that :(

Isaac Gerg

unread,
Mar 20, 2014, 2:47:57 PM3/20/14
to ceres-...@googlegroups.com
I solve the issues.

In addition to building everything with libcmt, I had to add the preprocessor definition of "GOOGLE_GLOG_DLL_DECL=' and put a define in before includes ceres.

#define GLOG_NO_ABBREVIATED_SEVERITIES
#include "ceres/ceres.h"


Hope this makes it into documentation somewhere.

Sameer Agarwal

unread,
Mar 20, 2014, 2:49:57 PM3/20/14
to ceres-...@googlegroups.com
Isaac,
How did you come about this information? and would you be willing to write a patch to the windows building instructions? It would be much appreciated.
Sameer



--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.

Isaac Gerg

unread,
Mar 20, 2014, 3:37:01 PM3/20/14
to ceres-...@googlegroups.com
These two links:

I do not have time to write a patch and test it.  I hate uttering these words since I understand how hard it is to run open source at time -- I have a project of my own.  But, I am really in a time crunch right now.  I am happy to answer questions though about what i did for someone else to create a patch.

Sameer Agarwal

unread,
Mar 20, 2014, 5:03:40 PM3/20/14
to ceres-...@googlegroups.com
Both of these issues that you link to are rather ancient and it seems one of was already fixed in gflags. How are you still seeing them?
Sameer



Keir Mierle

unread,
Mar 20, 2014, 5:10:38 PM3/20/14
to ceres-...@googlegroups.com
Perhaps try using a static libglog?


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.

Isaac Gerg

unread,
Mar 20, 2014, 5:30:50 PM3/20/14
to ceres-...@googlegroups.com
So I thought the same thing.  It didnt work.  I still got linking errors when trying to run the curve_fitting example.  The only thing that fixed it was setting the preprocessor definition I mentioned above.
Reply all
Reply to author
Forward
0 new messages