Closed TheOrangeCat closed 5 years ago
Hi, @TheOrangeCat, thank you for this. I am a fan of PoP! OS. :)
So, this is actually a new GCC compiler warning recently introduced which I somewhat disagree with since it doesn't actually narrow the data, and the data really is binary bits rather than chars, which, it makes it negative, which is fine and ignoreable.
However, from a pedantic point of view, yes, it does technically narrow the range of the bytes, but this should be a warning and not an error and the compiler maintainers, or rather C++ language committee are unnecessarily too strict here.
There's an easy fix for this which is to edit the code at lines ~1486 with casts. This has been fixed in the pending 1.2.7 version which I'll likely release later this summer/early autumn, however, if you'd like to fix this right now, this is how, change char to const unsigned char. (There may be more of these elsewhere.)
#if defined(__WXX11__) || defined(__WXGTK__) || defined(__WXOSX__)
#ifdef __WXOSX__
/* LSB (0x01) is leftmost. First byte is top row. 1 is black/visible*/
const unsigned char cursor_bits[] = {0x00, 0x0e, 0x0e, 0x0e, 0x00};
const unsigned char mask_bits[] = {0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
#else
const unsigned char cursor_bits[] = {0xe0, 0xee, 0xee, 0xee, 0xe0};
const unsigned char mask_bits[] = {0xe0, 0xe0, 0xe0, 0xe0, 0xe0};
#endif
Editing CFLAGS is also possible by editing the top level build.sh script, but I'd prefer to fix or at least address old C++ standard code to make it work on newer versions of compilers instead.
Thanks!
@rayarachelian Strangely enough now I get this:
lisaem_wx.cpp: In constructor ‘LisaWin::LisaWin(wxWindow*)’:
lisaem_wx.cpp:1489:49: error: no matching function for call to ‘wxBitmap(const unsigned char [5], int, int)’
wxBitmap bmp = wxBitmap(cursor_bits, 8, 5);
^
lisaem_wx.cpp:1489:49: error: invalid conversion from ‘const unsigned char*’ to ‘const char*’ [-fpermissive]
wxBitmap bmp = wxBitmap(cursor_bits, 8, 5);
^
lisaem_wx.cpp:1490:55: error: no matching function for call to ‘wxBitmap(const unsigned char [5], int, int)’
bmp.SetMask(new wxMask(wxBitmap(mask_bits, 8, 5)));
^
lisaem_wx.cpp:1490:55: error: invalid conversion from ‘const unsigned char*’ to ‘const char*’ [-fpermissive]
bmp.SetMask(new wxMask(wxBitmap(mask_bits, 8, 5)));
^
lisaem_wx.cpp:1490:55: error: invalid conversion from ‘const unsigned char*’ to ‘int’ [-fpermissive]
bmp.SetMask(new wxMask(wxBitmap(mask_bits, 8, 5)));
^
lisaem_wx.cpp: In member function ‘virtual bool LisaEmApp::OnInit()’:
lisaem_wx.cpp:1750:17: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
ext=strstr(argv1.fn_str(),".lisaem");
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Eh, yes, there will be many more casts to do, respectively:
wxBitmap bmp = wxBitmap((const char *)cursor_bits, 8, 5, 1);
bmp.SetMask(new wxMask(wxBitmap((const char *)mask_bits, 8, 5, 1)));
ext=strstr((const char *)argv1.fn_str(),".lisaem");
You'll likely run into others, so just recast them as needed.
Huh. I changed it to ext=strstr(const_cast<char*>(argv1.fn_str()),".lisaem");
and now it returns this.
Linking ./bin/lisaem
/ usr / bin / ld: /usr/local/lib/libwx_gtk2d_core-2.8.a(corelib_utilsx11.o): undefined reference to the "XGetWindowAttributes" symbol
/ usr / bin / ld: /lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO is not specified in the command line
collect2: error: ld returned 1 exit status
(it may be a bit different from what it is because my system uses russian as main language so the version i pasted is translated through google translate)
Lets try switching to wxWidgets 3.1x which you may need to compile yourself.Let me know if you need help building it.2.8 that ships with the OS, should work but it's really old, and maybe it's missing some stuff that''s needed.Sent from my T-Mobile 4G LTE Device
-------- Original message -------- From: Valery Klimin notifications@github.com Date: 6/28/19 4:28 PM (GMT-05:00) To: "rayarachelian/lisaem-1.2.x" lisaem-1.2.x@noreply.github.com Cc: Ray Arachelian ray.arachelian@gmail.com, Mention mention@noreply.github.com Subject: Re: [rayarachelian/lisaem-1.2.x] Cannot './build.sh install' on Pop!_OS 19.04 (#11)
Huh. I changed it to ext=strstr(const_cast<char*>(argv1.fn_str()),".lisaem"); and now it returns this. / usr / bin / ld: /usr/local/lib/libwx_gtk2d_core-2.8.a(corelib_utilsx11.o): undefined reference to the "XGetWindowAttributes" symbol / usr / bin / ld: /lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO is not specified in the command line collect2: error: ld returned 1 exit status
(it may be a bit different from what it is because my system uses russian as main language so the version i pasted is translated through google translate)
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/rayarachelian/lisaem-1.2.x/issues/11?email_source=notifications\u0026email_token=ADGVRHSNEZZQRT6HKC6ONUDP4ZX77A5CNFSM4H4HC73KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY3C2ZQ#issuecomment-506867046", "url": "https://github.com/rayarachelian/lisaem-1.2.x/issues/11?email_source=notifications\u0026email_token=ADGVRHSNEZZQRT6HKC6ONUDP4ZX77A5CNFSM4H4HC73KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY3C2ZQ#issuecomment-506867046", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
@rayarachelian I did compile 3.1.2 with backwards compatability (--enable-compat28) but I still get this error:
lisaem_static_resources.cpp:619:1: error: ‘WXK_PRIOR’ was not declared in this scope
WXK_PRIOR,
^~~~~~~~~
lisaem_static_resources.cpp:619:1: note: suggested alternative: ‘WXK_PRINT’
WXK_PRIOR,
^~~~~~~~~
WXK_PRINT
lisaem_static_resources.cpp:620:1: error: ‘WXK_NEXT’ was not declared in this scope
WXK_NEXT,
^~~~~~~~
lisaem_static_resources.cpp:620:1: note: suggested alternative: ‘WXK_LEFT’
WXK_NEXT,
^~~~~~~~
WXK_LEFT
lisaem_static_resources.cpp:635:1: error: ‘WXK_NUMPAD_PRIOR’ was not declared in this scope
WXK_NUMPAD_PRIOR,
^~~~~~~~~~~~~~~~
lisaem_static_resources.cpp:635:1: note: suggested alternative: ‘WXK_NUMPAD_RIGHT’
WXK_NUMPAD_PRIOR,
^~~~~~~~~~~~~~~~
WXK_NUMPAD_RIGHT
lisaem_static_resources.cpp:636:1: error: ‘WXK_NUMPAD_NEXT’ was not declared in this scope
WXK_NUMPAD_NEXT,
^~~~~~~~~~~~~~~
lisaem_static_resources.cpp:636:1: note: suggested alternative: ‘WXK_NUMPAD_LEFT’
WXK_NUMPAD_NEXT,
^~~~~~~~~~~~~~~
WXK_NUMPAD_LEFT
Can I replace them with what was suggested? If I do it returns this:
lisaem_wx.cpp: In function ‘void rename_rompath(char*)’:
lisaem_wx.cpp:5917:58: error: ‘wxSTRING_MAXLEN’ was not declared in this scope
my_lisaconfig->rompath=wxString(rompath, wxConvLocal, wxSTRING_MAXLEN);
^~~~~~~~~~~~~~~
lisaem_wx.cpp:5917:58: note: suggested alternative: ‘BC_STRING_MAX’
my_lisaconfig->rompath=wxString(rompath, wxConvLocal, wxSTRING_MAXLEN);
^~~~~~~~~~~~~~~
BC_STRING_MAX
lisaem_wx.cpp: In function ‘int pickprofilesize(char*)’:
lisaem_wx.cpp:5959:47: error: ‘wxSTRING_MAXLEN’ was not declared in this scope
wxString txt=wxString(filename, wxConvLocal, wxSTRING_MAXLEN);
^~~~~~~~~~~~~~~
lisaem_wx.cpp:5959:47: note: suggested alternative: ‘BC_STRING_MAX’
wxString txt=wxString(filename, wxConvLocal, wxSTRING_MAXLEN);
^~~~~~~~~~~~~~~
BC_STRING_MAX
It also wants me to replace wxSAVE with wxFC_SAVE. And if I do that we're back to the same problem.
lisaem_wx.cpp: In member function ‘virtual bool LisaEmApp::OnInit()’:
lisaem_wx.cpp:1750:50: error: invalid const_cast from type ‘const wxScopedCharBuffer’ {aka ‘const wxScopedCharTypeBuffer<char>’} to type ‘char*’
ext=strstr(const_cast<char*>(argv1.fn_str()),".lisaem");
^
(If i replace it with what you sent me it returns the error about invalid conversion)
Another thing is that if I set the compiler to the 1998 standard it complains about needing a 2011 compiler but with the 2011 standard it returns errors from my first post.
You shouldn't need to enable wx2.8 backwards compatibility. I'm on Ubuntu 18.04 with GCC 7.4.0, nor would you need to change the C++ standard.
Please compile your own wxWidgets from the wx3.1.2 version, and use the following commands to build it.
You'd download and extract wxWidgets 3.1.2 full source code from https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.2/wxWidgets-3.1.2.tar.bz2, and from the directory immediately above it, you'd paste the following commands into terminal, (it should work for most other versions of wx if you change the VER variable to match.)
export TYPE=gtk
cd wxWidgets-${VER}
mkdir build-${TYPE}
cd build-${TYPE}
export CFLAGS="-fPIC" CXXFLAGS="-fPIC"
../configure --enable-unicode --disable-debug --disable-shared --without-expat --disable-richtext --with-libxpm=builtin \
--prefix=/usr/local/wx${VER}-${TYPE} && make && sudo make install
export PATH=/usr/local/wx${VER}-${TYPE}/bin/:$PATH
You'd keep that last export PATH command for anytime you want to compile LisaEm.
But, are you sure you're using the latest version? I think you might be using a much older release which has had a lot of these things fixed in the latest version.
For example, I just did a git clone https://github.com/rayarachelian/lisaem-1.2.x
and looking at lisaem_static_resources.cpp:636 I see that WXK_NUMPAD_NEXT is commented out, so you're possibly needlessly fixing already fixed issues by using an older commit. Latest commit is 38270a5b74eae1d7ca852f47a8b6ddf3476aeeac
.
A lot of defines have indeed changed with wx3.x, and they are fixed in 1.2.6.2, including replacing of wxSAVE, with wxFD_SAVE, etc. You'll likely have a lot of needless changes to make it work with the version you're using. I'd suggest doing a new git clone and starting over, along with compiling wx3.1.2-gtk as described above.
Thanks! It succesfully compiled and installed. The only concern I'm getting is cp complaining about "/usr/local/share//lisaem/" not being a directory. Do I need to copy them manually?
@rayarachelian After running the thing with copied resources it returns this:
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
../src/gtk/bitmap.cpp(940): assert ""IsOk()"" failed in GetWidth(): invalid bitmap
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
../src/gtk/bitmap.cpp(940): assert ""IsOk()"" failed in GetWidth(): invalid bitmap
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
../src/gtk/bitmap.cpp(940): assert ""IsOk()"" failed in GetWidth(): invalid bitmap
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
../src/gtk/bitmap.cpp(940): assert ""IsOk()"" failed in GetWidth(): invalid bitmap
../src/gtk/bitmap.cpp(933): assert ""IsOk()"" failed in GetHeight(): invalid bitmap
Thanks! It succesfully compiled and installed. The only concern I'm getting is cp complaining about "/usr/local/share//lisaem/" not being a directory. Do I need to copy them manually?
Oh, yeah, that's an old bug where some Mac OS X stuff is bleeding through, run this:
sudo ln -s /usr/local/share/LisaEm /usr/local/share/lisaem
and then do sudo ./build install
again.
Regarding the bitmaps, see if that link fixes it, if not, if not you may need libpng-dev (or whatever PoP! OS uses for the dev version of that deb) installed before wxWidgets is built, it might need --with-libpng={path to libpng} to find it, or alternatively you can try --with-libpng=builtin which should use internal PNG support in wxWidgets
Yes, the link fixed the bitmap error.
btw, forgot to mention this: https://trac.wxwidgets.org/ticket/13100 - the wx 2.8 failure is caused by the distro owner not properly building wxWidgets, it's an 8 year old bug. :) "undefined reference to symbol 'XGetWindowAttributes' in wxGTK 2.8.12 "
I have tried compiling LisaEm and on ./build.sh clean install it doesn't return any errors but on sudo ./build.sh install it returns those errors.
I have read that a similar issue could be fixed by setting CFLAGS='-std=gnu++98' CXXFLAGS='-std=gnu++98' but because ./configure is a dummy script I can't pass them.