Try compiling gtemuAT67 with Cygwin

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
denjhang
Posts: 50
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Try compiling gtemuAT67 with Cygwin

Post by denjhang »

Code: Select all

$ cmake -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- Found SDL2: /usr/lib/libSDL2main.a;/usr/lib/libSDL2.dll.a
-- Configuring done
-- Generating done
-- Build files have been written to: /home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/gigatron-rom-master/Contrib/at67
$ make
[  1%] Building C object CMakeFiles/gtemuAT67.dir/rs232/rs232-linux.c.o
[  3%] Building CXX object CMakeFiles/gtemuAT67.dir/assembler.cpp.o
[  4%] Building CXX object CMakeFiles/gtemuAT67.dir/audio.cpp.o
[  6%] Building CXX object CMakeFiles/gtemuAT67.dir/compiler.cpp.o
[  8%] Building CXX object CMakeFiles/gtemuAT67.dir/cpu.cpp.o
[  9%] Building CXX object CMakeFiles/gtemuAT67.dir/dialog.cpp.o
[ 11%] Building CXX object CMakeFiles/gtemuAT67.dir/editor.cpp.o
[ 12%] Building CXX object CMakeFiles/gtemuAT67.dir/expression.cpp.o
[ 14%] Building CXX object CMakeFiles/gtemuAT67.dir/functions.cpp.o
[ 16%] Building CXX object CMakeFiles/gtemuAT67.dir/gigatron.cpp.o
[ 17%] Building CXX object CMakeFiles/gtemuAT67.dir/graphics.cpp.o
[ 19%] Building CXX object CMakeFiles/gtemuAT67.dir/image.cpp.o
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp:74:51: error: ‘std::ifstream::streampos’ has not been declared
   74 |     bool getFileSize(const std::string& filename, std::ifstream::streampos& fileSize)
      |                                                   ^~~
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp: In function ‘bool Image::getFileSize(const string&, int&)’:
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp:81:35: error: ambiguous overload for ‘operator-’ (operand types are ‘std::basic_istream<char>::pos_type’ {aka ‘std::fpos<_mbstate_t>’} and ‘int’)
   81 |         fileSize = infile.tellg() - fileSize;
      |                    ~~~~~~~~~~~~~~ ^ ~~~~~~~~
      |                                |    |
      |                                |    int
      |                                std::basic_istream<char>::pos_type {aka std::fpos<_mbstate_t>}
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp:81:35: note: candidate: ‘operator-(std::streamoff {aka long int}, int)’ (built-in)
   81 |         fileSize = infile.tellg() - fileSize;
      |                    ~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/char_traits.h:40,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/string:40,
                 from /home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp:2:
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/postypes.h:198:7: note: candidate: ‘std::fpos<_StateT> std::fpos<_StateT>::operator-(std::streamoff) const [with _StateT = _mbstate_t; std::streamoff = long int]’
  198 |       operator-(streamoff __off) const
      |       ^~~~~~~~
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/postypes.h:211:7: note: candidate: ‘std::streamoff std::fpos<_StateT>::operator-(const std::fpos<_StateT>&) const [with _StateT = _mbstate_t; std::streamoff = long int]’
  211 |       operator-(const fpos& __other) const
      |       ^~~~~~~~
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp: In function ‘bool Image::loadGtRgbFile(const string&, Image::GtRgbFile&)’:
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp:96:24: error: ‘streampos’ is not a member of ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’}
   96 |         std::ifstream::streampos fileSize = 0;
      |                        ^~~~~~~~~
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp:97:35: error: ‘fileSize’ was not declared in this scope
   97 |         if(!getFileSize(filename, fileSize))
      |                                   ^~~~~~~~
/home/Administrator/gigatron-rom-master/gigatron-rom-master/Contrib/at67/image.cpp:161:54: error: ‘fileSize’ was not declared in this scope
  161 |         int optionalSize = int(infile.tellg()) - int(fileSize);
      |                                                      ^~~~~~~~
make[2]: *** [CMakeFiles/gtemuAT67.dir/build.make:230: CMakeFiles/gtemuAT67.dir/image.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:190: CMakeFiles/gtemuAT67.dir/all] Error 2
make: *** [Makefile:91: all] Error 2


I want to use the latest gtemu on Windows10. I found that I got a bit of a complaint.
denjhang
Posts: 50
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

I tried to downgrade Cygwin's gcc, g++, etc. to 7.3, and successfully compiled it, but it didn't work properly. A console window flashed by and it seemed to show these:

Code: Select all

Cpu::initialise() : failed to initialise SDL.
Attachments
gtemu2.zip
(4.27 MiB) Downloaded 28 times
at67
Posts: 486
Joined: 14 May 2018, 08:29

Re: Try compiling gtemuAT67 with Cygwin

Post by at67 »

There's already a gtemuAT67 thread here:

viewtopic.php?t=69

Could you post new questions, issues, problems or whatever to that thread next time, please?

gtemuAt67 has been successfully built on a lot of flavours of Linux, MacOS and Windows native, I am not sure if anyone has tried Cygwin yet; so I guess you may be the first?

1) Why not build it under VisualC++ and native Windows? Never mind no need to answer, lets get it running under Cygwin.

2) The most likely reason for SDL initialisation failure is that you don't have the dll/so in the same folder/path as the excutable, or that gtemuAT67 can't find the SDL dll/so from the environment's path.

3) I'm not sure why Cygwin doesn't have 'std::ifstream::streampos' defined, (maybe adding -std=c++11 to the makefile would solve it). But a simple solution is to do the following:

Change this function in Image.cpp:

Code: Select all

    bool getFileSize(const std::string& filename, std::ifstream::streampos& fileSize)
    {
        std::ifstream infile(filename, std::ios::binary | std::ios::in);
        if(!infile.is_open()) return false;

        fileSize = infile.tellg();
        infile.seekg(0, std::ios::end);
        fileSize = infile.tellg() - fileSize;

        return true;
    }
To this:

Code: Select all

    bool getFileSize(const std::string& filename, size_t& fileSize)
    {
        std::ifstream infile(filename, std::ios::binary | std::ios::in);
        if(!infile.is_open()) return false;

        fileSize = infile.tellg();
        infile.seekg(0, std::ios::end);
        fileSize = size_t(infile.tellg()) - fileSize;

        return true;
    }
And change this line in the loadGtRgbFile function in Image.cpp:

Code: Select all

std::ifstream::streampos fileSize = 0;
To this:

Code: Select all

size_t fileSize = 0;
P.S. You could also try replacing all occurrences of 'std::ifstream::streampos' with 'std::streampos' in image.cpp, there should only be two of them. It looks like the streampos template has been moved into the std namespace for more modern compilers.
denjhang
Posts: 50
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

at67 wrote: 19 Mar 2022, 14:35 There's already a gtemuAT67 thread here:

viewtopic.php?t=69

Could you post new questions, issues, problems or whatever to that thread next time, please?

gtemuAt67 has been successfully built on a lot of flavours of Linux, MacOS and Windows native, I am not sure if anyone has tried Cygwin yet; so I guess you may be the first?

1) Why not build it under VisualC++ and native Windows? Never mind no need to answer, lets get it running under Cygwin.

2) The most likely reason for SDL initialisation failure is that you don't have the dll/so in the same folder/path as the excutable, or that gtemuAT67 can't find the SDL dll/so from the environment's path.

3) I'm not sure why Cygwin doesn't have 'std::ifstream::streampos' defined, (maybe adding -std=c++11 to the makefile would solve it). But a simple solution is to do the following:

Change this function in Image.cpp:

Code: Select all

    bool getFileSize(const std::string& filename, std::ifstream::streampos& fileSize)
    {
        std::ifstream infile(filename, std::ios::binary | std::ios::in);
        if(!infile.is_open()) return false;

        fileSize = infile.tellg();
        infile.seekg(0, std::ios::end);
        fileSize = infile.tellg() - fileSize;

        return true;
    }
To this:

Code: Select all

    bool getFileSize(const std::string& filename, size_t& fileSize)
    {
        std::ifstream infile(filename, std::ios::binary | std::ios::in);
        if(!infile.is_open()) return false;

        fileSize = infile.tellg();
        infile.seekg(0, std::ios::end);
        fileSize = size_t(infile.tellg()) - fileSize;

        return true;
    }
And change this line in the loadGtRgbFile function in Image.cpp:

Code: Select all

std::ifstream::streampos fileSize = 0;
To this:

Code: Select all

size_t fileSize = 0;
P.S. You could also try replacing all occurrences of 'std::ifstream::streampos' with 'std::streampos' in image.cpp, there should only be two of them. It looks like the streampos template has been moved into the std namespace for more modern compilers.

1) Why not build it under VisualC++ and native Windows?
Because I don't have VisualC++ installed on this computer, I know that the software is large, and my network condition here is poor.
2) I'm pretty sure I've placed files like sdl2.dll correctly
3) I modified the code according to your instructions, but there is still a problem.

Code: Select all


Administrator@USERUQI-G4T92PQ ~
$ cd /home/Administrator/gigatron-rom-master/at67

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/at67
$ cmake -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found SDL2: /usr/lib/libSDL2main.a;/usr/lib/libSDL2.dll.a
-- Configuring done
-- Generating done
-- Build files have been written to: /home/Administrator/gigatron-rom-master/at67

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/at67
$ make
[  1%] Building C object CMakeFiles/gtemuAT67.dir/rs232/rs232-linux.c.o
[  3%] Building CXX object CMakeFiles/gtemuAT67.dir/assembler.cpp.o
[  4%] Building CXX object CMakeFiles/gtemuAT67.dir/audio.cpp.o
[  6%] Building CXX object CMakeFiles/gtemuAT67.dir/compiler.cpp.o
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/c++allocator.h:33,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/allocator.h:46,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/string:41,
                 from /home/Administrator/gigatron-rom-master/at67/compiler.cpp:6:
In member function ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const int, Compiler::DefDataMidi> >]’,
    inlined from ‘static void std::allocator_traits<std::allocator<_CharT> >::deallocate(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, std::allocator_traits<std::allocator<_CharT> >::pointer, std::allocator_traits<std::allocator<_CharT> >::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const int, Compiler::DefDataMidi> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/alloc_traits.h:492:23,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_put_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, Compiler::DefDataMidi>; _KeyOfValue = std::_Select1st<std::pair<const int, Compiler::DefDataMidi> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, Compiler::DefDataMidi> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:565:34,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_drop_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, Compiler::DefDataMidi>; _KeyOfValue = std::_Select1st<std::pair<const int, Compiler::DefDataMidi> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, Compiler::DefDataMidi> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:632:13,
    inlined from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const int&>, std::tuple<>}; _Key = int; _Val = std::pair<const int, Compiler::DefDataMidi>; _KeyOfValue = std::_Select1st<std::pair<const int, Compiler::DefDataMidi> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, Compiler::DefDataMidi> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:2438:18,
    inlined from ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = Compiler::DefDataMidi; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, Compiler::DefDataMidi> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_map.h:501:37,
    inlined from ‘bool Compiler::outputMidiDef(int, uint16_t, uint16_t, int, int&)’ at /home/Administrator/gigatron-rom-master/at67/compiler.cpp:4588:73:
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:145:26: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  145 |         ::operator delete(__p
      |         ~~~~~~~~~~~~~~~~~^~~~
  146 | #if __cpp_sized_deallocation
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  147 |                           , __t * sizeof(_Tp)
      |                           ~~~~~~~~~~~~~~~~~~~
  148 | #endif
      | ~~~~~~
  149 |                          );
      |                          ~
/home/Administrator/gigatron-rom-master/at67/compiler.cpp: In function ‘bool Compiler::outputMidiDef(int, uint16_t, uint16_t, int, int&)’:
/home/Administrator/gigatron-rom-master/at67/compiler.cpp:34:18: note: returned from ‘void* malloc(size_t)’
   34 |     return malloc(size);
      |            ~~~~~~^~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/c++allocator.h:33,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/allocator.h:46,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/string:41,
                 from /home/Administrator/gigatron-rom-master/at67/compiler.cpp:6:
In member function ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = Compiler::ModuleLine]’,
    inlined from ‘static void std::allocator_traits<std::allocator<_CharT> >::deallocate(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, std::allocator_traits<std::allocator<_CharT> >::pointer, std::allocator_traits<std::allocator<_CharT> >::size_type) [with _Tp = Compiler::ModuleLine]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/alloc_traits.h:492:23,
    inlined from ‘void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(std::_Vector_base<_Tp, _Alloc>::pointer, std::size_t) [with _Tp = Compiler::ModuleLine; _Alloc = std::allocator<Compiler::ModuleLine>]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_vector.h:354:19,
    inlined from ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = Compiler::ModuleLine; _Alloc = std::allocator<Compiler::ModuleLine>]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_vector.h:335:15,
    inlined from ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = Compiler::ModuleLine; _Alloc = std::allocator<Compiler::ModuleLine>]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_vector.h:512:37,
    inlined from ‘bool Compiler::loadModule(const string&, int, std::vector<Compiler::Input>&, int&)’ at /home/Administrator/gigatron-rom-master/at67/compiler.cpp:2073:55:
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:145:26: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  145 |         ::operator delete(__p
      |         ~~~~~~~~~~~~~~~~~^~~~
  146 | #if __cpp_sized_deallocation
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  147 |                           , __t * sizeof(_Tp)
      |                           ~~~~~~~~~~~~~~~~~~~
  148 | #endif
      | ~~~~~~
  149 |                          );
      |                          ~
/home/Administrator/gigatron-rom-master/at67/compiler.cpp: In function ‘bool Compiler::loadModule(const string&, int, std::vector<Compiler::Input>&, int&)’:
/home/Administrator/gigatron-rom-master/at67/compiler.cpp:34:18: note: returned from ‘void* malloc(size_t)’
   34 |     return malloc(size);
      |            ~~~~~~^~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/c++allocator.h:33,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/allocator.h:46,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/string:41,
                 from /home/Administrator/gigatron-rom-master/at67/compiler.cpp:6:
In member function ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’,
    inlined from ‘static void std::allocator_traits<std::allocator<_CharT> >::deallocate(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, std::allocator_traits<std::allocator<_CharT> >::pointer, std::allocator_traits<std::allocator<_CharT> >::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/alloc_traits.h:492:23,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_put_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, Keywords::Keyword>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, Keywords::Keyword> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:565:34,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_construct_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, std::tuple<>}; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, Keywords::Keyword>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, Keywords::Keyword> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:602:19,
    inlined from ‘std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, std::tuple<>}; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, Keywords::Keyword>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, Keywords::Keyword> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:612:21,
    inlined from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, std::tuple<>}; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, Keywords::Keyword>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, Keywords::Keyword> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:2429:33,
    inlined from ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::basic_string<char>; _Tp = Keywords::Keyword; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_map.h:501:37,
    inlined from ‘Compiler::StatementResult Compiler::createVasmCode(Compiler::CodeLine&, int, int)’ at /home/Administrator/gigatron-rom-master/at67/compiler.cpp:3618:53:
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:145:26: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  145 |         ::operator delete(__p
      |         ~~~~~~~~~~~~~~~~~^~~~
  146 | #if __cpp_sized_deallocation
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  147 |                           , __t * sizeof(_Tp)
      |                           ~~~~~~~~~~~~~~~~~~~
  148 | #endif
      | ~~~~~~
  149 |                          );
      |                          ~
/home/Administrator/gigatron-rom-master/at67/compiler.cpp: In function ‘Compiler::StatementResult Compiler::createVasmCode(Compiler::CodeLine&, int, int)’:
/home/Administrator/gigatron-rom-master/at67/compiler.cpp:34:18: note: returned from ‘void* malloc(size_t)’
   34 |     return malloc(size);
      |            ~~~~~~^~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/c++allocator.h:33,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/allocator.h:46,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/string:41,
                 from /home/Administrator/gigatron-rom-master/at67/compiler.cpp:6:
In member function ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’,
    inlined from ‘static void std::allocator_traits<std::allocator<_CharT> >::deallocate(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, std::allocator_traits<std::allocator<_CharT> >::pointer, std::allocator_traits<std::allocator<_CharT> >::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/alloc_traits.h:492:23,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_put_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, Keywords::Keyword>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, Keywords::Keyword> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:565:34,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_drop_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, Keywords::Keyword>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, Keywords::Keyword> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:632:13,
    inlined from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, std::tuple<>}; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, Keywords::Keyword>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, Keywords::Keyword> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:2438:18,
    inlined from ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::basic_string<char>; _Tp = Keywords::Keyword; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, Keywords::Keyword> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_map.h:501:37,
    inlined from ‘Compiler::StatementResult Compiler::createVasmCode(Compiler::CodeLine&, int, int)’ at /home/Administrator/gigatron-rom-master/at67/compiler.cpp:3618:53:
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:145:26: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  145 |         ::operator delete(__p
      |         ~~~~~~~~~~~~~~~~~^~~~
  146 | #if __cpp_sized_deallocation
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  147 |                           , __t * sizeof(_Tp)
      |                           ~~~~~~~~~~~~~~~~~~~
  148 | #endif
      | ~~~~~~
  149 |                          );
      |                          ~
/home/Administrator/gigatron-rom-master/at67/compiler.cpp: In function ‘Compiler::StatementResult Compiler::createVasmCode(Compiler::CodeLine&, int, int)’:
/home/Administrator/gigatron-rom-master/at67/compiler.cpp:34:18: note: returned from ‘void* malloc(size_t)’
   34 |     return malloc(size);
      |            ~~~~~~^~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/c++allocator.h:33,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/allocator.h:46,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/string:41,
                 from /home/Administrator/gigatron-rom-master/at67/compiler.cpp:6:
In member function ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const std::basic_string<char>, int> >]’,
    inlined from ‘static void std::allocator_traits<std::allocator<_CharT> >::deallocate(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, std::allocator_traits<std::allocator<_CharT> >::pointer, std::allocator_traits<std::allocator<_CharT> >::size_type) [with _Tp = std::_Rb_tree_node<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/alloc_traits.h:492:23,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_put_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, int> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:565:34,
    inlined from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_construct_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type, _Args&& ...) [with _Args = {const std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>&}; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, int> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:602:19,
    inlined from ‘std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>&}; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, int> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:612:21,
    inlined from ‘std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Alloc_node::operator()(_Arg&&) const [with _Arg = const std::pair<const std::basic_string<char>, int>&; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, int> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:529:32,
    inlined from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Base_ptr, _Arg&&, _NodeGen&) [with _Arg = const std::pair<const std::basic_string<char>, int>&; _NodeGen = std::_Rb_tree<std::basic_string<char>, std::pair<const std::basic_string<char>, int>, std::_Select1st<std::pair<const std::basic_string<char>, int> >, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, int> > >::_Alloc_node; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, int> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:1782:29,
    inlined from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Arg&&, _NodeGen&) [with _Arg = const std::pair<const std::basic_string<char>, int>&; _NodeGen = std::_Rb_tree<std::basic_string<char>, std::pair<const std::basic_string<char>, int>, std::_Select1st<std::pair<const std::basic_string<char>, int> >, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, int> > >::_Alloc_node; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, int> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:2235:19,
    inlined from ‘std::__enable_if_t<std::is_same<_Val, typename std::iterator_traits<_InIterator>::value_type>::value> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = const std::pair<const std::basic_string<char>, int>*; _Key = std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, int> >; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_tree.h:1102:23,
    inlined from ‘std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const _Compare&, const allocator_type&) [with _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >]’ at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/stl_map.h:232:36,
    inlined from ‘void __static_initialization_and_destruction_0(int, int)’ at /home/Administrator/gigatron-rom-master/at67/compiler.cpp:73:32,
    inlined from ‘(static initializers for /home/Administrator/gigatron-rom-master/at67/compiler.cpp)’ at /home/Administrator/gigatron-rom-master/at67/compiler.cpp:5626:1:
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/new_allocator.h:145:26: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  145 |         ::operator delete(__p
      |         ~~~~~~~~~~~~~~~~~^~~~
  146 | #if __cpp_sized_deallocation
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  147 |                           , __t * sizeof(_Tp)
      |                           ~~~~~~~~~~~~~~~~~~~
  148 | #endif
      | ~~~~~~
  149 |                          );
      |                          ~
/home/Administrator/gigatron-rom-master/at67/compiler.cpp: In function ‘(static initializers for /home/Administrator/gigatron-rom-master/at67/compiler.cpp)’:
/home/Administrator/gigatron-rom-master/at67/compiler.cpp:34:18: note: returned from ‘void* malloc(size_t)’
   34 |     return malloc(size);
      |            ~~~~~~^~~~~~
[  8%] Building CXX object CMakeFiles/gtemuAT67.dir/cpu.cpp.o
[  9%] Building CXX object CMakeFiles/gtemuAT67.dir/dialog.cpp.o
[ 11%] Building CXX object CMakeFiles/gtemuAT67.dir/editor.cpp.o
[ 12%] Building CXX object CMakeFiles/gtemuAT67.dir/expression.cpp.o
[ 14%] Building CXX object CMakeFiles/gtemuAT67.dir/functions.cpp.o
[ 16%] Building CXX object CMakeFiles/gtemuAT67.dir/gigatron.cpp.o
[ 17%] Building CXX object CMakeFiles/gtemuAT67.dir/graphics.cpp.o
[ 19%] Building CXX object CMakeFiles/gtemuAT67.dir/image.cpp.o
/home/Administrator/gigatron-rom-master/at67/image.cpp: In function ‘bool Image::loadGtRgbFile(const string&, Image::GtRgbFile&)’:
/home/Administrator/gigatron-rom-master/at67/image.cpp:97:35: error: cannot bind non-const lvalue reference of type ‘std::streampos&’ {aka ‘std::fpos<_mbstate_t>&’} to an rvalue of type ‘std::streampos’ {aka ‘std::fpos<_mbstate_t>’}
   97 |         if(!getFileSize(filename, fileSize))
      |                                   ^~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/char_traits.h:40,
                 from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/string:40,
                 from /home/Administrator/gigatron-rom-master/at67/image.cpp:2:
/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/postypes.h:133:7: note:   after user-defined conversion: ‘std::fpos<_StateT>::fpos(std::streamoff) [with _StateT = _mbstate_t; std::streamoff = long int]’
  133 |       fpos(streamoff __off)
      |       ^~~~
/home/Administrator/gigatron-rom-master/at67/image.cpp:74:67: note:   initializing argument 2 of ‘bool Image::getFileSize(const string&, std::streampos&)’
   74 |     bool getFileSize(const std::string& filename, std::streampos& fileSize)
      |                                                   ~~~~~~~~~~~~~~~~^~~~~~~~
make[2]: *** [CMakeFiles/gtemuAT67.dir/build.make:230: CMakeFiles/gtemuAT67.dir/image.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:190: CMakeFiles/gtemuAT67.dir/all] Error 2
make: *** [Makefile:91: all] Error 2




Attachments
截图未命名0319232418.jpeg
截图未命名0319232418.jpeg (73.2 KiB) Viewed 467 times
denjhang
Posts: 50
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

Code: Select all

gcc version 11.2.0 (Ubuntu 11.2.0-7ubuntu2)
root@denjhang-virtual-machine:/home/denjhang/gigatron-rom-master/Contrib/at67# cmake -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/denjhang/gigatron-rom-master/Contrib/at67
root@denjhang-virtual-machine:/home/denjhang/gigatron-rom-master/Contrib/at67# make
Scanning dependencies of target gtemuAT67
[  1%] Building C object CMakeFiles/gtemuAT67.dir/rs232/rs232-linux.c.o
[  3%] Building CXX object CMakeFiles/gtemuAT67.dir/assembler.cpp.o
[  4%] Building CXX object CMakeFiles/gtemuAT67.dir/audio.cpp.o
[  6%] Building CXX object CMakeFiles/gtemuAT67.dir/compiler.cpp.o
[  7%] Building CXX object CMakeFiles/gtemuAT67.dir/cpu.cpp.o
[  9%] Building CXX object CMakeFiles/gtemuAT67.dir/dialog.cpp.o
[ 11%] Building CXX object CMakeFiles/gtemuAT67.dir/editor.cpp.o
[ 12%] Building CXX object CMakeFiles/gtemuAT67.dir/expression.cpp.o
[ 14%] Building CXX object CMakeFiles/gtemuAT67.dir/functions.cpp.o
[ 15%] Building CXX object CMakeFiles/gtemuAT67.dir/gigatron.cpp.o
[ 17%] Building CXX object CMakeFiles/gtemuAT67.dir/graphics.cpp.o
[ 19%] Building CXX object CMakeFiles/gtemuAT67.dir/image.cpp.o
/home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp:74:51: error: ‘std::ifstream::streampos’ has not been declared
   74 |     bool getFileSize(const std::string& filename, std::ifstream::streampos& fileSize)
      |                                                   ^~~
/home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp: In function ‘bool Image::loadGtRgbFile(const string&, Image::GtRgbFile&)’:
/home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp:97:35: error: cannot bind non-const lvalue reference of type ‘int&’ to a value of type ‘size_t’ {aka  long unsigned int’}
   97 |         if(!getFileSize(filename, fileSize))
      |                                   ^~~~~~~~
/home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp:74:77: note:   initializing argument 2 of ‘bool Image::getFileSize(const string&, int&)’
   74 | leSize(const std::string& filename, std::ifstream::streampos& fileSize)
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

make[2]: *** [CMakeFiles/gtemuAT67.dir/build.make:225:CMakeFiles/gtemuAT67.dir/image.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:220:CMakeFiles/gtemuAT67.dir/all] 错误 2
make: *** [Makefile:103:all] 错误 2
root@denjhang-virtual-machine:/home/denjhang/gigatron-rom-master/Contrib/at67# make
Scanning dependencies of target gtemuAT67
[  1%] Building CXX object CMakeFiles/gtemuAT67.dir/image.cpp.o
/home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp: In function ‘bool Image::loadGtRgbFile(const string&, Image::GtRgbFile&)’:
/home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp:97:35: error: cannot bind non-const lvalue reference of type ‘std::streampos&’ {aka ‘std::fpos<__mbstate_t>&’} to an rvalue of type ‘std::streampos’ {aka ‘std::fpos<__mbstate_t>’}
   97 |         if(!getFileSize(filename, fileSize))
      |                                   ^~~~~~~~
In file included from /usr/include/c++/11/bits/char_traits.h:40,
                 from /usr/include/c++/11/string:40,
                 from /home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp:2:
/usr/include/c++/11/bits/postypes.h:133:7: note:   after user-defined conversion: ‘std::fpos<_StateT>::fpos(std::streamoff) [with _StateT = __mbstate_t; std::streamoff = long int]’
  133 |       fpos(streamoff __off)
      |       ^~~~
/home/denjhang/gigatron-rom-master/Contrib/at67/image.cpp:74:67: note:   initializing argument 2 of ‘bool Image::getFileSize(const string&, std::streampos&)’
   74 | bool getFileSize(const std::string& filename, std::streampos& fileSize)
      |                                               ~~~~~~~~~~~~~~~~^~~~~~~~

make[2]: *** [CMakeFiles/gtemuAT67.dir/build.make:225:CMakeFiles/gtemuAT67.dir/image.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:220:CMakeFiles/gtemuAT67.dir/all] 错误 2
make: *** [Makefile:103:all] 错误 2
root@denjhang-virtual-machine:/home/denjhang/gigatron-rom-master/Contrib/at67#



I tried to compile it with Ubuntu 21.10 and here is the result, which seems to be similar to cgywin.
But I remember successfully compiling and successfully running gtemuAT67 on an earlier version of Ubuntu about a year ago.
I also tried something like msys2 at the same time, seemingly inexplicable errors, I can't even run cmake successfully. mingw64 is similar.

Code: Select all

Administrator@USERUQI-G4T92PQ MSYS ~
# cd /home/Administrator/at67

Administrator@USERUQI-G4T92PQ MSYS ~/at67
# cmake -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc.exe
-- Check for working C compiler: /usr/bin/cc.exe - broken
CMake Error at /usr/share/cmake-3.22.1/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/bin/cc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/Administrator/at67/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make.exe -f Makefile cmTC_556af/fast && make: Warning: File 'Makefile' has modification time 0.38 s in the future
    /usr/bin/make  -f CMakeFiles/cmTC_556af.dir/build.make CMakeFiles/cmTC_556af.dir/build
    make[1]: Entering directory '/home/Administrator/at67/CMakeFiles/CMakeTmp'
    make[1]: Warning: File 'CMakeFiles/cmTC_556af.dir/flags.make' has modification time 0.37 s in the future
    Building C object CMakeFiles/cmTC_556af.dir/testCCompiler.c.o
    /usr/bin/cc.exe    -o CMakeFiles/cmTC_556af.dir/testCCompiler.c.o -c /home/Administrator/at67/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_556af.exe
    /usr/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTC_556af.dir/link.txt --verbose=1
    /usr/bin/cc.exe -Wl,--enable-auto-import  CMakeFiles/cmTC_556af.dir/testCCompiler.c.o -o cmTC_556af.exe -Wl,--out-implib,libcmTC_556af.dll.a -Wl,--major-image-version,0,--minor-image-version,0
    collect2: fatal error: cannot find ‘ld’
    compilation terminated.
    make[1]: *** [CMakeFiles/cmTC_556af.dir/build.make:99: cmTC_556af.exe] Error 1
    make[1]: Leaving directory '/home/Administrator/at67/CMakeFiles/CMakeTmp'
    make: *** [Makefile:127: cmTC_556af/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


-- Configuring incomplete, errors occurred!
See also "/home/Administrator/at67/CMakeFiles/CMakeOutput.log".
See also "/home/Administrator/at67/CMakeFiles/CMakeError.log".

Code: Select all


Administrator@USERUQI-G4T92PQ MINGW64 ~
# cd /home/Administrator/at67

Administrator@USERUQI-G4T92PQ MINGW64 ~/at67
# cmake -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


CMake Error: The current CMakeCache.txt directory F:/msys65/home/Administrator/at67/CMakeCache.txt is different than the directory /home/Administrator/at67 where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source "F:/msys65/home/Administrator/at67/CMakeLists.txt" does not match the source "/home/Administrator/at67/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

Administrator@USERUQI-G4T92PQ MINGW64 ~/at67
#


at67
Posts: 486
Joined: 14 May 2018, 08:29

Re: Try compiling gtemuAT67 with Cygwin

Post by at67 »

Did you try changing 'std::ifstream::streampos' to 'size_t' as shown in the code blocks? I can't see any errors in your output for size_t.

For the malloc malarkey, find usages of '_heapTotalUsage' and '_heapAllocations' in compiler.cpp and comment them out.

Also comment out this block of code at the start of compiler.cpp:

Code: Select all

size_t _heapTotalUsage = 0;
size_t _heapAllocations = 0;
void* operator new(size_t size)
{
    _heapTotalUsage += size;
    _heapAllocations++;

    return malloc(size);
}
denjhang
Posts: 50
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

at67 wrote: 19 Mar 2022, 16:00 Did you try changing 'std::ifstream::streampos' to 'size_t' as shown in the code blocks? I can't see any errors in your output for size_t.

For the malloc malarkey, find usages of '_heapTotalUsage' and '_heapAllocations' in compiler.cpp and comment them out.

Also comment out this block of code at the start of compiler.cpp:

Code: Select all

size_t _heapTotalUsage = 0;
size_t _heapAllocations = 0;
void* operator new(size_t size)
{
    _heapTotalUsage += size;
    _heapAllocations++;

    return malloc(size);
}

I double-check these modifications you said in case I missed something. Now the same error as before is no longer appearing. However, the compiling process using cygwin is very long, and I waited for more than ten minutes to complete. And when I compile it, there still seems to be a problem with SDL.
If Cygwin can't complete the compilation all the time, how to compile it with vc++?
I need the latest version of gtemuAT67 to run on Windows 10, which helps me to debug and develop gigatron programs faster.

Code: Select all


Administrator@USERUQI-G4T92PQ ~
$ cd /home/Administrator/gigatron-rom-master/at67

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/at67
$ cmake -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/Administrator/gigatron-rom-master/at67

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/at67
$ make
[  1%] Building C object CMakeFiles/gtemuAT67.dir/rs232/rs232-linux.c.o
[  3%] Building CXX object CMakeFiles/gtemuAT67.dir/assembler.cpp.o
[  4%] Building CXX object CMakeFiles/gtemuAT67.dir/audio.cpp.o
[  6%] Building CXX object CMakeFiles/gtemuAT67.dir/compiler.cpp.o
[  8%] Building CXX object CMakeFiles/gtemuAT67.dir/cpu.cpp.o
[  9%] Building CXX object CMakeFiles/gtemuAT67.dir/dialog.cpp.o
[ 11%] Building CXX object CMakeFiles/gtemuAT67.dir/editor.cpp.o
[ 12%] Building CXX object CMakeFiles/gtemuAT67.dir/expression.cpp.o
[ 14%] Building CXX object CMakeFiles/gtemuAT67.dir/functions.cpp.o
[ 16%] Building CXX object CMakeFiles/gtemuAT67.dir/gigatron.cpp.o
[ 17%] Building CXX object CMakeFiles/gtemuAT67.dir/graphics.cpp.o
[ 19%] Building CXX object CMakeFiles/gtemuAT67.dir/image.cpp.o
[ 20%] Building CXX object CMakeFiles/gtemuAT67.dir/keywords.cpp.o
[ 22%] Building CXX object CMakeFiles/gtemuAT67.dir/linker.cpp.o
[ 24%] Building CXX object CMakeFiles/gtemuAT67.dir/loader.cpp.o
[ 25%] Building CXX object CMakeFiles/gtemuAT67.dir/main.cpp.o
[ 27%] Building CXX object CMakeFiles/gtemuAT67.dir/memory.cpp.o
[ 29%] Building CXX object CMakeFiles/gtemuAT67.dir/menu.cpp.o
[ 30%] Building CXX object CMakeFiles/gtemuAT67.dir/midi.cpp.o
[ 32%] Building CXX object CMakeFiles/gtemuAT67.dir/operators.cpp.o
[ 33%] Building CXX object CMakeFiles/gtemuAT67.dir/optimiser.cpp.o
[ 35%] Building CXX object CMakeFiles/gtemuAT67.dir/pragmas.cpp.o
[ 37%] Building CXX object CMakeFiles/gtemuAT67.dir/terminal.cpp.o
[ 38%] Building CXX object CMakeFiles/gtemuAT67.dir/test.cpp.o
[ 40%] Building CXX object CMakeFiles/gtemuAT67.dir/timing.cpp.o
[ 41%] Building CXX object CMakeFiles/gtemuAT67.dir/validater.cpp.o
[ 43%] Linking CXX executable gtemuAT67.exe
[ 43%] Built target gtemuAT67
[ 45%] Building CXX object tools/gtasm/CMakeFiles/gtasm.dir/__/__/memory.cpp.o
[ 46%] Building CXX object tools/gtasm/CMakeFiles/gtasm.dir/__/__/loader.cpp.o
[ 48%] Building CXX object tools/gtasm/CMakeFiles/gtasm.dir/__/__/cpu.cpp.o
[ 50%] Building CXX object tools/gtasm/CMakeFiles/gtasm.dir/__/__/assembler.cpp.o
[ 51%] Building CXX object tools/gtasm/CMakeFiles/gtasm.dir/__/__/expression.cpp.o
[ 53%] Building CXX object tools/gtasm/CMakeFiles/gtasm.dir/gtasm.cpp.o
[ 54%] Linking CXX executable gtasm.exe
[ 54%] Built target gtasm
[ 56%] Building CXX object tools/gtmidi/CMakeFiles/gtmidi.dir/__/__/expression.cpp.o
[ 58%] Building CXX object tools/gtmidi/CMakeFiles/gtmidi.dir/gtmidi.cpp.o
[ 59%] Linking CXX executable gtmidi.exe
[ 59%] Built target gtmidi
[ 61%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/memory.cpp.o
[ 62%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/loader.cpp.o
[ 64%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/cpu.cpp.o
[ 66%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/image.cpp.o
[ 67%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/expression.cpp.o
[ 69%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/assembler.cpp.o
[ 70%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/compiler.cpp.o
[ 72%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/operators.cpp.o
[ 74%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/functions.cpp.o
[ 75%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/keywords.cpp.o
[ 77%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/midi.cpp.o
[ 79%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/pragmas.cpp.o
[ 80%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/optimiser.cpp.o
[ 82%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/validater.cpp.o
[ 83%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/__/__/linker.cpp.o
[ 85%] Building CXX object tools/gtbasic/CMakeFiles/gtbasic.dir/gtbasic.cpp.o
[ 87%] Linking CXX executable gtbasic.exe
[ 87%] Built target gtbasic
[ 88%] Building CXX object tools/gt1torom/CMakeFiles/gt1torom.dir/gt1torom.cpp.o
[ 90%] Linking CXX executable gt1torom.exe
[ 90%] Built target gt1torom
[ 91%] Building CXX object tools/gtmakerom/CMakeFiles/gtmakerom.dir/__/__/cpu.cpp.o
[ 93%] Building CXX object tools/gtmakerom/CMakeFiles/gtmakerom.dir/gtmakerom.cpp.o
[ 95%] Linking CXX executable gtmakerom.exe
[ 95%] Built target gtmakerom
[ 96%] Building CXX object tools/gtsplitrom/CMakeFiles/gtsplitrom.dir/__/__/cpu.cpp.o
[ 98%] Building CXX object tools/gtsplitrom/CMakeFiles/gtsplitrom.dir/gtsplitrom.cpp.o
[100%] Linking CXX executable gtsplitrom.exe
[100%] Built target gtsplitrom

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/at67
$ cmake -DCMAKE_BUILD_TYPE=Release
gtemuAT67
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/Administrator/gigatron-rom-master/at67
-bash: gtemuAT67: command not found

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/at67
$ ./gtemuAT67
Loader::initialise() : Couldn't find COM Port '0' in INI file 'loader_config.ini'
Cpu::initialise() : failed to initialise SDL.
Press ENTER to continue . . .


at67
Posts: 486
Joined: 14 May 2018, 08:29

Re: Try compiling gtemuAT67 with Cygwin

Post by at67 »

So it compiles without warning and errors but takes ten minutes to compile? I can build the entire thing on a Raspberry Pi400 in just over 1 minute.

You only need to build it once and what has Cygwin's failures have to do with VSC++? I don't understand the cause and effect...

You also don't need the full emulator package, you can build *.gbas programs from the command line using the gtbasic command:

Code: Select all

D:\Projects\Gigatron TTL\buildx64\gbas\apps\Browser_SDCard>gtbasic

gtbasic v1.1.0R
Usage:   gtbasic <input filename> <optional include path>

D:\Projects\Gigatron TTL\buildx64\gbas\apps\Browser_SDCard>
The same goes with the rest of my tools, gtasm, gtmidi, gtsplitrom etc.

Here's the code in cpu.cpp that initialises SDL:

Code: Select all

        // SDL initialisation
        if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0)
        {
            reportError(SdlError, stderr, "Cpu::initialise() : failed to initialise SDL.\n");
            _EXIT_(EXIT_FAILURE);
        }
Pretty simple huh? I did a Google search for you, "SDL_Init fails", it could be the video that is failing, or the audio, given that it seems you are trying to build/run on a potato from above.

Change the above code to this and let me know what it prints:

Code: Select all

        // SDL initialisation
        if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0)
        {
            reportError(SdlError, stderr, "Cpu::initialise() : failed to initialise SDL: %s\n", SDL_GetError());
            _EXIT_(EXIT_FAILURE);
        }
P.S. You may not have the reportError() function in your version of the source code, it may be a fprintf(stderr, ...), just insert the %s and the SDL_GetError() into the fprintf appropriately if that is the case.
denjhang
Posts: 50
Joined: 02 May 2021, 01:25
Location: yuenan
Contact:

Re: Try compiling gtemuAT67 with Cygwin

Post by denjhang »

at67 wrote: 19 Mar 2022, 22:32 So it compiles without warning and errors but takes ten minutes to compile? I can build the entire thing on a Raspberry Pi400 in just over 1 minute.

You only need to build it once and what has Cygwin's failures have to do with VSC++? I don't understand the cause and effect...

You also don't need the full emulator package, you can build *.gbas programs from the command line using the gtbasic command:

Code: Select all

D:\Projects\Gigatron TTL\buildx64\gbas\apps\Browser_SDCard>gtbasic

gtbasic v1.1.0R
Usage:   gtbasic <input filename> <optional include path>

D:\Projects\Gigatron TTL\buildx64\gbas\apps\Browser_SDCard>
The same goes with the rest of my tools, gtasm, gtmidi, gtsplitrom etc.

Here's the code in cpu.cpp that initialises SDL:

Code: Select all

        // SDL initialisation
        if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0)
        {
            reportError(SdlError, stderr, "Cpu::initialise() : failed to initialise SDL.\n");
            _EXIT_(EXIT_FAILURE);
        }
Pretty simple huh? I did a Google search for you, "SDL_Init fails", it could be the video that is failing, or the audio, given that it seems you are trying to build/run on a potato from above.

Change the above code to this and let me know what it prints:

Code: Select all

        // SDL initialisation
        if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0)
        {
            reportError(SdlError, stderr, "Cpu::initialise() : failed to initialise SDL: %s\n", SDL_GetError());
            _EXIT_(EXIT_FAILURE);
        }
P.S. You may not have the reportError() function in your version of the source code, it may be a fprintf(stderr, ...), just insert the %s and the SDL_GetError() into the fprintf appropriately if that is the case.

Code: Select all

        // SDL initialisation
        if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0)
        {
            fprintf(stderr, "Cpu::initialise() : failed to initialise SDL:%s\n",SDL_GetError());
            _EXIT_(EXIT_FAILURE);
        }

I modified the code as you suggested and am currently waiting for the compilation to complete (ten minutes) and I have no idea why it is so slow. I'm running an Ubuntu virtual machine on the same computer and it only takes 1 minute or so for me to compile correctly on Ubuntu, and it runs fine on Ubuntu with no SDL errors.
.......................................
Then ten minutes came and I got these.

Code: Select all

Administrator@USERUQI-G4T92PQ ~/gigatron-rom-master/at67
$ ./gtemuAT67
Loader::initialise() : Couldn't find COM Port '0' in INI file 'loader_config.ini'
Cpu::initialise() : failed to initialise SDL:No available video device
Press ENTER to continue . . .

at67
Posts: 486
Joined: 14 May 2018, 08:29

Re: Try compiling gtemuAT67 with Cygwin

Post by at67 »

I didn't realise you were trying to run it in a VM, what happens when you type glxinfo at a terminal, (or glxgears)? Have you tried running any of the SDL2 examples?

Google is your friend here, either you didn't download the SDL2 opengl backend as part of the SDL2 installation, or something is amiss with your VM's X11/opengl/etc.
Post Reply