lhmouse / mcfgthread

Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
https://gcc-mcf.lhmouse.com/
Other
277 stars 28 forks source link

undefined reference to `__MCF_cxa_atexit' #80

Closed eko5624 closed 1 year ago

eko5624 commented 1 year ago

When compiling rav1e, I get this error. Any help would be great. https://github.com/eko5624/mpv-win64/actions/runs/4566452470/jobs/8058976233

logs_3532.zip

lhmouse commented 1 year ago

Looks like your GCC did not add -lmcfgthread.

Where did GitHub Actions get that toolchain btw? The CRT part seemed to be MCF but GCC wasn't?

eko5624 commented 1 year ago

I get toolchain from your website. (https://gcc-mcf.lhmouse.com/mingw-w64-gcc-mcf_20230307_13.0.1_x64-ucrt_601b7673e8f8e2f280b0edb92c4035a979fcd15a.7z)

I did some tests. Rollback to (https://gcc-mcf.lhmouse.com/archives/mingw-w64-gcc-mcf_20210504_10.3.1_x64-ucrt_4c6b5dbd75151a47b1201f22e539c0c718e373af.7z) No errors, don't know why.

lhmouse commented 1 year ago

That's an ancient version. You should try building locally, linking with gcc -v to see whether -lmcfgthread exists in the final linker command line.

eko5624 commented 1 year ago

@nyfair Any suggestions?

nyfair commented 1 year ago

出远门了,编译播放器去折腾av1编码器干嘛,mpv又用不上这个

eko5624 @.***> 于 2023年4月1日周六 09:02写道:

@nyfair https://github.com/nyfair Any suggestions?

— Reply to this email directly, view it on GitHub https://github.com/lhmouse/mcfgthread/issues/80#issuecomment-1492768897, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKH7M2HXYWYI3SBYKEFQHDW655A5ANCNFSM6AAAAAAWN6N6JA . You are receiving this because you were mentioned.Message ID: @.***>

eko5624 commented 1 year ago

@lhmouse 我本机编译过,一样的报错信息。你可以用gcc-mcf这个toolchain编译rav1e试试看看哈,看能不能定位问题所在。我在rust主仓库翻了一些isssue,大概率是rust端的问题,不过我还没能找到workaround的方法。

lhmouse commented 1 year ago

如果 -nostdlib 或者 -nodefaultlibs 的话需要你自己加上额外的依赖 -lmcfgthread -lkernel32 -lntdll

lhmouse commented 1 year ago

Is this still an issue for you?

eko5624 commented 1 year ago

Same errors with mingw-w64-gcc-mcf_20230426_13.1.0_x64-ucrt log: https://github.com/eko5624/mpv-win64/actions/runs/4862218891/jobs/8668288298

But his build no errors.(https://github.com/brechtsanders/winlibs_mingw/releases/download/13.0.1-snapshot20230402-11.0.0-ucrt-r1/winlibs-x86_64-mcf-seh-gcc-13.0.1-snapshot20230402-mingw-w64ucrt-11.0.0-r1.7z) log: https://github.com/eko5624/mpv-win64/actions/runs/4667218657/jobs/8262738994

lhmouse commented 1 year ago

My presumption is that their CRT is vanilla mingw-w64. My personal toolchains provide patched CRT so -lmcfgthread -lntdll are required as default libraries, like -lmsvcrt -lkernel32.

lhmouse commented 1 year ago

Is this still an issue for you?

eko5624 commented 1 year ago

20230522_13.1.1 still doesn't work.

lhmouse commented 1 year ago

You really have to take a look at the linker command line.

lhmouse commented 1 year ago

Note adding -lmcfgthread is unlikely to fix the issue, because user-supplied libraries are still linked BEFORE the default CRT object files, so references from CRT startup code always fail.

eko5624 commented 1 year ago

经测试,用我自己编译的不打crt补丁的gcc with mcf可以成功编译了,所以这个issue可以关闭啦~ https://github.com/eko5624/mpv-win64/actions/runs/5629086074