-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot build using mingw on Ubuntu and conan #548
Comments
Looks like your build is either not linking to libpqxx at all, or is
linking to a binary that was built with very different build options or
even a different compiler.
…On Sat, Mar 19, 2022, 02:35 Imanuel Ulbricht ***@***.***> wrote:
Hey,
when I try to build an app that uses this library and wxWidgets. When ever
I try to build the app using mingw on Ubuntu it fails with the following
error:
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0x2b): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0x4a): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0x89): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(main.cpp.obj):main.cpp:(.text.startup+0xa8): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainApp.cpp.obj):MainApp.cpp:(.text.startup+0x2b): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainApp.cpp.obj):MainApp.cpp:(.text.startup+0x4a): more undefined references to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)' follow
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x24b9): undefined reference to `pqxx::connection::init(char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x24f4): undefined reference to `pqxx::internal::basic_transaction::basic_transaction(pqxx::connection&, pqxx::zview)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x253d): undefined reference to `pqxx::connection::esc[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x274a): undefined reference to `pqxx::transaction_base::exec(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2782): undefined reference to `pqxx::result::begin() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x278a): undefined reference to `pqxx::result::size() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2794): undefined reference to `pqxx::result::columns() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x27b5): undefined reference to `pqxx::row::row(pqxx::result const&, int, int)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2e23): undefined reference to `pqxx::row::operator[](pqxx::zview) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2e2b): undefined reference to `pqxx::field::is_null() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2e3b): undefined reference to `pqxx::field::size() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2e46): undefined reference to `pqxx::field::c_str() const &'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2e5e): undefined reference to `pqxx::internal::float_traits<float>::from_string(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2e92): undefined reference to `pqxx::row::operator[](pqxx::zview) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2e9a): undefined reference to `pqxx::field::is_null() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2eaa): undefined reference to `pqxx::field::size() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2eb5): undefined reference to `pqxx::field::c_str() const &'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2ecd): undefined reference to `pqxx::internal::float_traits<float>::from_string(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f02): undefined reference to `pqxx::row::operator[](pqxx::zview) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f0a): undefined reference to `pqxx::field::is_null() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f1a): undefined reference to `pqxx::field::size() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f25): undefined reference to `pqxx::field::c_str() const &'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f3d): undefined reference to `pqxx::internal::float_traits<double>::from_string(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f73): undefined reference to `pqxx::row::operator[](pqxx::zview) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f7b): undefined reference to `pqxx::field::is_null() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f8b): undefined reference to `pqxx::field::size() const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2f96): undefined reference to `pqxx::field::c_str() const &'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2fae): undefined reference to `pqxx::internal::float_traits<double>::from_string(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2fed): undefined reference to `pqxx::row::operator[](pqxx::zview) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x2ff5): undefined reference to `pqxx::field::c_str() const &'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x310d): undefined reference to `pqxx::row::operator[](pqxx::zview) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x3115): undefined reference to `pqxx::field::c_str() const &'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x3225): undefined reference to `pqxx::row::operator[](pqxx::zview) const'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x322d): undefined reference to `pqxx::field::c_str() const &'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x3aed): undefined reference to `pqxx::transaction_base::commit()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x3c9e): undefined reference to `pqxx::transaction_base::close()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x3ca6): undefined reference to `pqxx::internal::basic_transaction::~basic_transaction()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x3cb3): undefined reference to `pqxx::connection::close()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x3f2d): undefined reference to `pqxx::internal::check_pqxx_version_7_7()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x422f): undefined reference to `pqxx::internal::throw_null_conversion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x423b): undefined reference to `pqxx::internal::throw_null_conversion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x4247): undefined reference to `pqxx::internal::throw_null_conversion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x4253): undefined reference to `pqxx::internal::throw_null_conversion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x43a5): undefined reference to `pqxx::transaction_base::close()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text+0x43ad): undefined reference to `pqxx::internal::basic_transaction::~basic_transaction()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text$_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED1Ev[_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED1Ev]+0x14): undefined reference to `pqxx::transaction_base::close()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text$_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED1Ev[_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED1Ev]+0x22): undefined reference to `pqxx::internal::basic_transaction::~basic_transaction()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text$_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED0Ev[_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED0Ev]+0x14): undefined reference to `pqxx::transaction_base::close()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text$_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED0Ev[_ZN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EED0Ev]+0x1c): undefined reference to `pqxx::internal::basic_transaction::~basic_transaction()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text$_ZN4pqxx10connectionD1Ev[_ZN4pqxx10connectionD1Ev]+0xc): undefined reference to `pqxx::connection::close()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text.startup+0x2b): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text.startup+0x4a): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text.startup+0x78): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text.startup+0xa6): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text.startup+0xd4): undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.text.startup+0xf3): more undefined references to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)' follow
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.rdata$_ZTVN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EEE[_ZTVN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EEE]+0x20): undefined reference to `pqxx::internal::basic_transaction::do_commit()'
/usr/bin/x86_64-w64-mingw32-ld: CMakeFiles/filament_manager.dir/objects.a(MainWindow.cpp.obj):MainWindow.cpp:(.rdata$_ZTVN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EEE[_ZTVN4pqxx11transactionILNS_15isolation_levelE0ELNS_12write_policyE1EEE]+0x28): undefined reference to `pqxx::transaction_base::do_abort()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/filament_manager.dir/build.make:151: bin/filament_manager.exe] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:526: CMakeFiles/filament_manager.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2
The command '/bin/sh -c cmake --build build/' returned a non-zero code: 2
The issue can be reproduced with the following Dockerfile:
FROM ubuntu:rolling
ENV DEBIAN_FRONTEND noninteractiveRUN apt-get update && apt-get upgrade -yRUN apt-get install mingw-w64 mingw-w64-x86-64-dev g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 build-essential cmake git wget -yRUN wget https://github.com/conan-io/conan/releases/latest/download/conan-ubuntu-64.debRUN dpkg -i conan-ubuntu-64.debRUN git clone https://github.com/DerKnerd/filament-browser.gitWORKDIR /filament-browserRUN git checkout e513b687d92de70bd83ad100b642032c8c44124cRUN git submodule update --init --recursiveRUN cmake -DCMAKE_TOOLCHAIN_FILE=/filament-browser/mingw-w64-x86_64.cmake -B build -S /filament-browser -DCMAKE_BUILD_TYPE=ReleaseRUN cmake --build build/
And here is the CMakeList.txt I use:
cmake_minimum_required(VERSION 3.16)project(filament_manager CXX)
set(CMAKE_CXX_STANDARD 20)
include(./ucm.cmake)include(./conan.cmake)
ucm_set_runtime(STATIC)if (WIN32 OR MINGW)
add_compile_definitions(__WXMSW__ _UNICODE)
set(BUILD_SHARED_LIBS false)
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CONAN_ARCHITECTURE x86_64)
set(CMAKE_WIN32_EXECUTABLE 1)
set(options Poco:enable_netssl_win=True Poco:enable_netssl=False)
conan_cmake_run(
BASIC_SETUP
ARCH ${CONAN_ARCHITECTURE}
ENV CC=${CMAKE_C_COMPILER}
ENV CXX=${CMAKE_CXX_COMPILER}
ENV CFLAGS=${CMAKE_C_FLAGS}
ENV CXXFLAGS=${CMAKE_CXX_FLAGS}
SETTINGS os=Windows
SETTINGS compiler.cppstd=20
)endif ()
set(wxUSE_STL ON)set(wxBUILD_SHARED OFF)add_subdirectory(libs/wxWidgets)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
conan_cmake_configure(
REQUIRES libpqxx/7.7.0
GENERATORS cmake_find_package
)
conan_cmake_autodetect(settings)
conan_cmake_install(PATH_OR_REFERENCE .
BUILD missing
REMOTE conancenter
SETTINGS ${settings}
SETTINGS ${CONAN_SETTINGS}
OPTIONS Poco:enable_netssl_win=True Poco:enable_netssl=False)
find_package(libpqxx)
add_executable(filament_manager ${target} main.cpp MainApp.h MainApp.cpp MainWindow.cpp MainWindow.h)target_link_libraries(filament_manager PRIVATE libpqxx::libpqxx wx::core wx::base)
And this is the toolchain file:
# Sample toolchain file for building for Windows from an Ubuntu Linux system.## Typical usage:# *) install cross compiler: `sudo apt-get install mingw-w64`# *) cd build# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake ..
set(CMAKE_SYSTEM_NAME Windows)set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
# cross compilers to use for C, C++ and Fortranset(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
# target environment on the build host systemset(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
# modify default behavior of FIND_XXX() commandsset(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Do you by any chance know what causes this issue?
—
Reply to this email directly, view it on GitHub
<#548>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQYDE27HE5RT6K5W2OQL2TVAUVODANCNFSM5RDJKDVQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thats interesting, building it with MSVC on Windows and using gcc on Arch Linux works fine. I might have to dig a bit into the conan config. Do you by any chance know anything how I can force conan to use the same compiler? |
Don't know conan, sorry. But in general with C++ you can't expect to link two object files or libraries that were compiled with the same compiler. Some compilers may be binary-compatible with some other compilers, but IMHO tooling made for C++ should probably be designed to use the same compiler across everything that links into the same application. Another complication by the way is debug mode. Many compilers will let you compile code for "debug" or for "release." The two modes produce different binaries, which you can't link together. It's also possible that that's what went wrong here. |
Thank you for your fast replies. I dug the conan docs a bit deeper and found more details for cross compile. But when I use
After checking through existing issue I couldn't find a similar issue from anyone else, do you happen to know what is missing there? |
Looks like a missing header in util.cxx. The code there tries to use Linux
poll() or Windows WGAPoll() (if I remember the name right) where available,
but falls back to select() as a last resort. And evidently it fails to
#include a header that select() needs.
Could you check which headers we need to include on your system in order to
use select()? We can then compare to what the code does include, and make
a change.
…On Sat, Mar 19, 2022, 05:27 Imanuel Ulbricht ***@***.***> wrote:
Thank you for your fast replies. I dug the conan docs a bit deeper and
found more details for cross compile. But when I use
x86_64-w64-ming32-gcc-win32 for compilation, I get the following error:
/root/.conan/data/libpqxx/7.7.0/_/_/build/ba599f31ceb475d8920e5a73fcfc87943658e2a3/source_subfolder/src/util.cxx:227:3: error: 'select' was not declared in this scope
227 | select(0, nullptr, nullptr, nullptr, &tv);
After checking through existing issue I couldn't find a similar issue from
anyone else, do you happen to know what is missing there?
—
Reply to this email directly, view it on GitHub
<#548 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQYDEY6OIDXJUUPHFWXBUTVAVJTZANCNFSM5RDJKDVQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
Found it. Turns out Could you try the latest commit? Should fix it. |
@DerKnerd I ended up making some pretty far-reaching changes today. Shouldn't affect binary compatibility, but there's always a risk of breaking compatibility with some systems. Could you try the very latest commit for me, to see if everything still works? I think I managed to make compiles a bit faster in the process. |
@jtv I would love to, but for that I would first need an update for the conan version. Since it isn't git based I can't change the branch :/ |
Anything I can do to make that happen (bearing in mind though that I don't know the first thing about conan)? |
AFAIK there needs to be a new conan release, they are managed in a different repo and usually update after you create a new release. So you would need to create a release and I have to wait til they update it. |
@DerKnerd If you import the libpqxx project into your project with the set(wxUSE_STL ON)
set(wxBUILD_SHARED OFF)
add_subdirectory(libs/wxWidgets)
+add_subdirectory(libs/libpqxx)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
-conan_cmake_configure(
- REQUIRES libpqxx/7.7.0 REQUIRES libpqxx/7.7.0
- GENERATORS cmake_find_package GENERATORS cmake_find_package
-)
+# conan_cmake_configure(
+# REQUIRES libpqxx/7.7.0 REQUIRES libpqxx/7.7.0
+# GENERATORS cmake_find_package GENERATORS cmake_find_package
+# )
+conan_cmake_configure(
+ REQUIRES libpq/12.2 REQUIRES libpq/12.2
+ GENERATORS cmake_find_package GENERATORS cmake_find_package
+) |
@tt4g I updated the code and added the submodule, I now get a new error, but still only with mingw.
|
@DerKnerd I built the Dockerfile from NOTE I installed the postgresql library with cmake -DCMAKE_TOOLCHAIN_FILE=/filament-browser/mingw-w64-x86_64.cmake -B build -S /filament-browser -DCMAKE_BUILD_TYPE=Release -DWIN32=1 \
+ -DPostgreSQL_INCLUDE_DIR=/usr/include/postgresql \
+ -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql \
+ -DPostgreSQL_LIBRARY=/usr/lib/x86_64-linux-gnu/libpq.so The error message suggests that the symbolic link If you are doing your work on a Docker container, recreating the container may stop the problem. BTW, I cloned Logroot@1360f6c471d4:/workspaces# mkdir _
root@1360f6c471d4:/workspaces# cd _
root@1360f6c471d4:/workspaces/_# git clone https://github.com/jtv/libpqxx.git
Cloning into 'libpqxx'...
remote: Enumerating objects: 38207, done.
remote: Counting objects: 100% (3807/3807), done.
remote: Compressing objects: 100% (1171/1171), done.
remote: Total 38207 (delta 2994), reused 3271 (delta 2608), pack-reused 34400
Receiving objects: 100% (38207/38207), 9.30 MiB | 8.44 MiB/s, done.
Resolving deltas: 100% (30994/30994), done.
root@1360f6c471d4:/workspaces/_# cd libpqxx/
root@1360f6c471d4:/workspaces/_/libpqxx/build# git rev-parse HEAD
20fc436375617c6549c6678b615c1b6fc768104e
root@1360f6c471d4:/workspaces/_/libpqxx# mkdir build
root@1360f6c471d4:/workspaces/_/libpqxx# cd build/
root@1360f6c471d4:/workspaces/_/libpqxx/build# cmake -DPostgreSQL_INCLUDE_DIR=/usr/include/postgresql -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql -DPostgreSQL_LIBRARY=/usr/lib/x86_64-linux-gnu/libpq.so ..
-- Found PostgreSQL: /usr/lib/x86_64-linux-gnu/libpq.so (found version "13.6")
-- Looking for poll
-- Looking for poll - found
-- Looking for PQencryptPasswordConn
-- Looking for PQencryptPasswordConn - found
-- Looking for PQenterPipelineMode
-- Looking for PQenterPipelineMode - not found
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Generating config.h
-- Generating config.h - done
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/_/libpqxx/build
root@1360f6c471d4:/workspaces/_/libpqxx/build# cmake --build .
Scanning dependencies of target pqxx
[ 0%] Building CXX object src/CMakeFiles/pqxx.dir/array.cxx.o
[ 1%] Building CXX object src/CMakeFiles/pqxx.dir/binarystring.cxx.o
[ 2%] Building CXX object src/CMakeFiles/pqxx.dir/blob.cxx.o
[ 3%] Building CXX object src/CMakeFiles/pqxx.dir/connection.cxx.o
[ 4%] Building CXX object src/CMakeFiles/pqxx.dir/cursor.cxx.o
[ 5%] Building CXX object src/CMakeFiles/pqxx.dir/encodings.cxx.o
[ 6%] Building CXX object src/CMakeFiles/pqxx.dir/errorhandler.cxx.o
[ 7%] Building CXX object src/CMakeFiles/pqxx.dir/except.cxx.o
[ 7%] Building CXX object src/CMakeFiles/pqxx.dir/field.cxx.o
[ 8%] Building CXX object src/CMakeFiles/pqxx.dir/largeobject.cxx.o
[ 9%] Building CXX object src/CMakeFiles/pqxx.dir/notification.cxx.o
[ 10%] Building CXX object src/CMakeFiles/pqxx.dir/params.cxx.o
[ 11%] Building CXX object src/CMakeFiles/pqxx.dir/pipeline.cxx.o
[ 12%] Building CXX object src/CMakeFiles/pqxx.dir/result.cxx.o
[ 13%] Building CXX object src/CMakeFiles/pqxx.dir/robusttransaction.cxx.o
[ 14%] Building CXX object src/CMakeFiles/pqxx.dir/row.cxx.o
[ 14%] Building CXX object src/CMakeFiles/pqxx.dir/sql_cursor.cxx.o
[ 15%] Building CXX object src/CMakeFiles/pqxx.dir/strconv.cxx.o
[ 16%] Building CXX object src/CMakeFiles/pqxx.dir/stream_from.cxx.o
[ 17%] Building CXX object src/CMakeFiles/pqxx.dir/stream_to.cxx.o
[ 18%] Building CXX object src/CMakeFiles/pqxx.dir/subtransaction.cxx.o
[ 19%] Building CXX object src/CMakeFiles/pqxx.dir/time.cxx.o
[ 20%] Building CXX object src/CMakeFiles/pqxx.dir/transaction.cxx.o
[ 21%] Building CXX object src/CMakeFiles/pqxx.dir/transaction_base.cxx.o
[ 21%] Building CXX object src/CMakeFiles/pqxx.dir/util.cxx.o
[ 22%] Building CXX object src/CMakeFiles/pqxx.dir/version.cxx.o
[ 23%] Building CXX object src/CMakeFiles/pqxx.dir/wait.cxx.o
[ 24%] Linking CXX static library libpqxx-7.7.a
[ 24%] Built target pqxx
Scanning dependencies of target runner
[ 25%] Building CXX object test/CMakeFiles/runner.dir/runner.cxx.o
[ 26%] Building CXX object test/CMakeFiles/runner.dir/test00.cxx.o
[ 27%] Building CXX object test/CMakeFiles/runner.dir/test01.cxx.o
[ 28%] Building CXX object test/CMakeFiles/runner.dir/test02.cxx.o
[ 28%] Building CXX object test/CMakeFiles/runner.dir/test04.cxx.o
[ 29%] Building CXX object test/CMakeFiles/runner.dir/test07.cxx.o
[ 30%] Building CXX object test/CMakeFiles/runner.dir/test10.cxx.o
[ 31%] Building CXX object test/CMakeFiles/runner.dir/test11.cxx.o
[ 32%] Building CXX object test/CMakeFiles/runner.dir/test13.cxx.o
[ 33%] Building CXX object test/CMakeFiles/runner.dir/test14.cxx.o
[ 34%] Building CXX object test/CMakeFiles/runner.dir/test16.cxx.o
[ 35%] Building CXX object test/CMakeFiles/runner.dir/test17.cxx.o
[ 35%] Building CXX object test/CMakeFiles/runner.dir/test18.cxx.o
[ 36%] Building CXX object test/CMakeFiles/runner.dir/test20.cxx.o
[ 37%] Building CXX object test/CMakeFiles/runner.dir/test21.cxx.o
[ 38%] Building CXX object test/CMakeFiles/runner.dir/test26.cxx.o
[ 39%] Building CXX object test/CMakeFiles/runner.dir/test29.cxx.o
[ 40%] Building CXX object test/CMakeFiles/runner.dir/test30.cxx.o
[ 41%] Building CXX object test/CMakeFiles/runner.dir/test32.cxx.o
[ 42%] Building CXX object test/CMakeFiles/runner.dir/test37.cxx.o
[ 42%] Building CXX object test/CMakeFiles/runner.dir/test39.cxx.o
[ 43%] Building CXX object test/CMakeFiles/runner.dir/test46.cxx.o
[ 44%] Building CXX object test/CMakeFiles/runner.dir/test56.cxx.o
[ 45%] Building CXX object test/CMakeFiles/runner.dir/test60.cxx.o
[ 46%] Building CXX object test/CMakeFiles/runner.dir/test61.cxx.o
[ 47%] Building CXX object test/CMakeFiles/runner.dir/test62.cxx.o
[ 48%] Building CXX object test/CMakeFiles/runner.dir/test69.cxx.o
[ 49%] Building CXX object test/CMakeFiles/runner.dir/test70.cxx.o
[ 50%] Building CXX object test/CMakeFiles/runner.dir/test71.cxx.o
[ 50%] Building CXX object test/CMakeFiles/runner.dir/test72.cxx.o
[ 51%] Building CXX object test/CMakeFiles/runner.dir/test74.cxx.o
[ 52%] Building CXX object test/CMakeFiles/runner.dir/test75.cxx.o
[ 53%] Building CXX object test/CMakeFiles/runner.dir/test76.cxx.o
[ 54%] Building CXX object test/CMakeFiles/runner.dir/test77.cxx.o
[ 55%] Building CXX object test/CMakeFiles/runner.dir/test78.cxx.o
[ 56%] Building CXX object test/CMakeFiles/runner.dir/test79.cxx.o
[ 57%] Building CXX object test/CMakeFiles/runner.dir/test82.cxx.o
[ 57%] Building CXX object test/CMakeFiles/runner.dir/test84.cxx.o
[ 58%] Building CXX object test/CMakeFiles/runner.dir/test87.cxx.o
[ 59%] Building CXX object test/CMakeFiles/runner.dir/test88.cxx.o
[ 60%] Building CXX object test/CMakeFiles/runner.dir/test89.cxx.o
[ 61%] Building CXX object test/CMakeFiles/runner.dir/test90.cxx.o
[ 62%] Building CXX object test/CMakeFiles/runner.dir/unit/test_array.cxx.o
[ 63%] Building CXX object test/CMakeFiles/runner.dir/unit/test_binarystring.cxx.o
[ 64%] Building CXX object test/CMakeFiles/runner.dir/unit/test_blob.cxx.o
[ 64%] Building CXX object test/CMakeFiles/runner.dir/unit/test_cancel_query.cxx.o
[ 65%] Building CXX object test/CMakeFiles/runner.dir/unit/test_column.cxx.o
[ 66%] Building CXX object test/CMakeFiles/runner.dir/unit/test_composite.cxx.o
[ 67%] Building CXX object test/CMakeFiles/runner.dir/unit/test_connection.cxx.o
[ 68%] Building CXX object test/CMakeFiles/runner.dir/unit/test_cursor.cxx.o
[ 69%] Building CXX object test/CMakeFiles/runner.dir/unit/test_encodings.cxx.o
[ 70%] Building CXX object test/CMakeFiles/runner.dir/unit/test_error_verbosity.cxx.o
[ 71%] Building CXX object test/CMakeFiles/runner.dir/unit/test_errorhandler.cxx.o
[ 71%] Building CXX object test/CMakeFiles/runner.dir/unit/test_escape.cxx.o
[ 72%] Building CXX object test/CMakeFiles/runner.dir/unit/test_exceptions.cxx.o
[ 73%] Building CXX object test/CMakeFiles/runner.dir/unit/test_field.cxx.o
[ 74%] Building CXX object test/CMakeFiles/runner.dir/unit/test_float.cxx.o
[ 75%] Building CXX object test/CMakeFiles/runner.dir/unit/test_largeobject.cxx.o
[ 76%] Building CXX object test/CMakeFiles/runner.dir/unit/test_nonblocking_connect.cxx.o
[ 77%] Building CXX object test/CMakeFiles/runner.dir/unit/test_notification.cxx.o
[ 78%] Building CXX object test/CMakeFiles/runner.dir/unit/test_pipeline.cxx.o
[ 78%] Building CXX object test/CMakeFiles/runner.dir/unit/test_prepared_statement.cxx.o
[ 79%] Building CXX object test/CMakeFiles/runner.dir/unit/test_range.cxx.o
[ 80%] Building CXX object test/CMakeFiles/runner.dir/unit/test_read_transaction.cxx.o
[ 81%] Building CXX object test/CMakeFiles/runner.dir/unit/test_result_iteration.cxx.o
[ 82%] Building CXX object test/CMakeFiles/runner.dir/unit/test_result_slicing.cxx.o
[ 83%] Building CXX object test/CMakeFiles/runner.dir/unit/test_row.cxx.o
[ 84%] Building CXX object test/CMakeFiles/runner.dir/unit/test_separated_list.cxx.o
[ 85%] Building CXX object test/CMakeFiles/runner.dir/unit/test_simultaneous_transactions.cxx.o
[ 85%] Building CXX object test/CMakeFiles/runner.dir/unit/test_sql_cursor.cxx.o
[ 86%] Building CXX object test/CMakeFiles/runner.dir/unit/test_stateless_cursor.cxx.o
[ 87%] Building CXX object test/CMakeFiles/runner.dir/unit/test_strconv.cxx.o
[ 88%] Building CXX object test/CMakeFiles/runner.dir/unit/test_stream_from.cxx.o
[ 89%] Building CXX object test/CMakeFiles/runner.dir/unit/test_stream_to.cxx.o
[ 90%] Building CXX object test/CMakeFiles/runner.dir/unit/test_string_conversion.cxx.o
[ 91%] Building CXX object test/CMakeFiles/runner.dir/unit/test_subtransaction.cxx.o
[ 92%] Building CXX object test/CMakeFiles/runner.dir/unit/test_test_helpers.cxx.o
[ 92%] Building CXX object test/CMakeFiles/runner.dir/unit/test_thread_safety_model.cxx.o
[ 93%] Building CXX object test/CMakeFiles/runner.dir/unit/test_time.cxx.o
[ 94%] Building CXX object test/CMakeFiles/runner.dir/unit/test_transaction.cxx.o
[ 95%] Building CXX object test/CMakeFiles/runner.dir/unit/test_transaction_base.cxx.o
[ 96%] Building CXX object test/CMakeFiles/runner.dir/unit/test_transaction_focus.cxx.o
[ 97%] Building CXX object test/CMakeFiles/runner.dir/unit/test_transactor.cxx.o
[ 98%] Building CXX object test/CMakeFiles/runner.dir/unit/test_type_name.cxx.o
[ 99%] Building CXX object test/CMakeFiles/runner.dir/unit/test_zview.cxx.o
[100%] Linking CXX executable runner
[100%] Built target runner
root@1360f6c471d4:/workspaces/_/libpqxx/build# |
@tt4g hey, under Linux it builds completly fine, only in my mingw environment it fails. I updated the code and pushed it to Github, would you mind checking if it builds now? I still get the same error. I adjusted the add_subdirectory calls to use absolute paths instead of relative ones, but no luck. |
@DerKnerd Are Can you try to build a cloned libpqxx repository in your MinGW environment? |
If you are using a network drive, it may be related to error |
@tt4g The mingw environment resides inside a Ubuntu docker container. So it shouldn't be a machine specific issue. As I said on the Arch Linux host it works just fine. The Dockerfile copies the files over to the container. I updated the Dockerfile to clone the repo to make sure it is clean, but the issue persists. This is the current Dockerfile: FROM ubuntu:21.10
ENV CONAN_REVISIONS_ENABLED 1
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install mingw-w64-x86-64-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix binutils-mingw-w64-x86-64 build-essential cmake git wget -y
RUN wget https://github.com/conan-io/conan/releases/latest/download/conan-ubuntu-64.deb
RUN dpkg -i conan-ubuntu-64.deb
RUN git clone https://github.com/DerKnerd/filament-browser.git
WORKDIR /filament-browser
RUN git submodule update --init --recursive
RUN cmake -DCMAKE_TOOLCHAIN_FILE=/filament-browser/mingw-w64-x86_64.cmake -B build -S /filament-browser -DCMAKE_BUILD_TYPE=Release -DWIN32=1 -G "Unix Makefiles"
RUN cmake --build build/ -- -j12 And this is the CMakeLists.txt, I get the feeling something here is wrong, but I can't put my finger on the part that is wrong. cmake_minimum_required(VERSION 3.16)
project(filament_manager CXX)
set(CMAKE_CXX_STANDARD 20)
include(./ucm.cmake)
include(./conan.cmake)
ucm_set_runtime(STATIC)
if (WIN32 OR MINGW)
add_compile_definitions(__WXMSW__ _UNICODE)
set(BUILD_SHARED_LIBS false)
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_WIN32_EXECUTABLE 1)
endif ()
set(wxUSE_STL ON)
set(wxBUILD_SHARED OFF)
set(wxUSE_AUI OFF)
set(wxUSE_RIBBON OFF)
set(wxUSE_RICHTEXT OFF)
set(wxUSE_XRC OFF)
set(wxUSE_ADV OFF)
set(wxUSE_OPENGL OFF)
set(wxUSE_PROPGRID OFF)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
conan_add_remote(NAME conan.imanuel.dev
URL https://conan.imanuel.dev/artifactory/api/conan/conan-virtual)
conan_cmake_configure(
REQUIRES libpq/12.2
GENERATORS cmake_find_package
)
conan_cmake_autodetect(settings)
if (MINGW)
conan_cmake_install(PATH_OR_REFERENCE .
BUILD missing
REMOTE conan.imanuel.dev
SETTINGS ${settings}
PROFILE ${CMAKE_SOURCE_DIR}/linux_to_win64_conan)
else ()
conan_cmake_install(PATH_OR_REFERENCE .
BUILD all
REMOTE conan.imanuel.dev
SETTINGS ${settings})
endif ()
find_package(PostgreSQL)
add_subdirectory(${CMAKE_SOURCE_DIR}/libs/wxWidgets)
add_subdirectory(${CMAKE_SOURCE_DIR}/libs/libpqxx)
add_executable(filament_manager ${target} main.cpp MainApp.h MainApp.cpp MainWindow.cpp MainWindow.h)
target_link_libraries(filament_manager PRIVATE PostgreSQL::PostgreSQL pqxx wx::core wx::base) |
@DerKnerd I am using Docker on Windows OS machine so it may be a difference in host OS. As per this comment I was able to build the latest libpqxx in your Docker container. Can you try attaching it to your Docker container and see if you can clone the libpqxx repository and build it? |
I'll try to do a release really soon then. |
@tt4g I changed the mingw compiler back to the win32 version instead of posix. If it compiles using that settings I am all happy 🙂 |
@tt4g I was not able to build it using win32. You linked it against the Linux binary not the Windows binary which I need. Linking a Linux version was never an issue. |
This Issue said MinGW on Ubuntu. What do you mean by "build it using win32"?. EDIT: Meaning the error log
|
@DerKnerd If the problem you are working on now is the The first issue I was working on in this Issue was "cannot be built libpqxx with MinGW". Attach to the Docker container and execute the following command (If comment out all the commands that fail in the $ apt-get install -y postgresql libpq-dev
$ git clone https://github.com/jtv/libpqxx.git /libpqxx
$ cd /libpqxx
$ cmake -DCMAKE_TOOLCHAIN_FILE=/filament-browser/mingw-w64-x86_64.cmake \
-B build \
-S /libpqxx \
-DCMAKE_BUILD_TYPE=Release \
-DWIN32=1 \
-G "Unix Makefiles" \
-DPostgreSQL_INCLUDE_DIR=/usr/include/postgresql \
-DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql \
-DPostgreSQL_LIBRARY=/usr/lib/x86_64-linux-gnu/libpq.so
$ cmake --build build/ Or modify FROM ubuntu:21.10
ENV CONAN_REVISIONS_ENABLED 1
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install mingw-w64-x86-64-dev g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 build-essential cmake git wget -y
RUN wget https://github.com/conan-io/conan/releases/latest/download/conan-ubuntu-64.deb
RUN dpkg -i conan-ubuntu-64.deb
RUN git clone https://github.com/DerKnerd/filament-browser.git
WORKDIR /filament-browser
RUN git submodule update --init --recursive
-RUN cmake -DCMAKE_TOOLCHAIN_FILE=/filament-browser/mingw-w64-x86_64.cmake -B build -S /filament-browser -DCMAKE_BUILD_TYPE=Release -DWIN32=1 -G "Unix Makefiles"
-RUN cmake --build build/ --target filament_manager
+# RUN cmake -DCMAKE_TOOLCHAIN_FILE=/filament-browser/mingw-w64-x86_64.cmake -B build -S /filament-browser -DCMAKE_BUILD_TYPE=Release -DWIN32=1 -G "Unix Makefiles"
+# RUN cmake --build build/ --target filament_manager
+RUN apt-get install -y postgresql libpq-dev
+RUN git clone https://github.com/jtv/libpqxx.git /libpqxx
+WORKDIR /libpqxx
+RUN cmake -DCMAKE_TOOLCHAIN_FILE=/filament-browser/mingw-w64-x86_64.cmake \
+ -B build \
+ -S /libpqxx \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DWIN32=1 \
+ -G "Unix Makefiles" \
+ -DPostgreSQL_INCLUDE_DIR=/usr/include/postgresql \
+ -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql \
+ -DPostgreSQL_LIBRARY=/usr/lib/x86_64-linux-gnu/libpq.so
+RUN cmake --build build/ UPDATE: I noticed that the |
@tt4g I use mingw to cross compile for windows on Linux, what I thought would be obvious from the CMakeLists.txt. The sample that builds for you links against the Linux lib of libpq not the windows lib. That is what I mean. I will try to build only libpqxx in a mingw environment targeting Windows tomorrow. I will comment the result. |
If conan is properly integrated with CMake it should define CMake target |
Why should it be an issue with Conan? Conan produces the correct binaries. The origin issue was, that a windows header was missing in libpqxx. You are, explicitly, linking against a Linux .so file. The static linked libpq gets correctly generated by Conan and CMake. It fails to link the libpqxx library, which I will try isolated tomorrow. |
This is because conan defines the CMake target |
It does find the binary, like I said. The commands you posted link against the libpq.so. Not the Conan generated binary. The libpq.a links fine it is libpqxx.a which doesn't link. I will test if the symbolic link issue also happens when I build it without the rest of the app. The linking issue was always with libpqxx.a not libpq.a |
I may have mistakenly thought you were doing a build of the Are you now running the command I wrote in my comment to build the libpqxx repository? + -DPostgreSQL_INCLUDE_DIR=/usr/include/postgresql \
+ -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql \
+ -DPostgreSQL_LIBRARY=/usr/lib/x86_64-linux-gnu/libpq.so If you want the link to Windows libpq to succeed, you must change the path to the binary generated by conan. - -DPostgreSQL_INCLUDE_DIR=/usr/include/postgresql \
- -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql \
- -DPostgreSQL_LIBRARY=/usr/lib/x86_64-linux-gnu/libpq.so
+ -DPostgreSQL_INCLUDE_DIR=<PATH_TO_CONAN>/include/postgresql \
+ -DPostgreSQL_TYPE_INCLUDE_DIR=<PATH_TO_CONAN>/include/postgresql \
+ -DPostgreSQL_LIBRARY=<PATH_TO_CONAN>/libpq.a |
I managed to create a super minimal example which recreates the linking issue, which is not related to conan, since the linking issue affects libpqxx only. This Dockerfile is the example: FROM ubuntu:21.10
RUN apt-get update && apt-get upgrade -y
RUN apt-get install mingw-w64-x86-64-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix binutils-mingw-w64-x86-64 build-essential cmake git wget -y
RUN wget https://github.com/conan-io/conan/releases/latest/download/conan-ubuntu-64.deb
RUN dpkg -i conan-ubuntu-64.deb
RUN mkdir /test
WORKDIR /test
RUN git init
RUN git submodule add https://github.com/jtv/libpqxx.git libs/libpqxx
RUN wget https://gist.github.com/DerKnerd/ab506480e32aab0d2b3e564fa2e67906/raw/0be5039549e71f5080ef15a7173730af0dd1f222/CMakeLists.txt
RUN wget https://gist.github.com/DerKnerd/ab506480e32aab0d2b3e564fa2e67906/raw/0be5039549e71f5080ef15a7173730af0dd1f222/conan.cmake
RUN wget https://gist.github.com/DerKnerd/ab506480e32aab0d2b3e564fa2e67906/raw/0be5039549e71f5080ef15a7173730af0dd1f222/linux_to_win64.conan
RUN wget https://gist.github.com/DerKnerd/ab506480e32aab0d2b3e564fa2e67906/raw/0be5039549e71f5080ef15a7173730af0dd1f222/main.cpp
RUN wget https://gist.github.com/DerKnerd/ab506480e32aab0d2b3e564fa2e67906/raw/0be5039549e71f5080ef15a7173730af0dd1f222/mingw.cmake
RUN cmake -DCMAKE_TOOLCHAIN_FILE=mingw.cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build/ These are the files pulled by wget: https://gist.github.com/DerKnerd/ab506480e32aab0d2b3e564fa2e67906 Executing the cmake commands yields the following output: Log
The full log can be found in the gist. |
The logs show that the link fails, so it appears that the problem with MinGW not being able to compile the object file, which was mentioned in this comment, has been resolved. I am not sure if libpqxx is the cause of the error NOTE Within the libpqxx project, the CMake command creates symbolic links (see the following permalink). Even after removing this line, the Lines 50 to 54 in 20fc436
|
Yes you are right, the compiling bug is fixed. The weird thing is though, I use the same settings in a different project without libpqxx and everything links fine. So I don't think it is a cmake bug, but rather an issue with the CMakeLists.txt. |
I defined the CMake variable Lines 50 to 54 in 20fc436
I checked the variables in the Docker container and found that |
A perfect, we found the cause. Then lets hope the PR gets merged quick 🙂 |
I create PR #550, this change should avoid the |
Merged #550. It's late but I'll start drafting a release. |
Just released 7.7.1, which includes the fix. |
Messed up 7.7.1, so did a new release: 7.7.2. |
@DerKnerd I created PR (conan-io/conan-center-index#9898) to Add libpqxx 7.7.2 to conan package. |
I can confirm, that the project now builds fine, so I will close this issue. |
Excellent. |
Hey,
when I try to build an app that uses this library and wxWidgets. When ever I try to build the app using mingw on Ubuntu it fails with the following error:
The issue can be reproduced with the following Dockerfile:
And here is the CMakeList.txt I use:
And this is the toolchain file:
Do you by any chance know what causes this issue?
The text was updated successfully, but these errors were encountered: