Web lists-archives.com

Re: i686-w64-mingw32-gcc -fstack-protector-strong




On 2017-09-08 16:08, Lee wrote:
> $ i686-w64-mingw32-gcc --version
> i686-w64-mingw32-gcc (GCC) 6.3.0
> Copyright (C) 2016 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
> $ ./div.exe
> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?:
> cannot open shared object file: No such file or directory
> $ objdump -x ./div.exe | egrep -i "dll name"
>         DLL Name: KERNEL32.dll
>         DLL Name: msvcrt.dll
>         DLL Name: libssp-0.dll
> $ ls -l /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
> -rwxr-xr-x 1 root None 14336 Aug 17 08:26
> /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll

You created a MinGW executable which depends on other MinGW DLLs.
Therefore, either you have to tell it where to find its dependencies:

PATH="$(cygpath -S):$(cygpath
-W):/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH" \
./div.exe

Or, since you're only using GCC's libraries, just link with -static.

-- 
Yaakov

Attachment: signature.asc
Description: OpenPGP digital signature