Skip to content
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

[package] libpq/15.4: MinGW undefined references when using libpq #25282

Open
scandyna opened this issue Sep 16, 2024 · 1 comment
Open

[package] libpq/15.4: MinGW undefined references when using libpq #25282

scandyna opened this issue Sep 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@scandyna
Copy link

Description

While building qt/6.7.1 on Windows with MinGW gcc 13, there are a lot of undefined references, like:

C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/qsql_psql.cpp.obj: in function `QPSQLResult::isNull(int)':
C:/.conan/6faa1d/1/src/qtbase/src/plugins/sqldrivers/psql/qsql_psql.cpp:675: undefined reference to `PQgetisnull'

An example of a failing build of Qt6 is available here:
https://gitlab.com/scandyna/conan-qt-builds/-/jobs/7827688162/viewer

The problem is also reproducible with the test_package provided in the libpq recipe.
An example of a failing conan test is available here:
https://gitlab.com/scandyna/conan-center-index-partialbasicci-sandbox/-/jobs/7833187239

Package and Environment Details

  • Package Name/Version: libpq/15.4
  • Operating System+version: Windows 10
  • Compiler+version: MinGW Gcc 13.2.0
  • Docker image: registry.gitlab.com/scandyna/docker-images-windows/windows-build-qt-win64-mingw13:latest (also reproducible on a native Windows 10)
  • Conan version: conan 1.64.1
  • Python version: Python 3.12.5

Conan profile

Configuration (profile_host):
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=17
compiler.crt=ucrt
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.version=13
os=Windows
[options]
icu:shared=False
libalsa:shared=True
libpq:shared=False
qt:gui=True
qt:qtserialport=True
qt:shared=True
qt:widgets=True
qt:with_glib=False
qt:with_mysql=False
qt:with_odbc=True
qt:with_pq=True
qt:with_sqlite3=True
qt:with_vulkan=False
zlib:shared=False
[build_requires]
[env]
CC=gcc
CXX=g++
[conf]
tools.build:compiler_executables={'c': 'C:/MinGW/mingw64/bin/gcc.exe', 'cpp': 'C:/MinGW/mingw64/bin/g++.exe'}
[buildenv]
CC=gcc
CXX=g++
PATH=+(path)/MinGW/mingw64/bin
[runenv]
PATH=+(path)/MinGW/mingw64/bin
Configuration (profile_build):
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.crt=ucrt
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.version=13
os=Windows
[options]
icu:shared=False
libalsa:shared=True
qt:gui=True
qt:qtserialport=True
qt:shared=True
qt:widgets=True
qt:with_glib=False
qt:with_mysql=False
qt:with_odbc=True
qt:with_pq=True
qt:with_sqlite3=True
qt:with_vulkan=False
zlib:shared=False
[build_requires]
[env]
CC=gcc
CXX=g++
[conf]
tools.build:compiler_executables={'c': 'C:/MinGW/mingw64/bin/gcc.exe', 'cpp': 'C:/MinGW/mingw64/bin/g++.exe'}
[buildenv]
CC=gcc
CXX=g++
PATH=+(path)/MinGW/mingw64/bin
[runenv]
PATH=+(path)/MinGW/mingw64/bin

Steps to reproduce

cd conan-center-index/recipes/libpq/all

conan create . libpq/15.4@ --profile:build windows_gcc13_x86_64_build_qt --profile:host windows_gcc13_x86_64_build_qt --settings:build build_type=Release --settings:host build_type=Debug --options:host libpq:shared=False --test-folder None --build missing --build libpq --update

conan test test_package libpq/15.4@ --profile:build windows_gcc13_x86_64_build_qt --profile:host windows_gcc13_x86_64_build_qt --settings:build build_type=Release --settings:host build_type=Debug --options:host libpq:shared=False

Logs

Click to expand log
$ conan test test_package libpq/$LIBPQ_VERSION@ --profile:build $CONAN_PROFILE_BUILD --profile:host $CONAN_PROFILE_HOST --settings:build build_type=Release --settings:host build_type=$BUILD_TYPE --options:host libpq:shared=$BUILD_SHARED_LIBS
WARN: *** Conan 1 is legacy and on a deprecation path ***
WARN: *** Please upgrade to Conan 2 ***
Configuration (profile_host):
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=17
compiler.crt=ucrt
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.version=13
os=Windows
[options]
icu:shared=False
libalsa:shared=True
libpq:shared=False
qt:gui=True
qt:qtserialport=True
qt:shared=True
qt:widgets=True
qt:with_glib=False
qt:with_mysql=False
qt:with_odbc=True
qt:with_pq=True
qt:with_sqlite3=True
qt:with_vulkan=False
zlib:shared=False
[build_requires]
[env]
CC=gcc
CXX=g++
[conf]
tools.build:compiler_executables={'c': 'C:/MinGW/mingw64/bin/gcc.exe', 'cpp': 'C:/MinGW/mingw64/bin/g++.exe'}
[buildenv]
CC=gcc
CXX=g++
PATH=+(path)/MinGW/mingw64/bin
[runenv]
PATH=+(path)/MinGW/mingw64/bin
Configuration (profile_build):
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.crt=ucrt
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.version=13
os=Windows
[options]
icu:shared=False
libalsa:shared=True
qt:gui=True
qt:qtserialport=True
qt:shared=True
qt:widgets=True
qt:with_glib=False
qt:with_mysql=False
qt:with_odbc=True
qt:with_pq=True
qt:with_sqlite3=True
qt:with_vulkan=False
zlib:shared=False
[build_requires]
[env]
CC=gcc
CXX=g++
[conf]
tools.build:compiler_executables={'c': 'C:/MinGW/mingw64/bin/gcc.exe', 'cpp': 'C:/MinGW/mingw64/bin/g++.exe'}
[buildenv]
CC=gcc
CXX=g++
PATH=+(path)/MinGW/mingw64/bin
[runenv]
PATH=+(path)/MinGW/mingw64/bin
libpq/15.4 (test package): Installing package
Requirements
    libpq/15.4 from local cache - Cache
Packages
    libpq/15.4:19b369753531268bb7660290d71f992b141d7b72 - Cache
Installing (downloading, building) binaries...
libpq/15.4: Already installed!
libpq/15.4 (test package): Generator 'CMakeToolchain' calling 'generate()'
libpq/15.4 (test package): Preset 'debug' added to CMakePresets.json. Invoke it manually using 'cmake --preset debug'
libpq/15.4 (test package): If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake <path> -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=C:\builds\scandyna\conan-center-index-partialbasicci-sandbox\conan-center-index\recipes\libpq\all\test_package\build\Debug\generators\conan_toolchain.cmake -DCMAKE_SH=CMAKE_SH-NOTFOUND -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug'
libpq/15.4 (test package): Generator 'VirtualRunEnv' calling 'generate()'
libpq/15.4 (test package): Generator 'CMakeDeps' calling 'generate()'
libpq/15.4 (test package): Generator txt created conanbuildinfo.txt
libpq/15.4 (test package): Aggregating env generators
libpq/15.4 (test package): Generated conaninfo.txt
libpq/15.4 (test package): Generated graphinfo
Using lockfile: 'C:\builds\scandyna\conan-center-index-partialbasicci-sandbox\conan-center-index\recipes\libpq\all\test_package\build\Debug\generators/conan.lock'
Using cached profile from lockfile
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] 'fPIC' option not found
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK
libpq/15.4 (test package): Calling build()
libpq/15.4 (test package): CMake command: cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="C:/builds/scandyna/conan-center-index-partialbasicci-sandbox/conan-center-index/recipes/libpq/all/test_package/build/Debug/generators/conan_toolchain.cmake" -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "C:\builds\scandyna\conan-center-index-partialbasicci-sandbox\conan-center-index\recipes\libpq\all\test_package\."
-- Using Conan toolchain: C:/builds/scandyna/conan-center-index-partialbasicci-sandbox/conan-center-index/recipes/libpq/all/test_package/build/Debug/generators/conan_toolchain.cmake
-- Conan toolchain: C++ Standard 17 with extensions OFF
-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/MinGW/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Conan: Component target declared 'libpq::pgport'
-- Conan: Component target declared 'libpq::pgcommon'
-- Conan: Component target declared 'libpq::pq'
-- Conan: Target declared 'PostgreSQL::PostgreSQL'
-- Configuring done (2.0s)
-- Generating done (0.1s)
CMake Warning:
  Manually-specified variables were not used by the project:
    CMAKE_POLICY_DEFAULT_CMP0091
    CMAKE_SH
-- Build files have been written to: C:/builds/scandyna/conan-center-index-partialbasicci-sandbox/conan-center-index/recipes/libpq/all/test_package/build/Debug
libpq/15.4 (test package): CMake command: cmake --build "C:\builds\scandyna\conan-center-index-partialbasicci-sandbox\conan-center-index\recipes\libpq\all\test_package\build\Debug" -- -j2
[ 50%] Building C object CMakeFiles/test_package.dir/test_package.c.obj
[100%] Linking C executable test_package.exe
C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\test_package.dir/objects.a(test_package.c.obj): in function `main':
C:/builds/scandyna/conan-center-index-partialbasicci-sandbox/conan-center-index/recipes/libpq/all/test_package/test_package.c:9: undefined reference to `PQlibVersion'
C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/builds/scandyna/conan-center-index-partialbasicci-sandbox/conan-center-index/recipes/libpq/all/test_package/test_package.c:12: undefined reference to `PQconnectdb'
C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/builds/scandyna/conan-center-index-partialbasicci-sandbox/conan-center-index/recipes/libpq/all/test_package/test_package.c:13: undefined reference to `PQstatus'
C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/builds/scandyna/conan-center-index-partialbasicci-sandbox/conan-center-index/recipes/libpq/all/test_package/test_package.c:15: undefined reference to `PQfinish'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\test_package.dir\build.make:104: test_package.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:82: CMakeFiles/test_package.dir/all] Error 2
mingw32-make: *** [Makefile:90: all] Error 2
ERROR: libpq/15.4 (test package): Error in build() method, line 21
	cmake.build()
	ConanException: Error 2 while executing cmake --build "C:\builds\scandyna\conan-center-index-partialbasicci-sandbox\conan-center-index\recipes\libpq\all\test_package\build\Debug" -- -j2
@scandyna scandyna added the bug Something isn't working label Sep 16, 2024
@scandyna
Copy link
Author

I could not paste all the logs. Here is a file with all:
build_test_libpq_mingw13_logs.txt

They come from this build job:
https://gitlab.com/scandyna/conan-center-index-partialbasicci-sandbox/-/jobs/7833639498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant