• Print

Author Topic: Anyone have QB64 running on Raspberry Pi  (Read 1820 times)

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #15 on: February 15, 2013, 03:05:00 PM »
Looks like you where right on the swap.  See below.  But Seg Fault :(

uint32_t, uint32_t, int32_t)â [-Wconversion-null]
../temp/main.txt:132801:29: warning: passing NULL to non-pointer argument 3 of âvoid qbg_sub_color(uint32_t, uint32_t, uint32_t, int32_t)â [-Wconversion-null]
../temp/main.txt:132826:88: warning: passing NULL to non-pointer argument 3 of âvoid qbg_sub_locate(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t)â [-Wconversion-null]
../temp/main.txt:132826:88: warning: passing NULL to non-pointer argument 4 of âvoid qbg_sub_locate(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t)â [-Wconversion-null]
../temp/main.txt:132826:88: warning: passing NULL to non-pointer argument 5 of âvoid qbg_sub_locate(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t)â [-Wconversion-null]
../temp/main.txt:132850:29: warning: passing NULL to non-pointer argument 3 of âvoid qbg_sub_color(uint32_t, uint32_t, uint32_t, int32_t)â [-Wconversion-null]
../temp/main.txt:132862:29: warning: passing NULL to non-pointer argument 3 of âvoid qbg_sub_color(uint32_t, uint32_t, uint32_t, int32_t)â [-Wconversion-null]

Setup complete!

Launching 'qb64'...
Segmentation fault

Note: 'qb64' is located in same folder as this setup program.
Press any key to exit...

DSMan195276

  • Hero Member
  • *****
  • Posts: 1978
  • Yes
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #16 on: February 15, 2013, 04:50:20 PM »
Where you compiling SDL or GL?

Matt
"Cast your cares on the Lord and he will sustain you; he will never let the righteous be shaken" -- Psalm 55:22
QB64 Linux Installer

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #17 on: February 15, 2013, 05:06:35 PM »
Installed all the SDL

DSMan195276

  • Hero Member
  • *****
  • Posts: 1978
  • Yes
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #18 on: February 15, 2013, 05:40:49 PM »
Did you have a X-server running somewhere that it could connect to? I'm not sure if the lack of one of them would cause a seg fault, but it's worth asking.

Matt
"Cast your cares on the Lord and he will sustain you; he will never let the righteous be shaken" -- Psalm 55:22
QB64 Linux Installer

SkyCharger001

  • Hero Member
  • *****
  • Posts: 1594
Re: Anyone have QB64 running on Raspberry Pi
« Reply #19 on: February 16, 2013, 03:09:56 AM »
Question: Is qb64 even capable of running on a non-x86 system? Raspberry is ARM-based, which is a very different beast.

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #20 on: February 16, 2013, 04:24:32 AM »
Quote from: DSMan195276 on February 15, 2013, 05:40:49 PM
Did you have a X-server running somewhere that it could connect to? I'm not sure if the lack of one of them would cause a seg fault, but it's worth asking.

Matt

Not sure, I know I can do start x if I want at the console.  I was ssh'd in and x would not work there.  It make a 5MEM binary.  I will try to run it from the console and see.  I did have to load gparted and use X to get the swap back to ntfs after the QB64 compile.

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #21 on: February 16, 2013, 04:31:09 AM »
Quote from: SkyCharger001 on February 16, 2013, 03:09:56 AM
Question: Is qb64 even capable of running on a non-x86 system? Raspberry is ARM-based, which is a very different beast.

We mentioned this in the start of this thread.  Appears it's all C if you comment out the ASM code and add in the commented out C code below it. 

If there was a problem, from what I see, it could be gcc/compiler default related, but I think it will compile.  Also could be a resource issue as DSMan showed.  I know someone mentioned they got AndoidGCC (or something like that from the play store) and compiled it on android for an arm target and it ran on the android.

I have an android phone, have not tried it.

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #22 on: February 16, 2013, 04:49:33 AM »
Good morning Matt,

See attached.  It is 8MEG and print "Hello" is 800K, but it works.  Also the Binary program ended with "Press and key to continue".

Man did that bring back the past though.  I can zip and email to you if you like (PM email). 

The problem was it requires X run run QB64 (I missed that somewhere) and I was ssh'd in.  Thanks again for the 8MEG of help.

I have other QBasic's compilers running on the PI, looks like this is in the top 4. 

The code size was a surprise,  hope that was a un-optimized runtime.  I will play with it for a bit, see if I can get inline C somehow and go from there.  Sockets are key today.

So not I have 4 to pick from.
« Last Edit: February 16, 2013, 11:20:23 AM by mramos »

DSMan195276

  • Hero Member
  • *****
  • Posts: 1978
  • Yes
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #23 on: February 16, 2013, 11:42:01 AM »
Android is unlikely for the current state of QB64, simply because it's a very different from just ARM Linux (Where you still have X11 and etc. to work with).

And also a tip, if you enable X11_Forwarding in the /etc/ssh/ssh_config (Might be sshd_config) then you can ssh using "ssh -x username@host" and that will forward any programs that want to use X11 to display on your active X-server (So you have to have an X-server running on your computer. If you're on Windows using PUTTY you could install Cygwin which has a X-server for Windows in it). It's slow to update for QB64 (Because the screen is completely redrawn every change. Not may ways to get around that) but it will at least let it run.

There's nothing attached so I'm guessing that's a mistake ;) No problem though. And 8MB for QB64 it does seem a bit big, the one on my Linux install is just 3.8MB. 800K seems about right for a normally compiled QB64 program (With just a print statement). Work is going to be done to reduce the size of compiled Executables at some point, it's just not a huge priority right now because QB64-GL is being worked on.

Matt
"Cast your cares on the Lord and he will sustain you; he will never let the righteous be shaken" -- Psalm 55:22
QB64 Linux Installer

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #24 on: February 16, 2013, 02:32:46 PM »
Matt,

It was BC9 (and MBX Mac/FreeBSD version), sorry, not QB64. 

I will try the X11 server via putty on my Windows machine.  But a lot of overhead.  X11basic is pretty tight, qb2c better, but too much to clean up.

I must have added the pictures/attachments as you posted.  I did originally forget.
« Last Edit: February 17, 2013, 06:20:00 AM by mramos »

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #25 on: February 17, 2013, 06:30:35 AM »
Quote from: DSMan195276 on February 16, 2013, 11:42:01 AM
And also a tip, if you enable X11_Forwarding in the /etc/ssh/ssh_config (Might be sshd_config) then you can ssh using "ssh -x username@host" and that will forward any programs that want to use X11 to display on your active X-server (So you have to have an X-server running on your computer. If you're on Windows using PUTTY you could install Cygwin which has a X-server for Windows in it). It's slow to update for QB64 (Because the screen is completely redrawn every change. Not may ways to get around that) but it will at least let it run.

I tried ssh into the same pi with QB64 working on it, ssh -x pi@ip_addr  (basically localhost) logged in and did a ./qb64 and got the segmentation fault. 

Do I need to run something prior (X server) as I am in a none graphic shell on the pi?

fatman2021

  • Hero Member
  • *****
  • Posts: 978
  • Lord Jesus Christ, Son of God, have mercy on us.
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #26 on: February 17, 2013, 07:15:41 AM »
The following code produces a segmentation fault on the Raspberry PI:

Code: [Select]
int main()
{
int N = 600;
int M = 200;

float sumthresh = 0.035;
float zerocorssthres = 0.060;

Wav sampleWave;

if(!sampleWave.readAudio("repositry/example.wav", DOUBLE))
{
    cout << "Cannot open the file BOOM";

}

// Return the data
vector<double> rawData = sampleWave.returnRaw();
// THIS segments (typedef vector<double> iniMatrix;)
vector<iniMatrix> blockked = sampleWave.something(rawData, N, M);


cout << rawData.size();

return EXIT_SUCCESS;   

}


(function: something)

Code: [Select]
int n = theData.size();
int maxblockstart = n - N;
int lastblockstart = maxblockstart - (maxblockstart % M);

int numblocks = (lastblockstart)/M + 1;
vector< vector<double> > subBlock;
vector<double> temp;
this->width = N;
this->height = numblocks;
subBlock.resize(600*187);
for(int i=0; (i < 600); i++)
{
    subBlock.push_back(vector<double>());
    for(int j=0; (j < 187); j++)
    {   
        subBlock[i].push_back(theData[i*N+j]);
    }
}   
return subBlock;

QB64 is probably overrunning an array somewhere. If so then the QB64's source code should be split into smaller chunks using something more like the following:
Code: [Select]
std::vector<std::vector<double>>
SimpleWav::something(const std::vector<double>& data, int N) {

    //How many blocks of size N can we get?
    int num_blocks = data.size() / N;

    //Create the vector with enough empty slots for num_blocks blocks
    std::vector<std::vector<double>> blocked(num_blocks);

    //Loop over all the blocks
    for(int i = 0; i < num_blocks; i++) {
        //Resize the inner vector to fit this block           
        blocked[i].resize(N);

        //Pull each sample for this block
        for(int j = 0; j < N; j++) {
            blocked[i][j] = data[i*N + j];
        }
    }

    return blocked;
}

Are you using the SDL version of QB64  or the FreeGLUT  version of QB64?
Woe to those who call evil good, and good evil;
Who put darkness for light, and light for darkness;
Who put bitter for sweet, and sweet for bitter!

Isaiah 5:20

mramos

  • Newbie
  • *
  • Posts: 25
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #27 on: February 17, 2013, 07:54:50 AM »
Quote from: mramos on February 15, 2013, 05:06:35 PM
Installed all the SDL

SDL.

mcalkins

  • Hero Member
  • *****
  • Posts: 1269
    • qbasicmichael.com
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #28 on: February 17, 2013, 08:09:03 AM »
Fatman: sorry if I missed something, but I'm not understanding this. Are you trying to debug mramos's problem, or did you find a different problem?

Quote
QB64 is probably overrunning an array somewhere.

Is the code that you posted from QB64? If not, I fail to see the connection.

Regards,
Michael
The QBASIC Forum Community: http://www.network54.com/index/10167 Includes off-topic subforums.
QB64 Off-topic subforum: http://qb64offtopic.freeforums.org/

DSMan195276

  • Hero Member
  • *****
  • Posts: 1978
  • Yes
    • Email
Re: Anyone have QB64 running on Raspberry Pi
« Reply #29 on: February 17, 2013, 08:10:59 AM »
Well, from your picture I get the understanding that it works when you have X running on the RPI, but then seg faults when you don't have that? 'ssh -x' should work. You have to be running an X server or X server equivalent (So Cygwin on Windows) and if you are on Windows then you'll need to tell PUTTY about the X server (I would just google it, that'll provide better instructions then me).

Once you do that, when you're in the ssh session, you can run the command 'echo $DISPLAY' and it should print out a string containing the X-server number as well as your IP (I believe). If it doesn't have an IP then it will at least have something like ':0' or ':1' which indicates it worked. You can always run a program as a test, such as lxterminal, and it should pop-up on your screen if everything worked ok.

Matt
"Cast your cares on the Lord and he will sustain you; he will never let the righteous be shaken" -- Psalm 55:22
QB64 Linux Installer

  • Print