It is currently Mon Nov 18, 2019 3:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [solved] Run compiler from cmd on Linux, can't find OS Libs
PostPosted: Sat Mar 31, 2018 10:30 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 12, 2008 1:25 pm
Posts: 374
Location: The Netherlands
Hi all,

I'm trying to run the PureBasic compiler from a terminal on an Ubuntu system which successfully compiles code from the IDE, however when run from the terminal the compiler outputs:
Quote:
Error: Can't load OS libraries, please re-install PureBasic.


What's happening here? I should be able to run it from a terminal right?

PureBasic is installed in /opt/purebasic on my system and the user executing the command has full permissions on that directory.

PB 5.62 x64

_________________
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!


Last edited by Crusiatus Black on Sun Apr 01, 2018 3:20 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Run compiler from command line on Linux, can't find OS L
PostPosted: Sat Mar 31, 2018 11:33 pm 
Offline
New User
New User

Joined: Sat Mar 31, 2018 9:09 pm
Posts: 3
The compiler needs the PUREBASIC_HOME environment variable set, you you'll have to add it with SetEnvironmentVariable (if running through PB) or env/export in terminal.

Something like this should work:

Code:
env PUREBASIC_HOME=/opt/purebasic/ /opt/purebasic/compilers/pbcompiler ~/Desktop/test.pb -e ~/Desktop/test.out


Alternatively, you can set the variable for the terminal session, instead of on each run:
Code:
export PUREBASIC_HOME=/opt/purebasic/

Then anytime you want to compile:
Code:
$PUREBASIC_HOME/compilers/pbcompiler ~/Desktop/test.pb -e ~/Desktop/test.out


Top
 Profile  
Reply with quote  
 Post subject: Re: Run compiler from command line on Linux, can't find OS L
PostPosted: Sat Mar 31, 2018 11:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 12, 2008 1:25 pm
Posts: 374
Location: The Netherlands
Ah I must've missed that in the readme I believe. Thanks, that did the trick!

_________________
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!


Top
 Profile  
Reply with quote  
 Post subject: Re: Run compiler from command line on Linux, can't find OS L
PostPosted: Sun Apr 01, 2018 12:21 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 371
Location: Germany
Type this in the terminal:
Code:
echo 'export PUREBASIC_HOME=/opt/purebasic' >> ~/.bashrc
echo 'export PATH=$PUREBASIC_HOME/compilers:$PATH' >> ~/.bashrc
This extends the file ".bashrc" with the necessary variable settings.

The file ".bashrc" is executed each time a terminal is opened. The settings are therefore still intact even after the system has been switched off or restarted.

Then you can simply enter "pbcompiler" or "purebasic" in the terminal, without the path.

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download -- Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: Run compiler from command line on Linux, can't find OS L
PostPosted: Sun Apr 01, 2018 9:57 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 690
Provided that this is bash the shell in use. This is usually the case on most Linux, but not always.
Let's remind beginners that there are multiple shells under linux/unix (bash, sh, zsh, ksh etc) and that you can change them at any time.
Each shell uses its own configuration files. (some are common)
The first file that is read from the Login is the profile file
Moreover each user can have his configuration files (they are in his "home dir" (~)) and are hidden (name begin with dot, so to see them: ls -a)
To know the shell in progress, type echo $SHELL
Code:
$ echo $SHELL
/bin/bash
Then read the man page (ie: man bash) to know the configuration files used by the shell ($ man bash)

:wink:

_________________
(English is not my native language, I use an online translator)
Windows 10 Family x64 + Linux (Slackware, Debian on Oracle VirtualBox 6.0) + Raspberry Pi


Top
 Profile  
Reply with quote  
 Post subject: Re: Run compiler from command line on Linux, can't find OS L
PostPosted: Sun Apr 01, 2018 1:01 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 12, 2008 1:25 pm
Posts: 374
Location: The Netherlands
I know my way around Linux, but I don't always use bash indeed (as Marc56us stated). I was trying to make a build server for unattended nightly builds of a project I'm working on, however I simply forgot the environment variable. This build server uses multiple versions of PureBasic, so I set the environment variable each time I compile something to ensure the correct paths are set for every compilation.

Cheers

_________________
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye