This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 9/8/17, Yaakov Selkowitz <yselkowitz@cygwin.com> wrote:
> 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.

That was it.  Thank you!!

$ i686-w64-mingw32-gcc -static -fstack-protector-strong -o div.exe div.c
$ ./div
  works
$ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c
$ PATH=/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH  ./div.exe
  works

and follow up question if I may - what should I have read that would
have told me that?

Lee

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]