Subject: Re: linking multiple function from .lib to CYGWIN
From: Takashi Yano via Cygwin <[email-masked]>
To: [email-masked]
Cc: "Mümin A." <[email-masked]>
Date: Tue, 18 Jul 2023 07:53:10 +0900
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>

On Fri, 14 Jul 2023 11:51:59 +0300
Mümin A. wrote:
> Hi,
> 
> I can only link one function at a time in a *msvc *built library but when I
> use multiple functions in the CYGWIN
> compiler,  I got that error message.
> 
> int main()
> {
> helloWorld2();
> return 0;
> }
> 
> That is compiled and linked successfully.
> 
> int main()
> {
> helloWorld2();
> helloWorld3();
> return 0;
> }
> 
> That is  compiled but linking throws  a bug report.
> 
> [ 50%] Linking CXX executable a.exe
> /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld:
> internal error: aborting at
> /mnt/share/cygpkgs/binutils/binutils.x86_64/src/binutils-2.40/ld/ldlang.c:527
> in compare_section
> /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld:
> please report this bug

Perhaps, this is a bug of gcc 11 which has been already fixed in
gcc 12.

Workaround is:
Link .dll directly instead of linking .lib if your .lib is
associated with a DLL.

-- 
Takashi Yano <[email-masked]>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple