Bug 2070571

Summary: mingw-gcc toolchain does not install the static library of winpthreads automatically
Product: [Fedora] Fedora Reporter: Bin Meng <bmeng.cn>
Component: mingw-gccAssignee: Kalev Lember <klember>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 35CC: erik-fedora, klember, ktietz, manisandro, marcandre.lureau, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: mingw-gcc-12.0.1-8.fc37 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-28 06:57:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bin Meng 2022-03-31 12:58:32 UTC
Description of problem:
mingw-gcc toolchain does not install the static library of winpthreads automatically.

Compiling a simple test code statically which does not call any pthread API will fail.

Version-Release number of selected component (if applicable):

How reproducible:
Always

Steps to Reproduce:
# dnf install mingw64-gcc
# cat test.c
int main(void)
{
    return 0;
}
# x86_64-w64-mingw32-gcc -static test.c -o test.exe

Actual results:
# x86_64-w64-mingw32-gcc -static test.c -o test.exe
/usr/lib/gcc/x86_64-w64-mingw32/11.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status

Expected results:
Compile the simple test case without any error

Additional info:
When installing mingw64-gcc, mingw64-winpthreads was listed as one of the dependencies, however this only includes the dynamic linked library (-shared).

One has to
# dnf install mingw64-winpthreads-static
to make the compilation pass without any error.

I don't understand the reason of dividing mingw64-winpthreads into 2 packages (mingw64-winpthreads, mingw64-winpthreads-static).
We should either merge these 2 packages into one, or express the mingw64-winpthreads-static dependency to mingw64-gcc.

Comment 1 Fedora Update System 2022-04-27 23:04:32 UTC
FEDORA-2022-be4adec40b has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-be4adec40b

Comment 2 Fedora Update System 2022-04-28 06:57:40 UTC
FEDORA-2022-be4adec40b has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.