Ticket #3821 - Docker env build container, now with FEM!

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
Kunda1
Posts: 7334
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #3821 - Docker env build container, now with FEM!

Postby Kunda1 » Wed Apr 15, 2020 8:54 pm

etrombly wrote:
Wed Apr 15, 2020 7:44 pm
It's really easy to set up distcc if you have multiple computers to speed up compiling with this too.
distcc sounds amazing and very much necessary for FC development! Should we start a separate thread for that?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
etrombly
Posts: 80
Joined: Thu Dec 05, 2019 6:50 pm

Re: Ticket #3821 - Docker env build container, now with FEM!

Postby etrombly » Wed Apr 15, 2020 10:07 pm

Kunda1 wrote:
Wed Apr 15, 2020 8:54 pm
distcc sounds amazing and very much necessary for FC development! Should we start a separate thread for that?
This is actually my first time using it. The docker container is pretty essential for me because you don't have to worry about setting up the dependencies on the distcc server if you use it. If you want we can put it in another thread though.
User avatar
David_D
Posts: 69
Joined: Fri Jun 29, 2018 6:43 am
Location: Christchurch, New Zealand

Re: Ticket #3821 - Docker env build container, now with FEM!

Postby David_D » Mon Apr 27, 2020 2:14 am

Kunda1 wrote:
Mon Mar 23, 2020 10:17 pm
kizbitz wrote:
Mon Mar 23, 2020 10:10 pm
@kkremitzki - If you could DM me I'll work through the transfer with you.

Thanks
kkremitzki wrote::point_up_2:
Has there been any love with this? I'd love to get this going as an official project. :D
iyd2019
Posts: 19
Joined: Tue Oct 15, 2019 9:19 am

Re: Ticket #3821 - Docker env build container, now with FEM!

Postby iyd2019 » Fri May 22, 2020 5:23 pm

hi all!

thanks for your work David, it's VERY useful! I hadn't done any work on the FreeCAD source yet because of the complexity of the "infrastructure" required... and you just totally blew that problem away!

I just installed docker, and tested your image: the building worked flawlessly!

now my concerns:
  • Python version is older :oops: than the version in use (your 3.7m vs FreeCAD team 3.8 older!)
  • QT version is newer :shock: than the version in use (your Qt_5.13 vs FreeCAD team Qt_5.12.5)
  • When I run FreeCAD in my docker, it hangs, but seems a problem with GPU drivers (link)
and why this matters? because of my work process, that some other could share:
  • My machine is an apple which is running Ubuntu 20.04
  • I do many things in this machine, so I need a "container" for separation: for example FreeCAD development
  • With your docker image, I can do just that, but I would use it only for compilation, as I'll run the compiled code in the host itself (for maximum performance, with no middle layer at all, to be the "real thing" as much as possible).
the following issues arise (for now):
  • I tend to do "small changes", so my idea was to do them on the docker image and test it on the real machine (for example, change the SketcherGui.so in my host FreeCAD installation for the "corrected version" from my Docker compilation), which I can't because of the dependencies mismatch.
  • Executing it in the Docker itself, which I can't because of the gpu-drivers problem
  • Executing the hole new compiled version on the host, which I also can't, because the app is not packed as standalone.
I don't expect solutions from you, but wanted to leave this information here in case it helps in future decisions.

In any case, any tips would be much appreciated :)

best regards!
User avatar
David_D
Posts: 69
Joined: Fri Jun 29, 2018 6:43 am
Location: Christchurch, New Zealand

Re: Ticket #3821 - Docker env build container, now with FEM!

Postby David_D » Fri May 22, 2020 8:57 pm

iyd2019 wrote:
Fri May 22, 2020 5:23 pm
Hello iyd, very glad to hear you're finding the project useful!

As for your GPU driver problem, I believe the problem is that the graphics drivers installed in the docker container are different to the graphics drivers on the host machine. FreeCAD is trying to communicate in one driver's language, but the host can't read them. I'm not really sure how to resolve that issue on an apple machine, but on my box, I resolved it by uninstalling the proprietary nvidia graphics drivers on my host, and instead using the open source Nouveau drivers.

As for running the compiled code on the host, I'd recommend not doing that, as it somewhat defeats the purpose of the docker container. If you're able to resolve the dependencies to run FreeCAD on your host, you're probably better served by just compiling it on the host in the first place :lol: . I think you'll find the performance difference to be not that great between running in, or outside the docker container. I'd certainly pursue the option of resolving the GPU problem, if I were you. But hey, more power to you if you figure out a way that works!

In terms of having the most similar experience to the end user by running on the host, in my poorly informed opinion, I think the end user experience of FreeCAD is very dependant on how FreeCAD is packaged and distributed. The visual difference between FreeCAD installed from source, as an appimage, or installed from packages is stark. So if you're looking for the true FreeCAD UX experience, I don't believe such a thing exists.

Also, thanks for pointing out that version mismatch! I'll have to come up with a more rigorous method for choosing versions. I typically just go for whatever is newest at the time I'm refreshing the dependencies. :shock:
iyd2019
Posts: 19
Joined: Tue Oct 15, 2019 9:19 am

Re: Ticket #3821 - Docker env build container, now with FEM!

Postby iyd2019 » Fri May 22, 2020 10:44 pm

David_D wrote:
Fri May 22, 2020 8:57 pm
As for your GPU driver problem, I believe the problem is that the graphics drivers installed in the docker container are different to the graphics drivers on the host machine. FreeCAD is trying to communicate in one driver's language, but the host can't read them. I'm not really sure how to resolve that issue on an apple machine, but on my box, I resolved it by uninstalling the proprietary nvidia graphics drivers on my host, and instead using the open source Nouveau drivers.
I managed to solve it a few minutes ago, doing the other way around :D (installing native drivers on the Docker image)

Code: Select all

apt install kmod mesa-utils
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/390.132/NVIDIA-Linux-x86_64-390.132.run
chmod +x NVIDIA-Linux-x86_64-390.132.run
./NVIDIA-Linux-x86_64-390.132.run -a -N --ui=none --no-kernel-module
glxinfo
I put this information together from different pieces, but mostly this one.

As for running the compiled code on the host, I'd recommend not doing that, as it somewhat defeats the purpose of the docker container. If you're able to resolve the dependencies to run FreeCAD on your host, you're probably better served by just compiling it on the host in the first place :lol: . I think you'll find the performance difference to be not that great between running in, or outside the docker container. I'd certainly pursue the option of resolving the GPU problem, if I were you. But hey, more power to you if you figure out a way that works!
your docker is very useful to keep my host system as clean as possible (I love FreeCAD, but only now I'm starting to hack into it and didn't want to put all that stuff in my system...) and you were right: the easier choice was to figure out the gpu driver part.

In terms of having the most similar experience to the end user by running on the host, in my poorly informed opinion, I think the end user experience of FreeCAD is very dependant on how FreeCAD is packaged and distributed. The visual difference between FreeCAD installed from source, as an appimage, or installed from packages is stark. So if you're looking for the true FreeCAD UX experience, I don't believe such a thing exists.
I disagree: I use FreeCAD at work on a daily basis, and for me, in this context, UX means "how it really works everyday for me in my own computer" (a macBookPro with retina display) more than the install part (which only happens once). And just a few minutes ago I discovered one of those behaviors that annoy me the most: screen resolution in 2x displays (i.e. using the display at half resolution for more clearness to look after my poor getting-older eyes) --> your docker image is doing weird stuff with my display, showing a little tiny cursor, that is normal on my host because I have activated the 200% resolution mode of Ubuntu 20.04, pretty similar to the retina display behavior when using MacOS).

Also, thanks for pointing out that version mismatch! I'll have to come up with a more rigorous method for choosing versions. I typically just go for whatever is newest at the time I'm refreshing the dependencies. :shock:
you're welcome: minor stuff compared to your work. In any case, it would be nice to have the exact same configuration that is used to deploy the (0.19) releases.

best regards!
User avatar
David_D
Posts: 69
Joined: Fri Jun 29, 2018 6:43 am
Location: Christchurch, New Zealand

Re: Ticket #3821 - Docker env build container, now with FEM!

Postby David_D » Fri May 22, 2020 11:01 pm

iyd2019 wrote:
Fri May 22, 2020 10:44 pm
I managed to solve it a few minutes ago, doing the other way around :D (installing native drivers on the Docker image)

Code: Select all

apt install kmod mesa-utils
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/390.132/NVIDIA-Linux-x86_64-390.132.run
chmod +x NVIDIA-Linux-x86_64-390.132.run
./NVIDIA-Linux-x86_64-390.132.run -a -N --ui=none --no-kernel-module
glxinfo
I put this information together from different pieces, but mostly this one.
Oooh, very nice, I'll have to look into creating a separate image for nvidia! Pretty busy rn though.
iyd2019 wrote:
Fri May 22, 2020 10:44 pm
I disagree: I use FreeCAD at work on a daily basis, and for me, in this context, UX means "how it really works everyday for me in my own computer" (a macBookPro with retina display) more than the install part (which only happens once). And just a few minutes ago I discovered one of those behaviors that annoy me the most: screen resolution in 2x displays (i.e. using the display at half resolution for more clearness to look after my poor getting-older eyes) --> your docker image is doing weird stuff with my display, showing a little tiny cursor, that is normal on my host because I have activated the 200% resolution mode of Ubuntu 20.04, pretty similar to the retina display behavior when using MacOS).
Interesting, that's something I hadn't considered. I wonder if there's a better way to transfer host configurations to the docker container... There may be a series of config files on the host that can be mounted to the container in the same place to ensure configurations are transferred.