New to linux how to run FB

Linux specific questions.
Post Reply
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

New to linux how to run FB

Post by sancho3 »

Hello:
Computer problems forced me into Linux Ubuntu. I have never used Linux before.
I installed freebasic and got to the point where I ran the install script and it returned successfully installed.
I can't run fbc at all. From the terminal I have tried fbc, /fbc, ./fbc. It says no such file or directory.
I am in the /usr/local/bin directory and when I type dir it shows fbc as the only file.
I tried chmod +x fbc, chmod +x fbc.run.
I get nothing.
How do I run fbc?
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: New to linux how to run FB

Post by counting_pine »

Hi sancho3,
Just a couple of quick pointers about how the Linux terminal generally works:

- if you type in a command without a path before it, it will scan all the folders in the $PATH variable, and run the first executable file it finds.
-- e.g. if you type in 'fbc', if $PATH contains /usr/local/bin, it should find fbc there and run it. (Unlike DOS/Windows, it will not run a copy from the current directory, unless the current directory is in the $PATH)

- if you type in a command with a path, it will try to run the file at that path and nowhere else.
-- e.g. if you type in './fbc', it will look for fbc in the current folder ('.', i.e. the folder you cd'd to.)
-- e.g. if you type in '/fbc', it will look for fbc in the root of the file system ('/'). (You wouldn't normally find executable files there.)

Most of the time I run commands without a path. If you type in 'command -v fbc', it will output the location of the fbc file it tries to run, if any.
The copy of fbc is probably already executable. You can confirm this with 'ls -l /usr/local/bin'. You will probably see an output like this for fbc:

Code: Select all

-rwxr-xr-x 1 root root 1883968 May 21  2016 /usr/local/bin/fbc
Here, the permissions are '-rwxr-xr-x', indicating that any user can read/execute it, but only the owner ('root') can change the file.
(Either way, 'chmod +x' won't output anything if it succeeds - like many Linux tools, it's designed to work silently, so it can be used in scripts.)

All that said, I'm not sure why it's not working. It might be helpful to see the output of these commands:
- 'uname -a' (prints some system information)
- 'cat /etc/os-release' (reads a text file giving information about the Linux distro)
- 'command -v fbc' (tells us what it tries to run when you type in 'fbc')
- 'ls -l /usr/local/bin/fbc' (gives us a simple 'directory listing' for the file)
- 'file /usr/local/bin/fbc' (tells us what kind of file it looks like)

Off the top of my head, I'm not sure what would make Linux give the specific error: "no such file or directory".
My guess is that perhaps you're trying to run a 64-bit version of fbc on a 32-bit version of Linux.
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: New to linux how to run FB

Post by dkl »

Another possible cause of that error is trying to run 32bit fbc on a 64bit Ubuntu Linux system, but the libc6-i386 package is missing, so it doesn't recognize 32bit programs.
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: New to linux how to run FB

Post by sancho3 »

Yes it was the fact that I didn't install the other packages that was causing the problem.

I followed DKL instructions here and that fixed it up.
I am able to compile.
The stickied thread titled FB 0.20 +Ubuntu 8.10 64 - the easy way should probably be updated.

One more question. My simple hello world program runs fine from the desktop but it does nothing from the command line.

Code: Select all

screenres 800, 600, 32
print "hello world"
sleep
I know that I am at the beginning of what seems a very steep learning curve.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: New to linux how to run FB

Post by badidea »

To compile: fbc test.bas
To run: ./test

If there is no graphics environment at all, I can imagine 'screenres 800, 600, 32' will fail. But that is unlikely if you installed Ubuntu.

Also 'screenres 800, 600, 32' is not necessary for your example, but does requires an additional library for freebasic (the libxrender-dev:i386 I think, also listed in the other thread).

One useful linux command: ldd to show which libraries used by an executable.
E.g.:
ldd /usr/local/bin/fbc
Result on my system:
linux-gate.so.1 => (0xf7781000)
libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xf7731000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf76dc000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf76d7000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf76ba000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7504000)
/lib/ld-linux.so.2 (0xf7782000)
Or:
ldd ./test
Which might look like:
linux-gate.so.1 => (0xf7798000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xf7620000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xf760b000)
libXpm.so.4 => /usr/lib/i386-linux-gnu/libXpm.so.4 (0xf75f6000)
libXrandr.so.2 => /usr/lib/i386-linux-gnu/libXrandr.so.2 (0xf75e9000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xf75dd000)
libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xf75ba000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7565000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf755f000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7542000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf738c000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xf7366000)
/lib/ld-linux.so.2 (0xf7799000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xf7362000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xf735a000)
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: New to linux how to run FB

Post by St_W »

sancho3 wrote:Yes it was the fact that I didn't install the other packages that was causing the problem.
What I'm wondering is that despite all of that being described in the Wiki you were unable to install it successfully. So the question is: is information wrong/missing in the wiki, were you unable to understand the instructions in the wiki or unable to find the wiki page or wasn't there a thought about the wiki so that you didn't even have a look?
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: New to linux how to run FB

Post by sancho3 »

@St.W.
No information was missing.
I skipped a step that was well described; the installing of the the three other files(dependancies?).
I skipped it thinking that fbc would still run and just produce errors. This does not happen.
Its my fault entirely, and I have to remember now that I'm in Linux that I know nothing and should follow instructions to the letter until I do know something.
badidea wrote:To run: ./test
Yes that works. I was trying 'test'

Thanks everyone.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: New to linux how to run FB

Post by badidea »

Getting used to linux will take a while. I started using linux at home (Ubuntu 10.04) 7 years ago. I have had many frustrations in those 7 years with it, and some programs are just not available or are crappy alternatives, but now I cannot image ever switching back to Windows. Virtually no spyware or need for bloaty virus scanners, easy to install, large software/library repositories and many good tools for developing software. An just cool because it is different. And the awesome terminal of course.
Marc Bonus
Posts: 3
Joined: Oct 08, 2017 14:39
Location: Berlin/Germany

Re: New to linux how to run FB

Post by Marc Bonus »

Knowing Linux for many years, i recently switched to Kubuntu. It was not very difficult do to everything i used to do under Win 10, including programming in FreeBasic with wxFBE and Geany. Some things are better in Linux, as long you have hardware it has the right drivers for.

*Please excuse broken english, i am from Berlin/Germany
Post Reply