Library Path Problem

Linux specific questions.
storm5510
Posts: 42
Joined: Nov 28, 2019 15:47

Library Path Problem

Postby storm5510 » Nov 30, 2019 19:20

Greetings. I am new to Linux so you must forgive me for my ignorance. What I have is Ubuntu 19.10.

I managed to get fbc compiled to the point where it will execute by following the suggestions on the screen, and with a bit of searching on the web. I have a short test program with this at the top:

Code: Select all

#include "string.bi"

I run the compiler like so:

Code: Select all

./fbc test.bas -e

I am presented the following error message:

Code: Select all

test.bas(3) error 23: File not found, "string.bi" in '#include "string.bi"'


There is an option "-p" to specify a path, so I run it like this:

Code: Select all

./fbc test.bas -e -p /home/storm5510/fb/include/freebasic/


The error message repeats. The "string.bi" file exists in the path. I really do not know what to do at this point. Any assistance would be helpful. Thank you!
badidea
Posts: 1999
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Library Path Problem

Postby badidea » Nov 30, 2019 20:08

I have been using linux and freebasic for almost 10 years now, but I have never tried to compile fbc itself.
I just run the install script which puts fbc in /usr/local/bin and include files like string.bi in /usr/local/include/freebasic and some libraries in /usr/local/lib/freebasic and it works.
storm5510
Posts: 42
Joined: Nov 28, 2019 15:47

Re: Library Path Problem

Postby storm5510 » Dec 01, 2019 1:32

badidea wrote:I have been using linux and freebasic for almost 10 years now, but I have never tried to compile fbc itself.
I just run the install script which puts fbc in /usr/local/bin and include files like string.bi in /usr/local/include/freebasic and some libraries in /usr/local/lib/freebasic and it works.


I started over, following your example. I ran the script. I have four folders under the parent. These folder are "bin" "include" "lib" and "man."
I cannot specify the parent because this editor changes the name. How about "f" + "basic" concatenated.

So, I run the compiler, like this, from the "bin" folder:

./fbc test.bas -e and I get ld: cannot find -lncurses

I enter ld -help and I get an extremely long output. Quickly browing, it seems to have something to do with libraries. It did not make a direct library reference because I copied "string.bi" to the same folder as the compiler, perhaps. Next?

========================

Edit: After some searching on Ubuntu's web site, I found the problem. I needed to build a library. Problem solved.
D.J.Peters
Posts: 8023
Joined: May 28, 2005 3:28
Contact:

Re: Library Path Problem

Postby D.J.Peters » Dec 01, 2019 2:39

In case of the C runtime try:

#include "crt/string.bi"

Joshy
srvaldez
Posts: 2331
Joined: Sep 25, 2005 21:54

Re: Library Path Problem

Postby srvaldez » Dec 01, 2019 10:56

@storm5510
your way of installing FreeBasic and trying to make it work is unnecessarily complex, here's how I would do it
install FB via the shell script: sudo sh install.sh -i
then install the necessary libraries
sudo apt-get install libncurses-dev
sudo apt-get install libx11-dev
sudo apt-get install libxext-dev
sudo apt-get install libxpm-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libgpm-dev
that's probably enough libraries, now get geany
sudo apt-get install geany
geany is a multi-language IDE that also works with FB, simply compile and then run your program
badidea
Posts: 1999
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Library Path Problem

Postby badidea » Dec 01, 2019 14:04

See also the 'readme.txt' that comes with the fbc download.
storm5510
Posts: 42
Joined: Nov 28, 2019 15:47

Re: Library Path Problem

Postby storm5510 » Dec 01, 2019 16:09

srvaldez wrote:@storm5510
your way of installing FreeBasic and trying to make it work is unnecessarily complex, here's how I would do it
install FB via the shell script: sudo sh install.sh -i
then install the necessary libraries
sudo apt-get install libncurses-dev
sudo apt-get install libx11-dev
sudo apt-get install libxext-dev
sudo apt-get install libxpm-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libgpm-dev
that's probably enough libraries, now get geany
sudo apt-get install geany
geany is a multi-language IDE that also works with FB, simply compile and then run your program


All I needed was libncurses-dev. I ran it exactly as you have it above.

I have been writing my test programs on my Window 10 system, and then taking them to the Linux machine and compiling them there. I wondered about the program syntax, but there was no problem. They run fine.

As for the install, I removed everything and then ran the script. No path problems after that.
srvaldez
Posts: 2331
Joined: Sep 25, 2005 21:54

Re: Library Path Problem

Postby srvaldez » Dec 01, 2019 16:29

I am glad it's working for you
I mentioned the geany IDE because that's the one I am familiar with, but I think there's another cross-platform IDE called poseidon, you can find it the projects section
storm5510
Posts: 42
Joined: Nov 28, 2019 15:47

Re: Library Path Problem

Postby storm5510 » Dec 17, 2019 18:24

srvaldez wrote:I am glad it's working for you
I mentioned the geany IDE because that's the one I am familiar with, but I think there's another cross-platform IDE called poseidon, you can find it the projects section


I am using one called "fbide" and it works well.

Question: I wrote a small program on my Windows system and when I try to compile in on my Linux system, It says it cannot find the library it needs. The Linux compiler has a somewhat different folder structure than the Windows compiler. I have placed the "bi" file and the library in several places without success. Any suggestions?
TJF
Posts: 3546
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Library Path Problem

Postby TJF » Dec 19, 2019 8:42

storm5510 wrote:Question: I wrote a small program on my Windows system and when I try to compile in on my Linux system, It says it cannot find the library it needs. The Linux compiler has a somewhat different folder structure than the Windows compiler. I have placed the "bi" file and the library in several places without success. Any suggestions?

A simple suggestion: You have to post the error message from the linker. Otherwise nobody can help.
badidea
Posts: 1999
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Library Path Problem

Postby badidea » Dec 19, 2019 19:26

I was writing a long reaction but something went wrong here, so shorter now.
Is a static or a dynamic/shared library? (1st error on compile, 2nd error at run)
Is it your own library or something common that should be in the package manager?
Some additional info: https://www.tecmint.com/understanding-s ... -in-linux/
storm5510
Posts: 42
Joined: Nov 28, 2019 15:47

Re: Library Path Problem

Postby storm5510 » May 12, 2020 13:42

Well, I am back to this again. I had to do a complete Ubuntu reinstall after a simple little mistake. It has been installed in a different place than before: usr/local/bin. Neither the GUI file manager or a console opens in this general area. So, I have to wade through a bunch of folders doing "cd .." until I get to the very top and work my way back down again. I can't seem to change to a parallel folder, like cd /usr/local/bin. It simply says the folder does not exist. This not a real issue though.

When I get to the bin folder where fbc and the library folders are, and type "fbc," I should get a screen full of command line options. Instead, I get:

fbc: error while loading shared libraries: libtinfo.so.5: cannot open shared object file or directory

Last time, I was able to correct this by installing libncurses-dev. Not this time. So, I really do not know what to do at this point.
srvaldez
Posts: 2331
Joined: Sep 25, 2005 21:54

Re: Library Path Problem

Postby srvaldez » May 12, 2020 14:20

try
sudo apt install libtinfo.so.5
how did you install FB?
you shouldn't have wade trough directories until you get to where fbc is, here's how I install FB
extract the FB linux distribution
open terminal inside the extracted folder
sudo sh install.sh -i
you also need to install some libraries like lincurses-dev, libx11-dev, libxpm-dev and perhaps others
Landeel
Posts: 735
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Re: Library Path Problem

Postby Landeel » May 17, 2020 11:32

Here's my list when I installed on Lubuntu 20.04:
gcc, libtinfo5, libffi-dev, libc6-dev, libncurses-dev, libx11-dev, libxext-dev, libxpm-dev, libxrandr-dev, libxrender-dev, libglvnd-dev, zlib1g, libzip-dev

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest