Ubuntu how to exec after build?

I’ve been fighting with setting up the Windows build environment until today. Now I’m fighting with the same on Ubuntu!

On the plus side, it’s gone way more smoothly until the very last step - actually running KiCad…

When I try to run with kicad at the prompt, I get:
kicad: error while loading shared libraries: libkigal.so.8.99.0: cannot open shared object file: no such file or directory

/usr/local/bin/kicad has the same result.
If I run kicad from kicad/build/release/kicad, it runs but the components of the software can’t be invoked.

I did previously have KiCad 7.0.something installed via apt-get… but I apt-get removed it. Could some leftover from this be interfering? How would I cleanup such interference?

run with the KICAD_RUN_FROM_BUILD_DIR environment variable set

Thanks for the lightning fast answer : D But it doesn’t seem to have helped.

I gather I should set the env variable in the terminal like so:
$ KICAD_RUN_FROM_BUILD_DIR=1
thereafter $ echo $KICAD_RUN_FROM_BUILD_DIR shows it is set to 1.

However (continuing in the same terminal),
$ kicad
still throws the shared object error.

$ kicad/build/release/kicad/kicad
executes, but still cannot launch the individual components of KiCad

and if I sudo make uninstall (which I thought I’d try in case the installed binaries were being called when they shouldn’t be) I’m in a worse situation!

Try

KICAD_RUN_FROM_BUILD_DIR=1 kicad

or

export KICAD_RUN_FROM_BUILD_DIR=1
kicad

Sorry, typo in previous edit of post, if you were cutting and pasting from my post.

Same result. And echo still tells me it’s set to 1. I’ve even double and triple checked my spelling : )

The shell distinguishes between internal and exported variables. You can’t tell just by displaying the value, that’s not an indicator.

Good to know - I’m not a regular Ubuntu user yet - trying to wean myself onto Linux in general. Thanks for your patience though.

…Especially as it turns out I apparently lied about triple checking my attempt at using this one:

export KICAD_RUN_FROM_BUILD_DIR=1
kicad

That… ahem… worked (you can’t see how red faced I am - but you might just feel the extra heat coming through your monitor).

At least it works when I execute using:
$ ~/kicad/build/release/kicad/kicad

If I just use
$ kicad
I still get the shared object error.

Out of interest though, how come it’s not working after a
$ sudo make install in the build directory? Are there further steps to installing?

That is because you presumably have a regular installation of kicad that you didn’t build from source, and your shell is preferring that from your PATH when you don’t give it an explicit relative path to run.

You may have to run sudo ldconfig

Ok - so shared libraries are placed in /usr/local/lib when running
$ make install.

This is the wrong way to do it! Correct way is
$ sudo ldconfig

For Ubuntu to find these, I need to modify /etc/environment so…
$ sudo nano /etc/environment
Under PATH, add the line
LD_LIBRARY_PATH=“/usr/local/lib”
Ctrl+X, and save
reboot
and yaay : D

And I’ve just spotted your post, which probably would have solved my problem the easy way lol

ldconfig rings a bell… I’ve definitely used it before when I was doing a lot of development in Ubuntu for a project many years ago…

Just to say - I didn’t have a leftover installation - I only had the version I compiled myself (that I had run $ make install on after compiling. But without ldconfig it couldn’t find the shared objects. Also, thanks for your massive help - I feel like I’ve learned enough to be ever so slightly less dangerous!

2 Likes