calling pbcompilerc from command line in linux

Linux specific forum
Yann64
User
User
Posts: 24
Joined: Wed Nov 10, 2004 1:06 pm
Contact:

calling pbcompilerc from command line in linux

Post by Yann64 »

Hi there

"~/purebasic/compiler" is in my $PATH (I can call pbcompiler and pbcompilerc from any directory), and I do manage to compile projects directly from the PB ide.

But, if I use

Code: Select all

pbcompiler main.pb -o ../bin/myproject -t -z -pf -dc
I get the following return :
PureBasic 6.04 LTS (Linux - x64)
Loading external modules...
Error: Can't load OS libraries, please re-install PureBasic.
And using

Code: Select all

pbcompilerc main.pb -o ../bin/myproject -t -z -pf -dc
I get the following return :
PureBasic 6.04 LTS - C Backend (Linux - x64)
Loading external modules...
Error: Can't load the 'c' subsystem.
I do not understand why it would work from the IDE and not from the command line.
Anybody can point me my (probably obvious) mistake?
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: calling pbcompilerc from command line in linux

Post by mk-soft »

Part of GitHub PureBasic IDE

A new bash is started with the correct path information.
After closing the bash, the path is also removed again and you can use a different path to pb.

Save as export_pb.sh und enable file property "Start as Program"

Update

Code: Select all

#!/bin/bash

# Test mandatory PureBasic path parameter
if [ -z "$1" ]; then
	echo "Invalid parameters: Missing argument for target PureBasic directory"
	exit 1
fi


# Set PUREBASIC_HOME and ensure compiler and IDE are in the PATH
export PUREBASIC_HOME=$1
export PATH="$PUREBASIC_HOME/compilers:$PUREBASIC_HOME:$PATH"

# Test if the PureBasic home is valid and check if this is PB or SB
if [ -f "$PUREBASIC_HOME/compilers/pbcompiler" ]; then
	
	# Start shell if the script is not sourced and PB_BATCH is not set
	if [ -z "$PB_BATCH" ] && [ "$0" = "$BASH_SOURCE" ]; then
		echo "Path set for target PureBasic directory $1"
		bash
	fi

else
	echo "Invalid path for target PureBasic directory"
	exit 1
fi
Terminal: change path!
./export_pb.sh /home/michael/Apps/purebasic-v610
pbcompiler -h
exit
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Yann64
User
User
Posts: 24
Joined: Wed Nov 10, 2004 1:06 pm
Contact:

Re: calling pbcompilerc from command line in linux

Post by Yann64 »

PUREBASIC_HOME must be set in order to call pbcompiler or pbcompilerc from the command line (forgot to do that).

Thanks for the help
Post Reply