Can I build QxOrm with static link

Forum for posting problems using QxOrm library

Can I build QxOrm with static link

Postby Guest » Thu Jan 19, 2012 4:49 pm

I have built dynamic library(lib+dll) successfully using following config:

QX_BOOST_INCLUDE_PATH = $$quote(E:/Boost)
QX_BOOST_LIB_PATH = $$quote(E:/Boost/stage/lib)
QX_BOOST_LIB_SERIALIZATION_DEBUG = "boost_serialization-vc100-mt-gd-1_45"
QX_BOOST_LIB_SERIALIZATION_RELEASE = "boost_serialization-vc100-mt-1_45"

but when I switch to static boost library as config:

QX_BOOST_INCLUDE_PATH = $$quote(E:/Boost)
QX_BOOST_LIB_PATH = $$quote(E:/Boost/stage/lib)
QX_BOOST_LIB_SERIALIZATION_DEBUG = "libboost_serialization-vc100-mt-gd-1_45"
QX_BOOST_LIB_SERIALIZATION_RELEASE = "libboost_serialization-vc100-mt-1_45"

I got many errors like:

QxSerialize_QObject.obj : error LNK2001: unresolved external symbol "__declspec(
dllimport) public: static bool __cdecl boost::archive::detail::archive_serialize
r_map<class boost::archive::binary_oarchive>::insert(class boost::archive::detai
l::basic_serializer const *)" (__imp_?insert@?$archive_serializer_map@Vbinary_oa
rchive@archive@boost@@@detail@archive@boost@@SA_NPBVbasic_serializer@234@@Z)
QxSerialize_QPicture.obj : error LNK2001: unresolved external symbol "__declspec
(dllimport) public: static bool __cdecl boost::archive::detail::archive_serializ
er_map<class boost::archive::binary_oarchive>::insert(class boost::archive::deta
il::basic_serializer const *)" (__imp_?insert@?$archive_serializer_map@Vbinary_o
archive@archive@boost@@@detail@archive@boost@@SA_NPBVbasic_serializer@234@@Z)
QxSerialize_QPixmap.obj : error LNK2001: unresolved external symbol "__declspec(
dllimport) public: static bool __cdecl boost::archive::detail::archive_serialize
r_map<class boost::archive::binary_oarchive>::insert(class boost::archive::detai
l::basic_serializer const *)" (__imp_?insert@?$archive_serializer_map@Vbinary_oa
rchive@archive@boost@@@detail@archive@boost@@SA_NPBVbasic_serializer@234@@Z)
IxParameter.obj : error LNK2001: unresolved external symbol "__declspec(dllimpor
t) public: static void __cdecl boost::archive::detail::archive_serializer_map<cl
ass boost::archive::binary_oarchive>::erase(class boost::archive::detail::basic_
serializer const *)" (__imp_?erase@?$archive_serializer_map@Vbinary_oarchive@arc
hive@boost@@@detail@archive@boost@@SAXPBVbasic_serializer@234@@Z)
IxService.obj : error LNK2001: unresolved external symbol "__declspec(dllimport)
public: static void __cdecl boost::archive::detail::archive_serializer_map<clas
s boost::archive::binary_oarchive>::erase(class boost::archive::detail::basic_se
rializer const *)" (__imp_?erase@?$archive_serializer_map@Vbinary_oarchive@archi
ve@boost@@@detail@archive@boost@@SAXPBVbasic_serializer@234@@Z)
QxTransaction.obj : error LNK2001: unresolved external symbol "__declspec(dllimp
ort) public: static void __cdecl boost::archive::detail::archive_serializer_map<
class boost::archive::binary_oarchive>::erase(class boost::archive::detail::basi
c_serializer const *)" (__imp_?erase@?$archive_serializer_map@Vbinary_oarchive@a
rchive@boost@@@detail@archive@boost@@SAXPBVbasic_serializer@234@@Z)
QxSerialize_QImage.obj : error LNK2019: unresolved external symbol "__declspec(d
llimport) public: static void __cdecl boost::archive::detail::archive_serializer
_map<class boost::archive::binary_oarchive>::erase(class boost::archive::detail:
:basic_serializer const *)" (__imp_?erase@?$archive_serializer_map@Vbinary_oarch
ive@archive@boost@@@detail@archive@boost@@SAXPBVbasic_serializer@234@@Z) referen
ced in function "public: __thiscall boost::archive::detail::pointer_oserializer<
class boost::archive::binary_oarchive,class QImage>::~pointer_oserializer<class
boost::archive::binary_oarchive,class QImage>(void)" (??1?$pointer_oserializer@V
binary_oarchive@archive@boost@@VQImage@@@detail@archive@boost@@QAE@XZ)
QxSerialize_QObject.obj : error LNK2001: unresolved external symbol "__declspec(
dllimport) public: static void __cdecl boost::archive::detail::archive_serialize
r_map<class boost::archive::binary_oarchive>::erase(class boost::archive::detail
::basic_serializer const *)" (__imp_?erase@?$archive_serializer_map@Vbinary_oarc
hive@archive@boost@@@detail@archive@boost@@SAXPBVbasic_serializer@234@@Z)
QxSerialize_QPicture.obj : error LNK2001: unresolved external symbol "__declspec
(dllimport) public: static void __cdecl boost::archive::detail::archive_serializ
er_map<class boost::archive::binary_oarchive>::erase(class boost::archive::detai
l::basic_serializer const *)" (__imp_?erase@?$archive_serializer_map@Vbinary_oar
chive@archive@boost@@@detail@archive@boost@@SAXPBVbasic_serializer@234@@Z)
QxSerialize_QPixmap.obj : error LNK2001: unresolved external symbol "__declspec(
dllimport) public: static void __cdecl boost::archive::detail::archive_serialize
r_map<class boost::archive::binary_oarchive>::erase(class boost::archive::detail
::basic_serializer const *)" (__imp_?erase@?$archive_serializer_map@Vbinary_oarc
hive@archive@boost@@@detail@archive@boost@@SAXPBVbasic_serializer@234@@Z)
QxSerialize_QPicture.obj : error LNK2019: unresolved external symbol "__declspec
(dllimport) public: class QPicture & __thiscall QPicture::operator=(class QPictu
re &&)" (__imp_??4QPicture@@QAEAAV0@$$QAV0@@Z) referenced in function "void __cd
ecl boost::serialization::qx_load<class boost::archive::binary_iarchive>(class b
oost::archive::binary_iarchive &,class QPicture &,unsigned int)" (??$qx_load@Vbi
nary_iarchive@archive@boost@@@serialization@boost@@YAXAAVbinary_iarchive@archive
@1@AAVQPicture@@I@Z)
QxSerialize_QString.obj : error LNK2019: unresolved external symbol "__declspec(
dllimport) public: static class QString __cdecl QString::fromStdString(class std
::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > c
onst &)" (__imp_?fromStdString@QString@@SA?AV1@ABV?$basic_string@DU?$char_traits
@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: static class
QString __cdecl qx::trait::archive_wide_traits<class boost::archive::xml_iarchiv
e>::cvtQString<0,0>::toQString(class std::basic_string<char,struct std::char_tra
its<char>,class std::allocator<char> > const &)" (?toQString@?$cvtQString@$0A@$0
A@@?$archive_wide_traits@Vxml_iarchive@archive@boost@@@trait@qx@@SA?AVQString@@A
BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
QxSerialize_QUuid.obj : error LNK2019: unresolved external symbol "__declspec(dl
limport) public: __thiscall QUuid::QUuid(class QString const &)" (__imp_??0QUuid
@@QAE@ABVQString@@@Z) referenced in function "void __cdecl boost::serialization:
:qx_load<class boost::archive::binary_iarchive>(class boost::archive::binary_iar
chive &,struct QUuid &,unsigned int)" (??$qx_load@Vbinary_iarchive@archive@boost
@@@serialization@boost@@YAXAAVbinary_iarchive@archive@1@AAUQUuid@@I@Z)
QxSerialize_QVariant.obj : error LNK2019: unresolved external symbol "__declspec
(dllimport) public: class QRegExp & __thiscall QRegExp::operator=(class QRegExp
&&)" (__imp_??4QRegExp@@QAEAAV0@$$QAV0@@Z) referenced in function "void __cdecl
boost::serialization::qx_save<class boost::archive::binary_oarchive>(class boost
::archive::binary_oarchive &,class QVariant const &,unsigned int)" (??$qx_save@V
binary_oarchive@archive@boost@@@serialization@boost@@YAXAAVbinary_oarchive@archi
ve@1@ABVQVariant@@I@Z)
debug\QxOrmd.dll : fatal error LNK1120: 69 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.


Help me please, thanks.
Guest
 

Re: Can I build QxOrm with static link

Postby QxOrm admin » Thu Jan 19, 2012 6:53 pm

Hi,

boost serialization library must be builded with shared library mode.
I never tested static mode but I think it will not work because of singleton implementation of boost serialization library.

Sorry, you have to use shared library with QxOrm ;)
QxOrm admin
 

Re: Can I build QxOrm with static link

Postby Guest » Fri Jan 20, 2012 3:08 am

QxOrm admin wrote:Hi,

boost serialization library must be builded with shared library mode.
I never tested static mode but I think it will not work because of singleton implementation of boost serialization library.

Sorry, you have to use shared library with QxOrm ;)


Thanks a lot. :D
Guest
 

Re: Can I build QxOrm with static link

Postby Guest » Fri Jan 20, 2012 3:14 am

BTW. Is there any plan to support static mode in the future?
Guest
 

Re: Can I build QxOrm with static link

Postby QxOrm admin » Fri Jan 20, 2012 8:21 am

static mode could work on Linux but I never tested it.
And there is no plan to support it in the future.
Maybe if a lot of people ask me to support it, but now this is not a priority.
QxOrm admin
 

Re: Can I build QxOrm with static link

Postby QxOrm admin » Tue Jan 31, 2012 11:38 am

I just uploaded a first BETA version for QxOrm 1.2.3, you can download it here :
http://www.qxorm.com/version/QxOrm_1.2.3_BETA_03.zip

This version supports static build ! (at least, it works on my computer :) )
To build QxOrm into static mode, you just have to modify QxOrm.pri file :

Code: Select all
##############################
# QxOrm Library Static Build #
##############################

# To create only 1 EXE including Qt, boost serialization and QxOrm libraries without any dependency :
#   1- be sure to build Qt and boost::serialization using static mode
#   2- in "./QxOrm.pri" file, add the following line : "DEFINES += _QX_STATIC_BUILD"
#   3- BUT PLEASE : in your program, add a "readme.txt" file and a "about my program..." window to indicate that your application is based on Qt, boost and QxOrm libraries !
# Note : on Windows, static mode works with only 1 EXE, it will never work mixing DLL and EXE (because of singleton implementation of boost::serialization and QxOrm libraries)

# DEFINES += _QX_STATIC_BUILD
QxOrm admin
 

Re: Can I build QxOrm with static link

Postby caseybasichis » Sun Mar 11, 2012 1:59 am

You mention that this wont work with exe+dll.

That would include a dll only build, where this was being included into a vst audio plugin .dll right?

Its not critical either way as I can link dynamically on windows, and still use the static build where it is required on ios. Just wanted to see if the easy way was viable.
caseybasichis
 

Re: Can I build QxOrm with static link

Postby QxOrm admin » Mon Mar 12, 2012 8:36 am

You mention that this wont work with exe+dll.
That would include a dll only build, where this was being included into a vst audio plugin .dll right?

Sorry, I don't understand what you say !

Here is the typical way to use QxOrm :
1- build Qt dynamically
2- build boost serialization dynamically
3- buid QxOrm dynamically
4- ===> so your final exec will have some dll dependencies (Qt, boost and QxOrm)

With the BETA version of QxOrm 1.2.3, there is a new mode of compilation to build QxOrm statically => it means that your final exec will not have any dll dependencies (but be careful with licenses).
For my tests, it works on Windows with this configuration :
1- build Qt dynamically
2- build boost serialization statically
3- buid QxOrm statically
4- ===> so your final exec will have only Qt dll dependencies

I have not tried to build Qt statically but it seems that magicu has some problems with this configuration.
See this topic for more details : viewtopic.php?f=3&t=77
QxOrm admin
 


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 2 guests