Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QB64: 32- and 64-bit BASIC Compiler and IDE #2569

Closed
superloach opened this issue Aug 19, 2018 · 69 comments
Closed

QB64: 32- and 64-bit BASIC Compiler and IDE #2569

superloach opened this issue Aug 19, 2018 · 69 comments
Labels
enhancement 🌱 Feature requests that could make Chromebrew better if implemented, not a bug

Comments

@superloach
Copy link
Contributor

I've been attempting to compile QB64, with little success.

I modified the install script to use bash setup_build.sh instead of ./setup_build.sh, and that fixed some initial errors. But now I keep getting this error, which is obviously related to #2567:

/usr/local/libexec/gcc/x86_64-cros-linux-gnu/4.9.4/cc1: error while loading shared libraries: libisl.so.15: cannot open shared object file: No such file or directory

Hopefully we can get that fixed, because I'd love to mess around with some of my old programs 😝

(p.s. - there's an SDL version of QB64 as well, in case there are graphical issues in future)

@superloach
Copy link
Contributor Author

After moving the symlink to libisl.so.19, it complains about not finding GL/glu.h. I'll mention this on the QB64 forum, but should I open an issue on their GitHub?

@FellippeHeitor
Copy link

Hi and thanks for you interest in QB64. I just replied to your inquiry at our forum. The setup script attempts to detect the distro you're using to download the appropriate dependencies. You may be interested in trying to download them manually first.
https://www.qb64.org/forum/index.php?topic=438.msg3140#msg3140

@superloach
Copy link
Contributor Author

Hmm, didn't think to check those. Thanks!

@FellippeHeitor
Copy link

Hope it works, please let us know.

@superloach
Copy link
Contributor Author

It appears that libglu1-mesa-dev isn't in the repositories (or anything mentioning "glu", for that matter).

@superloach
Copy link
Contributor Author

I have all the other requirements, though.
Doesn't appear that any other packages have provided it, either.

$ sudo find /usr/local/ -name *glu*
/usr/local/share/gtk-doc/html/gobject/glue.png
/usr/local/share/doc/groff-1.22.3/examples/chem/122/ch4z1_eqn_glutamic.chem
/usr/local/include/gssapi/mechglue.h
/usr/local/lib64/wine/fakedlls/glu32.dll
/usr/local/lib64/wine/libglu32.def
/usr/local/lib64/wine/glu32.dll.so

The only mention in this repository is a --without-glu flag in a PR for Wine.

@FellippeHeitor
Copy link

FreeGLUT is in the core of QB64. Looks like a deal breaker. We do have some legacy versions available at qb64.org that use SDL instead, as you mentioned above. Maybe one of those will cut it for you. Last version to use it was 0.954

@superloach
Copy link
Contributor Author

I'll try the SDL version for now, but it's still possible we could get libglu1-mesa-dev in the repos and work from there.

@superloach
Copy link
Contributor Author

The SDL (0.954) build fails with

In file included from libqbx.cpp:1:0:
common.cpp:33:23: fatal error: SDL_mixer.h: No such file or directory
 #include <SDL_mixer.h>
                       ^
compilation terminated.
g++: error: libqbx_lnx.o: No such file or directory

@FellippeHeitor
Copy link

😩 rats...

Well, good luck with the next option #2569 (comment)

@uberhacker
Copy link
Collaborator

Hey guys,
I was working on another project that required libglu / freeglut and just added 2 new PRs for those packages (#2570 and #2571), if it helps any.

@superloach
Copy link
Contributor Author

Oh, that's awesome!!

@superloach
Copy link
Contributor Author

After installing libglu and freeglut, the GL build still fails.

Building 'QB64'
/usr/local/bin/ld: /usr/local/lib/gcc/x86_64-cros-linux-gnu/4.9.4/../../../../lib64/libGLU.so: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'
collect2: error: ld returned 1 exit status

@uberhacker
Copy link
Collaborator

This might be a dumb question but what is your crew version? It looks like you are using gcc 4.9.4. The current version is gcc 7.3.0.

@superloach
Copy link
Contributor Author

$ crew -V
1.0.3

Also, I tried to crew update, and it gave these errors:

$ crew update
error: object file .git/objects/07/bc22bff97ff3bffc2bf71f7d994808abe2c717 is empty
error: object file .git/objects/07/bc22bff97ff3bffc2bf71f7d994808abe2c717 is empty
fatal: loose object 07bc22bff97ff3bffc2bf71f7d994808abe2c717 (stored in .git/objects/07/bc22bff97ff3bffc2bf71f7d994808abe2c717) is corrupt
fatal: The remote end hung up unexpectedly
error: object file .git/objects/07/bc22bff97ff3bffc2bf71f7d994808abe2c717 is empty
error: object file .git/objects/07/bc22bff97ff3bffc2bf71f7d994808abe2c717 is empty
fatal: loose object 07bc22bff97ff3bffc2bf71f7d994808abe2c717 (stored in .git/objects/07/bc22bff97ff3bffc2bf71f7d994808abe2c717) is corrupt
Package lists, crew, and library updated.
Checking for package updates...

I'll just purge /usr/local/* and reinstall crew, hopefully that'll fix things.

@superloach
Copy link
Contributor Author

After fixing my [apparently broken] Chromebrew installation, QB64 builds properly!
However, I'm having a bit of difficulty running the resulting binary. If I place it in /usr/local/bin, it'll run, but exits immediately... not sure what the problem is.

$ qb64
freeglut (qb64): 
$ sommelier -X qb64
Warning: Unknown scale factor: 1111
Warning: Unknown scale factor: 952
Warning: Unknown scale factor: 909
Warning: Unknown scale factor: 870
Warning: Unknown scale factor: 833
Warning: Unknown scale factor: 769
Warning: Unknown scale factor: 667
Child exited with status: 1

@uberhacker
Copy link
Collaborator

Maybe try sommelier -X qb64 --scale=1? You can also edit /usr/local/sbin/sommelierd and add the options you need for every login.

@superloach
Copy link
Contributor Author

Sommelier doesn't seem to care about the --scale option.

$ sommelier -X qb64 --scale=1
Warning: Unknown scale factor: 1111
Warning: Unknown scale factor: 952
Warning: Unknown scale factor: 909
Warning: Unknown scale factor: 870
Warning: Unknown scale factor: 833
Warning: Unknown scale factor: 769
Warning: Unknown scale factor: 667
Child exited with status: 1

@superloach
Copy link
Contributor Author

superloach commented Aug 20, 2018

Forgot to mention, I get those errors with all GUI apps, and they work fine anyways. I think the issue may be that QB64 needs some of these files, but I haven't used a working build in a while so idk.

$ pwd;ls
/home/chronos/user/Downloads/qb64
cyberbit.ttf  LICENSE   qb64                             run_qb64.sh   source
internal      programs  'README for Linux and OS X.txt'  setup_lnx.sh  virtual_keyboard_layout_default.txt

Also run_qb64.sh doesn't work, because it uses ./. Any idea why Chrome OS refuses to work when running things with that?

@uberhacker
Copy link
Collaborator

You might try crew install qb64 -s > qb64.log 2>&1 and study the output of qb64.log to see if any messages stand out.

@superloach
Copy link
Contributor Author

Uhh... Package qb64 not found. :(?

@uberhacker
Copy link
Collaborator

Oh, I thought you made a package already? How did you "install"?

@FellippeHeitor
Copy link

FellippeHeitor commented Aug 20, 2018

QB64's binary must be able to find and write to the internal folder on its level to work properly.

@superloach
Copy link
Contributor Author

No, I just built it and copied the resulting binary to /usr/local/bin.
Ah yes, that's what I was thinking.

@superloach
Copy link
Contributor Author

Sorry I'm not familiar with crew's packaging system, or really that much of Ruby for that matter. I'll definitely see if I can get a package together though, that might help things?

@uberhacker
Copy link
Collaborator

Packages can be as simple as just a few commands. You can examine some of the other packages to get an idea but if you copy something that looks close to how you are trying install, it can act as a "template". The wiki may help also. See https://github.com/skycocker/chromebrew/wiki/Creating-a-package.

@superloach
Copy link
Contributor Author

Alright, I've got a package made. Before I submit a PR, does this look right?

require 'package'

class Qb64 < Package
  description 'QB64 is a 64-bit BASIC compiler and IDE.'
  homepage 'https://www.qb64.org/'
  version '1.2'
  source_url 'https://www.qb64.org/autobuilds/master/qb64_2018-02-28-12-16-57_c3ad985-master_lnx.tar.gz'
  source_sha256 '47c739847e3f0d517150eae28e459e4c2cc1f904c1ab11eb7d089810d56e044a'

  depends_on 'gcc7'
  depends_on 'libglu'
  depends_on 'freeglut'
  depends_on 'mesa'
  depends_on 'sommelier'
  depends_on 'alsa_lib'
  depends_on 'alsa_plugins'

  def self.build
    system "find . -name '*.sh' -exec sed -i \"s/\\r//g\" {} \\;"
    system "find . -name '*.sh' -exec sed -i \"s/\.\\/setup/bash setup/g\" {} \\;"
    system "find . -name '*.sh' -exec sed -i \"s/\.\\/qb64 \\&/exec qb64 \\&/g\" {} \\;"
    system "find . -name '*.sh' -exec sed -i \"s/\~\\/\.local\\/share\\/applicationexec qb64\\.desktop/\\/dev\\/null/g\" {} \\;"
    system "bash setup_lnx.sh"
  end

  def self.install
    system "chown", "chronos:chronos", "qb64"
    system "chmod", "+x", "qb64"
    system "mkdir", "-p", "#{CREW_DEST_PREFIX}/share/qb64"
    system "mkdir", "-p", "#{CREW_DEST_PREFIX}/bin"
    system "cp", "-rpa", ".", "#{CREW_DEST_PREFIX}/share/qb64/"
    system "echo '\#!/bin/bash' >> #{CREW_DEST_PREFIX}/bin/qb64"
    system "echo \"cd #{CREW_PREFIX}/share/qb64/\" >> #{CREW_DEST_PREFIX}/bin/qb64"
    system "echo \"sommelier -X #{CREW_PREFIX}/share/qb64/qb64\" >> #{CREW_DEST_PREFIX}/bin/qb64"
    system "chmod +x #{CREW_DEST_PREFIX}/bin/qb64"
  end
end

@uberhacker
Copy link
Collaborator

uberhacker commented Aug 20, 2018

Hey @superloach: You are definitely on the right track! Some things I noticed:

- gcc7 and mesa are not needed as dependencies since mesa comes along for the ride in sommelier and gcc7 is already in "core"
- sommelier should be the last dependency listed to make sure the manual configuration steps are not missed
- You won't need the chown line since those permissions will already be inherited
- What happens if you just execute `#{CREW_PREFIX}/share/qb64/qb64` without the sommelier prefix and you have the sommelierd daemon running?  Does it still work?
- Might want to limit this to `x86_64` architecture and provide a message that other architectures are not supported to avoid confusion

@superloach
Copy link
Contributor Author

  • Thanks for pointing that out about gcc7 and mesa, I removed them.
  • I put sommelier at the end, good call.
  • Alright, I removed the chown line.
  • It works without sommelier -X, but since some (like me) may choose to not run the daemon, and I already had to make a bash script to fix the internals dir, I thought I'd throw that in there for good measure.
  • I'm unable to test this, but it should work on i686 as well as x86_64. Should I go ahead and limit it to x86_64 for now?
require 'package'

class Qb64 < Package
  description 'QB64 is a modern extended BASIC+OpenGL language that retains QB4.5/QBasic compatibility and compiles native binaries for Windows, Linux and macOS.'
  homepage 'https://www.qb64.org/'
  version '1.2'
  source_url 'https://www.qb64.org/autobuilds/master/qb64_2018-02-28-12-16-57_c3ad985-master_lnx.tar.gz'
  source_sha256 '47c739847e3f0d517150eae28e459e4c2cc1f904c1ab11eb7d089810d56e044a'

  depends_on 'libglu'
  depends_on 'freeglut'
  depends_on 'alsa_lib'
  depends_on 'alsa_plugins'
  depends_on 'sommelier'

  def self.build
    system "find . -name '*.sh' -exec sed -i \"s/\\r//g\" {} \\;"
    system "find . -name '*.sh' -exec sed -i \"s/\.\\/setup/bash setup/g\" {} \\;"
    system "find . -name '*.sh' -exec sed -i \"s/\.\\/qb64 \\&/exec qb64 \\&/g\" {} \\;"
    system "find . -name '*.sh' -exec sed -i \"s/\~\\/\.local\\/share\\/applicationexec qb64\\.desktop/\\/dev\\/null/g\" {} \\;"
    system "bash setup_lnx.sh"
  end

  def self.install
    system "chmod", "+x", "qb64"
    system "mkdir", "-p", "#{CREW_DEST_PREFIX}/share/qb64"
    system "mkdir", "-p", "#{CREW_DEST_PREFIX}/bin"
    system "cp", "-rpa", ".", "#{CREW_DEST_PREFIX}/share/qb64/"
    system "echo '\#!/bin/bash' >> #{CREW_DEST_PREFIX}/bin/qb64"
    system "echo \"cd #{CREW_PREFIX}/share/qb64/\" >> #{CREW_DEST_PREFIX}/bin/qb64"
    system "echo \"sommelier -X #{CREW_PREFIX}/share/qb64/qb64\" >> #{CREW_DEST_PREFIX}/bin/qb64"
    system "chmod +x #{CREW_DEST_PREFIX}/bin/qb64"
  end
end

I also updated the description per their homepage.

@superloach
Copy link
Contributor Author

Oh, well that looks pretty simple! Hey @uberhacker, do you want me to go ahead and modify the package, or could you do it?

@uberhacker
Copy link
Collaborator

I will test and report back if successful. Then you can make the change in the package.

@uberhacker
Copy link
Collaborator

uberhacker commented Aug 21, 2018

Success! Here is your patch:

diff --git a/packages/qb64.rb b/packages/qb64.rb
index 7cfdc6d6..cdf93caa 100644
--- a/packages/qb64.rb
+++ b/packages/qb64.rb
@@ -18,6 +18,7 @@ class Qb64 < Package
     system "find . -name '*.sh' -exec sed -i \"s/\.\\/setup/bash setup/g\" {} \\;"
     system "find . -name '*.sh' -exec sed -i \"s/\.\\/qb64 \\&/exec qb64 \\&/g\" {} \\;"
     system "find . -name '*.sh' -exec sed -i \"s/\~\\/\.local\\/share\\/applicationexec qb64\\.desktop/\\/dev\\/null/g\" {} \\;"
+    system "sed -i '1i#define QB64_NOT_X86' internal/c/common.h" if ARCH == 'armv7l' || ARCH == 'aarch64'
     system "bash setup_lnx.sh"
   end

@superloach
Copy link
Contributor Author

Great, thanks a lot!

@uberhacker
Copy link
Collaborator

Actually, I thought of a more elegant way to do all this patching. New patch coming soon...

@superloach
Copy link
Contributor Author

Haha, alright then.

@uberhacker
Copy link
Collaborator

Try this instead:

diff --git a/packages/qb64.rb b/packages/qb64.rb
index 7cfdc6d6..d60628bf 100644
--- a/packages/qb64.rb
+++ b/packages/qb64.rb
@@ -13,11 +13,18 @@ class Qb64 < Package
   depends_on 'alsa_plugins'
   depends_on 'sommelier'

-  def self.build
+  def self.patch
     system "find . -name '*.sh' -exec sed -i \"s/\\r//g\" {} \\;"
     system "find . -name '*.sh' -exec sed -i \"s/\.\\/setup/bash setup/g\" {} \\;"
     system "find . -name '*.sh' -exec sed -i \"s/\.\\/qb64 \\&/exec qb64 \\&/g\" {} \\;"
     system "find . -name '*.sh' -exec sed -i \"s/\~\\/\.local\\/share\\/applicationexec qb64\\.desktop/\\/dev\\/null/g\" {} \\;"
+    case ARCH
+    when 'armv7l', 'aarch64'
+      system "sed -i '1i#define QB64_NOT_X86' internal/c/common.h"
+    end
+  end
+
+  def self.build
     system "bash setup_lnx.sh"
   end

@superloach
Copy link
Contributor Author

Yeah, that's way more elegant! Sorry I didn't know self.patch was a thing, it wasn't used in the example I built off. 😛

@uberhacker
Copy link
Collaborator

Now if we can solve the mysterious black screen of death, then i686 will be working also.

@superloach
Copy link
Contributor Author

Hmm, this is interesting: Re: How do you make the 64 bit Version of QB64?
This makes it sound like Unix only supports 64-bit now, but I'm not sure what version that was.

@FellippeHeitor
Copy link

FellippeHeitor commented Aug 21, 2018

QB64 is 32bit by default on Windows; 64bit by default on macOS; 32/64bit on Linux depending on the Distro it's being compiled on, since it'll use the gcc version that's installed.

@superloach
Copy link
Contributor Author

Thanks for clearing that up, I couldn't find a straight answer anywhere!

@FellippeHeitor
Copy link

I for instance have it installed on two separate VMs for occasional testing, both running Debian, one 32 one 64 bit.

@uberhacker
Copy link
Collaborator

@FellippeHeitor: The good news is we now have it working in ChromeOS on both x86_64 and arm architecture which probably covers over 95% of all Chromebook owners currently.

@FellippeHeitor
Copy link

That's amazing. We can offer instructions at qb64.org if you guys can offer me a set of them. When do these changes come into effect?

@uberhacker
Copy link
Collaborator

I can create pre-built binaries but you need this project installed on your Chromebook and simply install the package via crew install qb64.

@superloach
Copy link
Contributor Author

Yep, something like this will probably do:

  • Enable developer mode.
  • Install Chromebrew:
    • Open Crosh (Ctrl+Alt+T).
    • Type shell and hit enter.
    • Type curl -Ls git.io/vddgY | bash and hit enter (right click in Crosh to paste).
  • Install QB64:
    • Type crew install qb64 and hit enter.
    • To run QB64, open Crosh again, enter shell, and then enter qb64.

@FellippeHeitor
Copy link

Yeah, I meant instructions for the Chromebook setup. When does crew install qb64 come into effect with the above changes?

@FellippeHeitor
Copy link

Oh, @uberhacker is a main contributor here! I apologize for my ignorance.

@superloach
Copy link
Contributor Author

Haha, I just saw you notice the PR got merged, I was about to tell you 😝

@uberhacker
Copy link
Collaborator

No worries at all. I'm glad you are interested in this project. Your feedback is greatly appreciated.

@superloach
Copy link
Contributor Author

So how do you plan on presenting this on qb64.org?
I just scrapped together this example, I feel like a link to that comment would be sufficient

<td align="center" width="25%">
  <a href="https://github.com/skycocker/chromebrew/issues/2569#issuecomment-414528254" target="">
    <img width="65px" height="65px" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Google_Chrome_icon_%28September_2014%29.svg/1200px-Google_Chrome_icon_%28September_2014%29.svg.png">
  </a>
  <br>
  <a href="https://github.com/skycocker/chromebrew/issues/2569#issuecomment-414528254" style="text-decoration:none" target="">
    Chrome OS
  </a>
</td>

Obviously, if you chose to present it this way you'd use a pre-sized locally hosted icon, but overall I feel like this looks good.

image

(p.s. - sorry if I'm entering nitpick territory 😅)

@FellippeHeitor
Copy link

Hahaha, I was just creating a mockup now... this icon had come up in my searches:

Either way, because this is not a direct download, I thought of adding it as a smaller icon and an extra paragraph in that session with the summarized instructions. Sound good?

@superloach
Copy link
Contributor Author

Sounds good! Good idea to use Chromium instead of Chrome, too.

@uberhacker
Copy link
Collaborator

@superloach: This is awesome what you are doing to promote Chromebrew.

@FellippeHeitor
Copy link

@superloach maybe your idea does look better to keep the general alignment there. Wanna give it a go?
https://github.com/FellippeHeitor/qb64.org/issues/1

@superloach
Copy link
Contributor Author

Haha, no problem @uberhacker! Always glad to help share good projects, especially if I find them useful.

@uberhacker
Copy link
Collaborator

Fixed in #2577.
Fixed in #2578.

@uberhacker uberhacker added the enhancement 🌱 Feature requests that could make Chromebrew better if implemented, not a bug label Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🌱 Feature requests that could make Chromebrew better if implemented, not a bug
Projects
None yet
Development

No branches or pull requests

3 participants