Solved How to compile a third party software on a jail?

tgl

Member

Reaction score: 40
Messages: 98

Dear All,

I'd like to compile and install my favorite Gemini TUI client on a jail rather than on the real system:


I thought I may use Poudriere, however after reading several times the handbook and looked into many blogs, I got the impression that all those solutions (jail, ezjail, iocage, poudriere) are meant to compile only ports in a isolate environment and not from a whatever git repo.

I knew that I am wrong but if anyone can help me I would like to know which "jail" I should focus on (I mean the easier to learn) since I am a very beginner.

Thanks in advance,

TGL
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,040
Messages: 39,664

I got the impression that all those solutions (jail, ezjail, iocage, poudriere) are meant to compile only ports in a isolate environment and not from a whatever git repo.
No, jails are not specifically meant for building ports, only poudriere is. Ezjail and iocage are just tools to make dealing with a jail a little easier. You can use a jail for anything you like. Think of a jail as a separate machine which, for all intents and purposes, it actually is.

knew that I am wrong but if anyone can help me I would like to know which "jail" I should focus on (I mean the easier to learn) since I am a very beginner.
Any of the jail tools will do, ezjail, iocase or (not mentioned in the handbook) sysutils/bastille.
 
  • Thanks
Reactions: tgl

astyle

Daemon

Reaction score: 737
Messages: 1,616

If you look at the Handbook's documentation for jails, I think you should be able to get to a point where you can run any shell command inside a jail environment. I'd suggest that you first get a jail running, period. Then, see if you can play around with ping, ls, and the like. Once you get comfortable with that, then experiment with building whatever software you like.
 
  • Thanks
Reactions: tgl
OP
T

tgl

Member

Reaction score: 40
Messages: 98

Hi guys, thanks for your kind replies, hence I'll look into the handbook again and try to create first the environment.
 

eternal_noob

Daemon

Reaction score: 873
Messages: 1,137

I understand that running software in a jail has its advantage, but what is the advantage of compiling software in a jail?
 

angry_vincent

Member

Reaction score: 29
Messages: 35

building in jail ( that what poudriere does too ) has also benefits, as build environment is isolated from the rest of the system. this way, any linking with libraries, for example, happens only in in jail, an not host. most of distributions aka linux that providing building from source, implements this via some hacks such as sandbox or fakeroot
 

eternal_noob

Daemon

Reaction score: 873
Messages: 1,137

as build environment is isolated from the rest of the system. this way, any linking with libraries, for example, happens only in in jail, an not host.
Yes, i understand this but linking is not as dangerous and potentially harmful as running a program. Why not just build on the host?
 

angry_vincent

Member

Reaction score: 29
Messages: 35

users can have various things polluting host, with manually installed software in various places with newer versions ( or different ) of libraries ( let's say this is a low probability but it happens still ) or for some similar reasons, as an example
 

Alexander88207

Aspiring Daemon

Reaction score: 558
Messages: 769

I guess he wants a port of his software what he is trying to compile.

It seems that he trys it to compile alone without using the ports mechanism that means that the systems gets installed files etc.. that are not being tracked or something like that, so i guess he is trying to use a jail.

However i was able to build and test his software shortly and here is a minimal portfile. I will tweak it when i do have more time and submit it.

Screenshot_2021-11-09_20-15-42.png


 

sidetone

Daemon

Reaction score: 940
Messages: 1,890

There's: Thread bastille-jail-to-build-and-test-builds.82155. There's plenty of other How-tos about jails and port building software.

I build mine in Bastille rather than Poudriere, because it's easier to understand and operate within the jail console environment. There's some lack of capabilities in the jail for me, but it's possible to do more in it.
 

astyle

Daemon

Reaction score: 737
Messages: 1,616

There's: Thread bastille-jail-to-build-and-test-builds.82155. There's plenty of other How-tos about jails and port building software.

I build mine in Bastille rather than Poudriere, because it's easier to understand and operate within the jail console environment. There's some lack of capabilities in the jail for me, but it's possible to do more in it.
Bastille seems to be nothing more than template management of jails. Those templates are VERY well tuned and organized (It is a project to do it right, and Bastille maintainers apparently put in the effort to tame the unwieldy beast). Based on that, I would think that nothing prevents Poudriere from using a Bastille-tuned jail to do the building. Create a jail with Bastille, and feed that named jail to Poudriere.
 
OP
T

tgl

Member

Reaction score: 40
Messages: 98

I understand that running software in a jail has its advantage, but what is the advantage of compiling software in a jail?

My point is not having unwanted dependencies in a system because I need to compile one software, if I can do whatever I want in a isolated environment it is just better.
 
OP
T

tgl

Member

Reaction score: 40
Messages: 98

I guess he wants a port of his software what he is trying to compile.

It seems that he trys it to compile alone without using the ports mechanism that means that the systems gets installed files etc.. that are not being tracked or something like that, so i guess he is trying to use a jail.

However i was able to build and test his software shortly and here is a minimal portfile. I will tweak it when i do have more time and submit it.

View attachment 11954


Nice, the author is a friend of mine, I was just trying learn something new, he actually did the port for FreeBSD 12.
 
OP
T

tgl

Member

Reaction score: 40
Messages: 98

But don't you need these dependencies to run the software on the host anyway?

Mmm... Guess not... Anyway I am going to compile and run the binary inside the jail if I am able to understand how, I am already in stale now... 😩
 

chrbr

Aspiring Daemon

Reaction score: 382
Messages: 909

There are build dependencies and dependencies for running the software. The dependencies can differ.
 

astyle

Daemon

Reaction score: 737
Messages: 1,616

Build deps - they're tool ports, like LLVM or GCC. Run deps - they're libs that are already installed. Jails do a good job isolating the build deps (like llvm8) from the rest of the system. Run deps - they're only there to link against. If they're installed on the host, the binary will run both in the jail and on the host. If the run deps are only installed in the jail, there's a chance that the compiled binary may not be able to run outside of the jail. 😩
 
  • Thanks
Reactions: tgl
OP
T

tgl

Member

Reaction score: 40
Messages: 98

Well, thank to all for warning me...

Here is the thing, my only experience with some kind of jail/container is with systemd-nspawn. This allowed me to bootstrap a debian inside the container and then messing-up with git repos, tarball files etc... Yob can connect a nspawn machine to an X call and run GUI application I used to run some wine applications. You may also bind some folders to your home hence using a binary from the nspawn machine was almost seamlessly.

I am trying more or less to do the same with jails, I would like to have a separate environment for the all the software you might be interested in that don't belongs to the repos, so you can install libraries, dependencies whatever you want but keep you real OS cleaned.
 
OP
T

tgl

Member

Reaction score: 40
Messages: 98

Small update!

I was able to achieve exactly what I would!
Now I have a total separate environment where I can test all things about Gemini, and I don't need to worry about exotic git repos or thousand of packages installed and forgotten!

:D
 

chrbr

Aspiring Daemon

Reaction score: 382
Messages: 909

Dear tgl,
this is not about the jail but Gemini.
There has been setup a usenet group called comp.infosystems.gemini last month or so. May be this is of interest.
 
OP
T

tgl

Member

Reaction score: 40
Messages: 98

Dear chrbr

Ops... I slipped because the excitement! 😅

I started using FreeBSD because Gemini and for me both topics are related... 😇
 
Top