Discussion:
[Mingw-users] Internal compiler error with custom specs file
John Brown
2017-05-24 10:10:03 UTC
Permalink
Hello All,

I tried to follow the instructions at
http://www.mingw.org/wiki/HOWTO_Use_the_GCC_specs_file
to let me link to msvcr80 (to get access to _ftelli64). When I run
gcc -specs=msvcr80 -o hello hello.c, the result is:

$ gcc -specs=msvcr80 -o hello hello.c
gcc.exe: internal compiler error: in execute, at gcc.c:2699
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

hello.c looks like this:
// BEGIN hello.c
#include <stdio.h>

int main(int argc, char *argv[])
{
printf("Hello, world!\n");
return 0;
}

// END hello.c

It can be compiled without -specs=msvcr80.

/mingw/lib/gcc/mingw32/5.3.0/msvcr80 looks like this:
*msvcrt:
msvcr80
[SINGLE BLANK LINE]
*msvcrt_version:
-D__MSVCRT_VERSION__=0x0800
[SINGLE BLANK LINE]
*moldname:
moldname80
[SINGLE BLANK LINE]

At the top of /mingw/lib/gcc/mingw32/5.3.0/specs (created by
gcc -dumpspecs) I inserted the following lines:
*msvcrt:
msvcrt
[SINGLE BLANK LINE]
*msvcrt_version:
[1st BLANK LINE]
[2nd BLANK LINE]
*moldname:
moldname
[SINGLE BLANK LINE]
*asm:
[1st BLANK LINE]
[2nd BLANK LINE]

and changed the *cpp and *libgcc definitions as follows:
*cpp:
%(msvcrt_version) %{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} %{pthread:-D_REENTRANT} %{!no-pthread: }


*libgcc:
%{mthreads:-lmingwthrd} -lmingw32 %{static|static-libgcc:-lgcc -lgcc_eh} %{!static: %{!static-libgcc: %{!shared: %{!shared-libgcc:-lgcc -lgcc_eh} %{shared-libgcc:-lgcc_s -lgcc} } %{shared:-lgcc_s -lgcc} } } -l%(moldname) -lmingwex -l%(msvcrt)

I am running the latest MinGW (gcc 5.3.0). Am I doing something wrong?

Regards,
John Brown.





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-***@lists.sourceforge.net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-***@lists.sourceforge.net?subject=unsubscribe
Keith Marshall
2017-05-25 17:05:48 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Using a custom specs file may be overkill for one function, but once
I have set it up, it is easier than modifying the source (which I
didn't write), especially if I need more than one function that is
not in MSVCRT.DLL.
True, but you then sacrifice freedom; by the strict letter of the EULA,
AIUI, you cannot redistribute MSVCR80.DLL, (unless you have a paid-for VS
licence), so if you distribute your application, users may have to go
look for it, as a separate download from Microsoft.
By the way, my Windows 10 Version 1607 MSVCRT.DLL (7.0.14393.0) also
does not have _ftelli64.
Thanks for that. Presumably it does have _telli64 and _lseeki64, (which
I believe have been present since Win95/WinNT3), so we could easily add
an inline _ftelli64 emulation in <io.h>, so it could appear that it is
available, without requiring non-free MSVCR80.DLL.

- --
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJZJw7sAAoJEMCtNsY0flo/GnwP/jkDD8eMQuK4f8Ut42HPj6Bj
4hsQHD0IShrS8i3LQ73wjc8RiAFOwx47M6X9QQb93SziGrwN2GEbQ6M7TeJHNlfh
I5BNepdd0jncBLiNhSbcy9kXH4Ty5xV4/lUOIpoKHPKYhsRlNTMiAStN837jTK9D
CwnMsA4niVce2bAVad3BvR9uuzOWu5bFzGF0zaXaCzJaeEuAD8pVxlN0Gu2Bhgso
lK5JMhcIO5CsrLXBsn1gMcYXmhx1toA0f66G2v9UMWRms4nv9L+OHbtVI2hLcwU7
1u/CCOK/e6vm2buf/rxPEl0VMStiKtlWHN15XLmNVAFoxrux+x7uVp06zVQxaM9P
lmZfuA1E7lAEobP//0HuAGIUrEk6WV+RmlPp2izhCKs/0s//xefCw1WVLkqJKn+x
hEDScZBd65iDcmebyu3AAoPB0Ex7wKfR84Um65T1pRilxj5YLt4lEDfAZX2Uonqc
sU+k9RFwYFtQ0PgT2XAAFHoiTQAnGGjWqk8A5vHVPZBucGJLYSTEz4lO0oiXZpht
+08ItGYrHmFU5jBltUV+kmfFKvCKMvejBrvgcSwWnKGMkEhX/108eWo9D7tTeVeN
hYim1osUuYUVHyjm1+HM07WG3TALTDBBuhjFPxWnBDxXEEDEVW7C32rsoLiAFpwK
CFEOiuihWpSy5KeuIdcW
=uJ3j
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-***@lists.sourceforge.net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-***@lists.sourceforge.net?subject=unsubscribe
Earnie
2017-05-25 19:34:55 UTC
Permalink
Unfortunately [these] spaces (before a LF character) are not visible
in vim. Consider a file <LF><SPACE><LF>. Vim will tell you that it
has 2 lines and 3 characters when you open it. If you move the cursor
to the start of the 2nd line (where the space is), vim will not let
you move the cursor to the right,
Yes, it will, provided you switch it into insert mode; however...
leading you (or maybe just me) to believe that nothing is there.
...I do agree that they can be difficult to spot. Mercurial's "diff"
function, (with colour view enabled), makes them VERY visible; (maybe
git offers some similar capability ... since I don't use it, I don't
:%s,[<SPACE><TAB>]*$,,
:set list

https://stackoverflow.com/questions/1675688/make-vim-show-all-white-spaces-as-a-character
(where <SPACE> and <TAB> represent the named characters), before you
ultimately save any file.
The space *is* there, above the cursor. WordPad, Notepad++, emacs
and no doubt most other editors let you move to the right in that
situation.
AFAIK, each of those editors is non-modal in behaviour; when you move
the cursor to the right, you are already in the equivalent of vim's
insert mode.
--
Earnie

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-***@lists.sourceforge.net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-***@lists.sourceforge.net?subject=unsubscribe
Keith Marshall
2017-05-24 16:15:01 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by John Brown
I tried to follow the instructions at
http://www.mingw.org/wiki/HOWTO_Use_the_GCC_specs_file
to let me link to msvcr80 (to get access to _ftelli64).
Seems like overkill. While _ftelli64() may not be available, in any
version of MSVCRT.DLL, (at least up to and including Win7), _telli64(),
_lseeki64(), and _fileno() are; surely for:

__int64 ofs64 = _ftelli64 (foo);

you can substitute either:

__int64 ofs64 = _lseeki64 (_fileno (foo), 0LL, SEEK_CUR);

or:

__int64 ofs64 = _telli64 (_fileno (foo));
Post by John Brown
$ gcc -specs=msvcr80 -o hello hello.c
gcc.exe: internal compiler error: in execute, at gcc.c:2699
libbacktrace could not find executable to open
[...snip...]
I am running the latest MinGW (gcc 5.3.0). Am I doing something wrong?
I don't know. The reference material relates to gcc-3.4.5; I'll need
to play with it, to determine how relevant it may still be.

- --
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJZJbGEAAoJEMCtNsY0flo/cyAP/AuoNhOcktbPAqQ4Wid7ybl6
TLk2o/Y1ypSpxMnTdcJWSL3HT4q5VW/Db+2oSEds6NeHcSJsNZrJKqHp9KianUcl
tbLMKUoULeeejAWiiLJnIFDOuY7yw3kXX5dto9CsK6XN/FLGx62em/9pZPZUY+Xz
4FIjkbMdbg6SyYSkRmlZTqopEDRSCVkEsHb49IfQxnoGlz5FwX5tUCZqzGecCFqv
QYaITKgkWbeWnL7H8CfQwC0tJ81L3u+S2U2s9pVav9wKIbZX/rrvjBgtoi6KiNQg
VWmgMj+O9x4oBUTjRmEQYeFqWVLWXWIQlhT9K3oKeSWWwJQr0fSNgHcIVtnwJz4X
FFKKyM5E2tPGzHEvCq9+rj/bjABUWXxB+3DwbzIZ0/KeOvIgaO5GM43JXyNzwfvX
qpPolkgXBj6+otrtMcmcZMcTa3q85TGsXcsc3EPoV7rKmXqj7ENt6ckv5I/kiNLg
Zp0i13zkPhSugL2KAKZC6Fu8r7rVNKg5MxDOWa2g8EEshJTyBobF9I4U8BicUy5f
HZpmfOeroKTTmyCc/FByT/XIBPzbOOb4kSudZeZhSSAPbFuvG36CahlhKbl5MHuU
At5QB9XQLRZtrornfqmsINxbTTx9pv9zR1hIZYefyk2JXCASYyZe538UfkY+Y+Ht
GW1wXcrdtazu7lXjeazW
=aaww
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-***@lists.sourceforge.net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-***@lists.sourceforge.net?subject=unsubscribe
Loading...