pocoproject / conan-poco

Conan.io package for POCO C++ Libraries
17 stars 28 forks source link

undefined reference errors when setting Poco:enable_data_odbc=True #31

Open bmulder-innoseis opened 5 years ago

bmulder-innoseis commented 5 years ago

When setting the option Poco:enable_data_odbc=True in conanfile.txt, I get a lot of undefined reference errors when compiling an application that uses the Poco ODBC libs.

The errors all look like this: /home/boris/.conan/data/Poco/1.9.0/pocoproject/stable/package/8ff847771efbee842b91e2e6c0d9a317b218c63c/lib/libPocoDataODBC.a(Parameter.cpp.o): In function 'Poco::Data::ODBC::Parameter::init()': Parameter.cpp:(.text+0x3b): undefined reference to 'SQLDescribeParam' collect2: error: ld returned 1 exit status

When setting Poco:shared=True , this does not happen. I would like to link Poco statically to my program and use ODBC. Any ideas what could cause this?

bmulder-innoseis commented 5 years ago

By the way, I am building with stdc++11 and I have set compiler.libcxx=libstdc++11 in .conan/profiles/default. Perhaps there could be an ABI incompatibility issue?

bmulder-innoseis commented 5 years ago

It seems this is a linking order problem again. To solve it, you need to:

  1. Apply the fix here: https://github.com/pocoproject/conan-poco/pull/28
  2. Link odbc after linking Poco (i.e. in cmakefile, you say `target_link_libraries(mytarget ${CONAN_LIBS} odbc)