Building software from source on FreeBSD? (not ports)

Hello

I have a couple of softwares (source code) that is not available in package repository or in ports.
I want to compile and install these softwares onto my system. Can you give any general pointers to doing that, or if there is some sort of guide for building software from source.

I have done such stuff for linux (but it was quite a lot of years ago), I remember it being mostly just a matter of running configure + make + make install
I have compiled and installed a library, but when I try to compile the next software I get an error that it cannot find the library (which is installed under /usr/local ) ... shouldn't the build tools find that automatically?
 
or if there is some sort of guide for building software from source.
Instructions on how to build it should come with the software. There's no "one-size-fits-all" type of instruction.

I have compiled and installed a library, but when I try to compile the next software I get an error that it cannot find the library (which is installed under /usr/local ) ... shouldn't the build tools find that automatically?
Not always. So yes, you often have to point it to the right directories for include and/or library files.
 
LLVM in FreeBSD does not automatically add /usr/local to library search paths. You need to modify $LDFLAGS or whatever the software in question uses.
 
I also recommend that you don't install non-pkg software in /usr/local

Start an /opt/stuff directory or whatever. As mentioned you need to add search paths anyway.
Agreed if it's needed by more than one user. If it's only used by one or "the sole" user of a system, I like to install under $HOME/bin but that is just my preference.
 
... shouldn't the build tools find that automatically?
Sometimes if you run ./configure --help, it will provide you with a number of arguments you can use to specify the location of dependencies.

But before you spam your install with a bunch of annoying build dependencies, you possibly want to consider a chroot/jail.
 
… $HOME/bin but that is just my preference.

Code:
% file $HOME/bin/bin
/home/grahamperrin/bin/bin: symbolic link to /home/grahamperrin/.local/bin
% ls -dhiln ~/.local/bin
1091072 drwxr-xr-x  3 1002 1002  167B 19 Oct 23:38 /home/grahamperrin/.local/bin
% ls -hiln ~/bin/bin
987674 lrwxr-xr-x  1 1002 1002   29B  2 Feb  2021 /home/grahamperrin/bin/bin -> /home/grahamperrin/.local/bin
%

1729453958058.pngDon't ask me why. 2021 was long ago :)

From the XDG Base Directory Specification:

User-specific executable files may be stored in $HOME/.local/bin. Distributions should ensure this directory shows up in the UNIX $PATH environment variable, at an appropriate place.


Also, I'm too lazy to discover the location of the other link(s) …

Code:
root@mowa219-gjp4-zbook-freebsd:~ # zdb -dddd august/usr/home 1091072 | grep links
        links   3
root@mowa219-gjp4-zbook-freebsd:~ #
 
Back
Top