Geany FBC Build Command Not Working

Linux specific questions.
Post Reply
throwingmuse
Posts: 1
Joined: Sep 03, 2018 17:03

Geany FBC Build Command Not Working

Post by throwingmuse »

1. I've installed Geany 1.33 under Linux Mint 18.03
2. I've installed FreeBASIC-1.05.0-linux-x86_64 by running install.sh
3. fbc is located in /usr/local/bin
4. I can compile hello.bas from the command line:

Code: Select all

~/projects/Test $ fbc -v -w all hello.bas 
FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for linux-x86_64 (64bit)
Copyright (C) 2004-2016 The FreeBASIC development team.
target:       linux-x86_64, x86-64, 64bit
compiling:    hello.bas -o hello.c (main module)
compiling C:  gcc -m64 -march=x86-64 -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-main -Werror-implicit-function-declaration -O0 -fno-strict-aliasing -frounding-math -fno-math-errno -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -masm=intel "hello.c" -o "hello.asm"
assembling:   as --64 --strip-local-absolute "hello.asm" -o "hello.o"
linking:      ld -m elf_x86_64 -o "hello" -dynamic-linker /lib64/ld-linux-x86-64.so.2 "/usr/local/bin/../lib/freebasic/linux-x86_64/fbextra.x" -s -L "/usr/local/bin/../lib/freebasic/linux-x86_64" -L "." -L "/usr/lib/gcc/x86_64-linux-gnu/5" "/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o" "/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o" "/usr/local/bin/../lib/freebasic/linux-x86_64/fbrt0.o" "hello.o" "-(" -lfb -ltinfo -lm -ldl -lpthread -lgcc -lgcc_eh -lc "-)" "/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o" 
5. My build command in Geany is:

Code: Select all

fbc -w all "%f"
6. When I attempt to compile hello.bas from Geany, I receive the following error:

Code: Select all

/bin/sh: fbc: command not found
Compilation failed.
7. Again, fbc is known on the system path:

Code: Select all

~/projects/Test $ which fbc
/usr/local/bin/fbc
Does someone see what my issue is in this situation?
3622
Posts: 24
Joined: Mar 14, 2015 23:53

Re: Geany FBC Build Command Not Working

Post by 3622 »

Hi throwingmuse and welcome,

I think the problem is Geany not finding your command line terminal.
Go to Geany -> Preferences -> Tools and make sure the Terminal field is set correctly.
I had to set mine to xterm -e "/bin/sh %c".
You may have to put whatever is your terminal name in place of xterm -e.
If I remember correctly /bin/sh %c inside the " " is ignored. Sorry - brain not in gear - please ignore this last erroneous comment

I hope this helps.
Last edited by 3622 on Sep 04, 2018 20:21, edited 1 time in total.
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Geany FBC Build Command Not Working

Post by badidea »

Edit: Wait, I think you have fbc 32 bit and some libs are missing. Ah, maybe not.

My terminal setting in Geany on Ubuntu Mate is: mate-terminal -e "/bin/sh %c"

These are my settings (before I configured Geany for both fbc32 & fbc64):
Image
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Geany FBC Build Command Not Working

Post by TJF »

You've multiple problems here. At your system several shells are installed, check it:

Code: Select all

$ cat /etc/shells 
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
I guess you're using bash as interactive command line shell, check it:

Code: Select all

$ echo $0
bash
But Geany is configured to use dash shell (/bin/sh is a link to dash). Check it by executing in Geany terminal (F4):

Code: Select all

$ echo $0
sh
So:
1) Don't mix your interactive command line shell (bash) with Geany's shell (dash).
2) It's not garantied that both shells use the same PATH variable. One may find fbc in /usr/local/bin, but not the other. Check: echo $PATH.
3) Dash is a small and fast shell, but has it's quirks and pitfalls. Ie. it doesn't build a commandline from several parameters. Instead it expects the full command line in a single argument (= enclosed by double quotes).

Conclusion: the following command should work in all cases (regardless which shell Geany uses):

Code: Select all

"/usr/local/bin/fbc -w all -exx %f"
Post Reply