Compiling on CygWin
zouhair opened this issue · 6 comments
Sorry for the bother, I managed to compile jtm using the Linux command on Cygwin/Windows 10
But jtc compilation breaks for some reason
c++ -o jtm -Wall -std=gnu++14 -static -Ofast jtc.cpp
In file included from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/cstdio:42:0,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ext/string_conversions.h:43,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:6361,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/string:52,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ios:42,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iostream:39,
from jtc.cpp:1:
lib/shell.hpp:38:25: error: expected ‘)’ before ‘->’ token
const std::string & stdout(void) const { return out_; }
^
In file included from /usr/include/wchar.h:6:0,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ios:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iostream:39,
from jtc.cpp:1:
lib/shell.hpp:38:25: error: expected ‘;’ at end of member declaration
const std::string & stdout(void) const { return out_; }
^
In file included from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/cstdio:42:0,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ext/string_conversions.h:43,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:6361,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/string:52,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ios:42,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iostream:39,
from jtc.cpp:1:
lib/shell.hpp:38:25: error: expected unqualified-id before ‘->’ token
const std::string & stdout(void) const { return out_; }
^
jtc.cpp: In member function ‘bool Jtc::execute_cli_(Json&, Json::iterator&, const map_jn&)’:
jtc.cpp:1449:17: error: expected unqualified-id before ‘(’ token
string out{sh_.stdout()};
^
jtc.cpp:1449:25: error: no matching function for call to ‘std::basic_string<char>::basic_string(<brace-enclosed initializer list>)’
string out{sh_.stdout()};
^
In file included from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/string:52:0,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ios:42,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iostream:39,
from jtc.cpp:1:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3589:9: note: candidate: template<class _InputIterator> std::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&)
basic_string(_InputIterator __beg, _InputIterator __end,
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3589:9: note: template argument deduction/substitution failed:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3579:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc());
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3579:7: note: conversion of argument 1 would be ill-formed:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3561:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
basic_string(basic_string&& __str)
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3561:7: note: conversion of argument 1 would be ill-formed:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3551:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3551:7: note: candidate expects 3 arguments, 1 provided
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3544:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3544:7: note: conversion of argument 1 would be ill-formed:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3537:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
basic_string(const _CharT* __s, size_type __n,
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3537:7: note: candidate expects 3 arguments, 1 provided
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3525:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
basic_string(const basic_string& __str, size_type __pos,
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3525:7: note: candidate expects 4 arguments, 1 provided
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3516:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
basic_string(const basic_string& __str, size_type __pos,
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3516:7: note: candidate expects 3 arguments, 1 provided
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3507:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
basic_string(const basic_string& __str, size_type __pos,
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3507:7: note: candidate expects 3 arguments, 1 provided
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3497:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
basic_string(const basic_string& __str);
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3497:7: note: conversion of argument 1 would be ill-formed:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3490:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
basic_string(const _Alloc& __a);
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3490:7: note: conversion of argument 1 would be ill-formed:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3479:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
basic_string()
^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:3479:7: note: candidate expects 0 arguments, 1 provided
I also tried
clang++-8 -Wall -std=c++14 -Ofast jtc.cpp -o jtc
In file included from jtc.cpp:11:
./lib/shell.hpp:38:25: error: expected ')'
const std::string & stdout(void) const { return out_; }
^
/usr/include/stdio.h:161:23: note: expanded from macro 'stdout'
#define stdout (_REENT->_stdout)
^
./lib/shell.hpp:38:25: note: to match this '('
/usr/include/stdio.h:161:16: note: expanded from macro 'stdout'
#define stdout (_REENT->_stdout)
^
In file included from jtc.cpp:11:
./lib/shell.hpp:38:25: error: function cannot return function type 'const std::string &() const' (aka 'const basic_string<char> &() const')
const std::string & stdout(void) const { return out_; }
^
/usr/include/stdio.h:161:17: note: expanded from macro 'stdout'
#define stdout (_REENT->_stdout)
^
/usr/include/sys/reent.h:825:28: note: expanded from macro '_REENT'
# define _REENT (__getreent())
^
In file included from jtc.cpp:11:
./lib/shell.hpp:38:53: error: no viable conversion from returned value of type 'std::string' (aka 'basic_string<char>') to function return type 'int'
const std::string & stdout(void) const { return out_; }
^~~~
jtc.cpp:1449:17: error: expected unqualified-id
string out{sh_.stdout()};
^
/usr/include/stdio.h:161:16: note: expanded from macro 'stdout'
#define stdout (_REENT->_stdout)
^
4 errors generated.
If you have the time to check it out I would be happy
thanks
it seems compiler is unhappy with this error:
jtc.cpp: In member function ‘bool Jtc::execute_cli_(Json&, Json::iterator&, const map_jn&)’:
jtc.cpp:1449:17: error: expected unqualified-id before ‘(’ token
string out{sh_.stdout()};
^
jtc.cpp:1449:25: error: no matching function for call to ‘std::basic_string<char>::basic_string(<brace-enclosed initializer list>)’
string out{sh_.stdout()};
for some reason it does not like the brace-initializer list (which is definitely a miss on the basic_string
implementation in cygwin).
So, try then calling for the function-like constructor (which definitely will be there):
replace line 1449:
string out{sh_.stdout()};
with this one:
string out(sh_.stdout());
let me know if it works.
However, after the next version (1.75) which I aim to publish soon (within one-two week time-frame), one of the priorities I aim is to come up with a proper windows binary (which would require porting of some code).
PS.
btw, if you have gnu++17 compiler installed under your cygwin, you might want to try then -std=gnu++14
option, where that issue with brace-initializer could be already solved.
Cool,
here is the error I get after the change
$ c++ -o jtc -Wall -std=gnu++14 -static -Ofast jtc.cpp
In file included from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/cstdio:42:0,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ext/string_conversions.h:43,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:6361,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/string:52,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ios:42,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iostream:39,
from jtc.cpp:1:
lib/shell.hpp:38:25: error: expected ‘)’ before ‘->’ token
const std::string & stdout(void) const { return out_; }
^
In file included from /usr/include/wchar.h:6:0,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ios:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iostream:39,
from jtc.cpp:1:
lib/shell.hpp:38:25: error: expected ‘;’ at end of member declaration
const std::string & stdout(void) const { return out_; }
^
In file included from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/cstdio:42:0,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ext/string_conversions.h:43,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/basic_string.h:6361,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/string:52,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/locale_classes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ios:42,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/iostream:39,
from jtc.cpp:1:
lib/shell.hpp:38:25: error: expected unqualified-id before ‘->’ token
const std::string & stdout(void) const { return out_; }
^
jtc.cpp: In member function ‘bool Jtc::execute_cli_(Json&, Json::iterator&, const map_jn&)’:
jtc.cpp:1449:17: error: expected unqualified-id before ‘(’ token
string out(sh_.stdout());
So I guess I'll just wait patiently for the win binary
Thanks a lot and have a nice day
hmmm, that's more serious than I thought - it looks like stdout
symbol is reserved there. To fix that it would require changing stdout
in the lib/shell.hpp
library and everywhere where it's called...
Let me take a note, I'll probably change it to a less common name in the next version (1.75), then you might have a better chance to compile under cygwin. (porting to a native windows, will take some time, even though I moved it up in my priority list and already quite a few folks have asked for it).
in fact, it's not so bad - would require only couple changes:
- in
jtc.cpp
change:
string out{sh_.stdout()};
with:
string out{sh_.out()};
- in
lib/shell.hpp
, replace:
const std::string & stdout(void) const { return out_; }
with:
const std::string & out(void) const { return out_; }
let me know if that helps.
YES
That did it
c++ -o jtc -Wall -std=gnu++14 -static -Ofast jtc.cpp
worked
Thanks a lot
thanks for testing it. I'll apply the respective changes in my source too.
So, in windows/cygwin stdout
is defined as macro. Hmm...