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

ar.exe ERROR in GCC 10.2.0 + LLVM/Clang/LLD/LLDB 11.0.0 + MinGW-w64 8.0.0 - release 6 #42

Closed
anperch opened this issue Jan 26, 2021 · 9 comments

Comments

@anperch
Copy link

anperch commented Jan 26, 2021

Hi,

Compiling a static lib with GCC 10.2.0 + LLVM/Clang/LLD/LLDB 11.0.0 + MinGW-w64 8.0.0 - release 6 gives the error :

ar.exe - Bad Image
libdep.dll is not designed to tun on windows or it contains an error... Error status 0x000012f.

Both the the zip and 7z downloaded files show the same error.

Any idea ?

@brechtsanders
Copy link
Owner

I had no such issues in my own tests.
Can you check if ar.exe or libdep.dll appear anywhere else in your PATH? Maybe it's loading from a wrong location.
If you can try to work around that by making sure the mingw64/bin path is before that location in the PATH environment variable (or mingw32/bin if you're building 32-bit).

@anperch
Copy link
Author

anperch commented Jan 26, 2021

Thanks for the quick answer.

To be more accurate :

  • It is a not a path problem.
  • The error is in fact given by CodeBlocks (20.03) when creating any static lib with the ar.exe in Release 6
  • But the lib IS INDEED created, the error is just a message box coming when ar.exe is called by CodeBlocks.
  • Replacing ar.exe in Release 6 (1444KB) with the one in Release 5 (1406KB) solves the issue, no error messagebox.

So it seems more related to CodeBlocks having an issue with this new version.

@anperch
Copy link
Author

anperch commented Jan 26, 2021

The MessageBox in probably given by Windows itself, not Codeblocks, as someone mentioned in this post:

https://sourceware.org/bugzilla/show_bug.cgi?id=27113

It persists even after CodeBlocks is closed.

@anperch
Copy link
Author

anperch commented Jan 26, 2021

The command line :

C:\DEV\mingw64\bin\ar.exe -r -s bin\Release\libOptions.a obj\Release\Options.o

brings the error MessageBox twice. So defnitely not CodeBlocks. :-(

@brechtsanders
Copy link
Owner

I can't reproduce this.
But the error indicates the .exe is not suited for your platform. Are you doing this on a 64-bit Windows 10 system, or does it happen to be a 32-bit system?

@brechtsanders
Copy link
Owner

brechtsanders commented Jan 26, 2021

Ok, I was able to reproduce it now on a different computer. I will look into this. I changed the primary download on http://winlibs.com/ back to r5.
Maybe it's an issue with the latest binutils release that was used in r6.

Simple way to reproduce from Command Prompt:

SET PATH=D:\Prog\winlibs64-10.2.0-8.0.0\mingw64\bin;%PATH%
ECHO. | gcc -c -xc - -o _.o
ar cr _.a _.o

@brechtsanders
Copy link
Owner

brechtsanders commented Jan 26, 2021

What happens if you remove the file mingw64/lib/bfd-plugins/libdep.dll.a ?
Looking at the link you sent earlier it seems like a bug in binutils that tries to load libdep.dll.a instead of libdep.dll, which won't work as libdep.dll.a is not a DLL file.
For my test scenario this fixes the issue.

@anperch
Copy link
Author

anperch commented Jan 26, 2021

You are right, without libdep.dll.a, it is fine. No more error.
Thx.

@brechtsanders
Copy link
Owner

Ok, I will create a release 6b to resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants