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

Copydeps cannot resolve any dll #12

Open
spth opened this issue Mar 12, 2024 · 3 comments
Open

Copydeps cannot resolve any dll #12

spth opened this issue Mar 12, 2024 · 3 comments
Labels
Linux Issue specific to running on Linux PE Issue specific to PE files

Comments

@spth
Copy link

spth commented Mar 12, 2024

Yes, the title is the same as #11, but there the reply was "The simple truth is I've written this to be a Linux tool and never gave running under Windows any thought."

I'm seeing what looks like the same problem on Debian GNU/Linux. E.g. (small example, so there is only one DLL that should be found, but I see the same "failed to resolve" with other programs that need more DLLs):

sdcc-builder@notebook6:~$ /tmp/copydeps/build/copydeps --dry-run ./build/sdcc-build/build/x86_64-w64-mingw32/sdcc/sdcc/bin/sdar.exe
"KERNEL32.dll": (ignored)
"USER32.dll": (ignored)
"msvcrt.dll": (ignored)
"zlib1.dll": (failed to resolve)
sdcc-builder@notebook6:~$ find /usr -name zlib1.dll
/usr/lib/x86_64-linux-gnu/wine/zlib1.dll
/usr/lib/x86_64-linux-gnu/wine/i386-windows/zlib1.dll
/usr/lib/x86_64-linux-gnu/wine/x86_64-windows/zlib1.dll
/usr/lib/i386-linux-gnu/wine/zlib1.dll
/usr/lib/i386-linux-gnu/wine/i386-windows/zlib1.dll
/usr/lib/i386-linux-gnu/wine/x86_64-windows/zlib1.dll
/usr/i686-w64-mingw32/lib/zlib1.dll
/usr/x86_64-w64-mingw32/lib/zlib1.dll
@suve
Copy link
Owner

suve commented Mar 12, 2024

This is caused by the fact that library lookup paths are currently hard-coded in the executable, and different distros store the files in different paths. The program would need to get the library path from the system somehow. Issue #8 suggests consulting /etc/ld.so.conf for this. If you know of any other potential solution, let me know.

@suve
Copy link
Owner

suve commented Mar 12, 2024

Hm, so looking at how ldd does it, it just calls /usr/lib64/ld-linux-x86-64.so.2 --list. Calling ldd and parsing the output was what this program did initially, so I'm kinda hesitant about reverting back to that behaviour, but it seems to be the simplest way to go about this.

It must be noted, though, that this could only be used for ELF executables; a different mechanism would be needed to figure out where MinGW libraries used for linking .exe files are located.

@suve
Copy link
Owner

suve commented Mar 13, 2024

Ugh. Seems I was quite distracted yesterday. I glanced over your comment, saw "Debian" and didn't really notice the fact that you're trying to copy .dlls for a MinGW-compiled program. Hence all my blabbering about /etc/ld.so.conf and ldd and so on.

So, MinGW. Like I said earlier, library lookup paths are currently hard-coded. When looking for dependencies for 64-bit .exe files, the list consists of a single entry:

vec!["/usr/x86_64-w64-mingw32/sys-root/mingw/bin/"]

Extending this and adding /usr/x86_64-w64-mingw32/lib/ is straight-forward and would solve the issue in your particular case. So that's what I'm gonna do for now; in the long run, it would be very much preferable to come up with some kind of mechanism that'd allow the program to detect where MinGW stuff is located.

@suve suve added Linux Issue specific to running on Linux PE Issue specific to PE files labels Mar 13, 2024
suve added a commit that referenced this issue Mar 14, 2024
As reported by one user, Debian places its MinGW libraries in slightly
different locations than Fedora. This caused the program to be unable
to locate the .dll files.

See: #12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux Issue specific to running on Linux PE Issue specific to PE files
Projects
None yet
Development

No branches or pull requests

2 participants