Closed ceremcem closed 3 years ago
@wohltat I don't have Ubuntu 20.04 at hand, but
Can you check if any of the following solves your problem:
If that doesn't work, I can install Ubuntu 20.04 and then try creating lxc container in it.
Great, that solved the issue with the debian lxc template.
apt-get install debian-keyring
apt-get install debian-archive-keyring
build-fc.sh:110 only works if the folder already exists, otherwise build_dir (new) will be empty even if build_dir (old) was not empty (build_dir was '../fc-build'):
build_dir=$(readlink -f $build_dir)
mkdir -p $build_dir i manually followed the build.sh script and now it starts compiling. I think i did a mistake which revealed something confusing. I was on the "realthunder/FreeCAD_assembly3:master" branch instead of the "realthunder/FreeCAD:LinkStage3" branch. This in itself is confusing because the release of FreeCAD:LinkStage3 is on FreeCAD_assembly3. Furthermore in your build script there is to read "Assembly3" and "asm3" which adds to the confusion.
Why are there these two repos in the first place?
Why are there these two repos in the first place?
This repo started its life as an alternative to the Assembly3/Wiki instructions. As I'm not authorized to add it to any repository, it exists as a separate one.
build-fc.sh:110 only works if the folder already exists, otherwise build_dir (new) will be empty even if build_dir (old) was not empty (build_dir was '../fc-build'):
Thanks, I fixed it.
This in itself is confusing because the release of FreeCAD:LinkStage3 is on FreeCAD_assembly3
Confusion comes from the history: Back in the days we had many place to track issues, like FreeCAD forum, LinkStage3/issues, Assembly3/issues. In the first days issues were tracked via the forum entry. It was very complex to track the issues there, so we started using Assembly3/issues for Assembly3 related questions. Since build instructions was on Assembly3/README, I also posted many build related question the Assembly3/issues. Since I can't know whether exact reason for an issue is related to Assembly3 WB or LinkStage3, I kept posting every question to Assembly3/issues.
Then some folks started posting issues to LinkStage3/issues when they were exactly sure that the issue is related to LinkStage3. So we started tracking both trackers. I don't know if anyone still posting issues to that forum entry.
So, I guess because of both Assembly3/issues was the main issue tracker and the build instructions was on Assembly3/README, realthunder decided to put the releases to Assembly3 repo.
Furthermore in your build script there is to read "Assembly3" and "asm3" which adds to the confusion
I may not quite get this. What do you mean by that?
Btw, if you have RAM constraints, sometimes Linux freezes and does not respond. I strongly suggest using https://github.com/rfjakob/earlyoom. This kills any memory hungry application in case of an Out Of Memory situation, which I encounter from time to time while compiling FreeCAD.
Furthermore in your build script there is to read "Assembly3" and "asm3" which adds to the confusion
I may not quite get this. What do you mean by that?
build-fc.sh:137 - 138
# Install Assembly3 Workbench
$_sdir/install-asm3.sh $build_dir
so this (as well as the place for the release) suggests that realthunder/FreeCAD_assembly3 is the repo to compile instead of realthunder/FreeCAD:LinkStage3. Or in other words i don't see how the build script is connected to the Assembly3 Workbench build script since it only compiles Linkstage3 and not realthunder/FreeCAD_assembly3.
Btw, if you have RAM constraints, sometimes Linux freezes and does not respond. I strongly suggest using https://github.com/rfjakob/earlyoom. This kills any memory hungry application in case of an Out Of Memory situation, which I encounter from time to time while compiling FreeCAD.
This sounds pretty interesting. I had situations before when the computer froze because of out of memory situations Nice to know that something like that exists.
i don't see how the build script is connected to the Assembly3 Workbench build script since it only compiles Linkstage3 and not realthunder/FreeCAD_assembly3.
build-fc.sh
compiles LinkStage3 and then "install-asm3 into the $build_dir
". Assembly3 WB consists of Python scripts so there is nothing to compile. However, Assembly3 WB supports multiple solvers and currently the preferred one is SolveSpace that needs to be compiled, which is a little bit tricky procedure and is handled by install-slvs.sh
.
If you separately compiled LinkStage3, you can directly use install-asm3.sh
by:
./install-asm3.sh ~/fc-build/Release # this is your build directory
ah, ok. I missed that. Makes more sense now.
Should we close the issue? (No need to rush, just let me know)
I compiled on host system and it went through to the end. But it looks different then the release version. The graphics is slow and the shadow draw style isn't working. And for some reason it doesn't use my settings. I get the errors:
Coin info in SoGLSLShaderObject::printInfoLog(): GLSLfragmentShader log: '0:67(1): error: no function with name 'DirectionalLight'
Coin error in SoGLSLShaderProgram::ensureLinking(): error: 'GL_INVALID_VALUE' (set envvar COIN_GLERROR_DEBUGGING=1 and re-run to get more information)
cmake says:
...
-- Checking for module 'Coin'
-- No package 'Coin' found
-- Coin3D libraries found
...
==============
Summary report
==============
...
-- Coin3D: 4.0.0 [/usr/lib/x86_64-linux-gnu/libCoin.so] [/usr/include]
...
The package libcoin-dev
and everything else libcoin*
is installed. Also it's unclear to me what is the difference.
I'll try the lxc path now.
But it looks different then the release version. The graphics is slow and the shadow draw style isn't working. And for some reason it doesn't use my settings.
This is strange.
cmake says:
It's the same on my side. However, I never noticed any slowdown. (Am I missing something?) Here is the full log in case you want to compare with yours:
Please update build-freecad-asm3 repo, I recently pushed some more path fixes.
now it doesn't work anymore. Something with the folder
-------------------------------
Building in /home/user/build/realthunder/ceremcem/fc-build/Release
-------------------------------
CMake Error: The source directory "/home/user/build/realthunder/ceremcem/FreeCAD" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
beforehand it was build in /home/user/fc-build
also i had to remove gmsh from packages.txt because it created an unsolvable package dependency situation for me with libocct7.3 vs libocct7.5. This maybe has to do with the freecad-daily PPA i'm using.
How did that happen? What commands did you issue till you get there?
CMake Error: The source directory "/home/user/build/realthunder/ceremcem/FreeCAD" does not exist.
Where is your FreeCAD
source directory currently?
The lxc build completed now, but i needed to do some additional things to make it work:
# --packages parameter does not work for me, i.e. packages where not installed
local$ sudo lxc-create -n fc -t debian -- -r buster
# add user "freecad" if necessary
local$ sudo lxc-attach fc
# -m is needed, otherwise no userfolder is created
root@fc:/# useradd -m freecad
root@fc:/# usermod -a -G sudo freecad
# password needs to be set for ssh to work
root@fc:/# passwd freecad
# using apt install instead of --packages parameter
root@fc:/# apt install xbase-clients nano sudo tmux git
# find the ip address via lxc-info and login
local$ sudo lxc-info -n fc
local$ ssh -XC freecad@10.0.10.3
freecad@fc:~$
So far so good. But there is still the error
Coin info in SoGLSLShaderObject::printInfoLog(): GLSLfragmentShader log: '0:67(1): error: no function with name 'DirectionalLight'
Coin error in SoGLSLShaderProgram::ensureLinking(): error: 'GL_INVALID_VALUE' (set envvar COIN_GLERROR_DEBUGGING=1 and re-run to get more information)
This coin3d shading error seems to be known and solved if realthunders coin fork is used. https://github.com/realthunder/coin I guess this will not be integrated into this build script somehow.
And there is still the problem that the settings from my user folder are not used. All precompiled FreeCAD versions i've tried so far use my settings. But the official FreeCAD main branch also has that problem.
# -m is needed, otherwise no userfolder is created
That was on purpose. But if you know what you are doing, that's okay I guess.
from my user folder are not used.
Where is it located? You need to copy your HOST:/home/youruser/.FreeCAD
to GUEST:/home/theuserfolderthatdoesntexistatthismoment/.FreeCAD
. Where is your $HOME
folder now?
I guess this will not be integrated into this build script somehow.
How do we turn on shading, so I can verify when it's solved?
# -m is needed, otherwise no userfolder is created
That was on purpose.
Why this? Seems like a necessary step that can be automated. Without a user folder there is no ssh connection.
Where is it located? You need to copy your
HOST:/home/youruser/.FreeCAD
toGUEST:/home/theuserfolderthatdoesntexistatthismoment/.FreeCAD
. Where is your$HOME
folder now?
$HOME is /home/freecad on the xlc guest. I have copied my settings (host) via scp to the guest and checked that its there at /home/freecad/.FreeCAD and /home/freecad/.config/FreeCAD. But strangely it did not change anything.
How do we turn on shading, so I can verify when it's solved?
via keypress: V,9 or via menu: View -> Draw Style -> Shadow
View -> Draw Style -> Shadow
I can verify that 3D navigation is extremely slowed down when switched to Shadow mode. I'll handle installing Coin from realthunder ASAP.
$HOME is /home/freecad on the xlc guest. I have copied my settings (host) via scp to the guest and checked that its there at /home/freecad/.FreeCAD and /home/freecad/.config/FreeCAD. But strangely it did not change anything.
I thought you said you didn't create the $HOME
folder? That's strange.
~/.FreeCAD
directory created when it's not present? ~/.FreeCAD
directory from host to guest)I can verify that 3D navigation is extremely slowed down when switched to Shadow mode. I'll handle installing Coin from realthunder ASAP
I've compiled and installed realthunders coin and restarted the build.sh script. It a long time to compile so i expect that it integrated that new coin library. cmake now says:
...
-- Performing Test _flag_found - Success
-- Checking for module 'Coin'
-- Found Coin, version 4.0.1
-- Coin3D libraries found
...
-- OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- OpenGLU: [/usr/lib/x86_64-linux-gnu/libGLU.so][/usr/include]
-- Coin3D: 4.0.1 [Coin] [/usr/local/include]
-- SPNAV: [/usr/lib/libspnav.so] [/usr/include]
...
But its the same error message when running FreeCAD. Besides from that the graphics is extremely slow even if i don't use shadows. Like 5 FPS or so. Feels like a remote computer session.
I thought you said you didn't create the
$HOME
folder? That's strange.
I wanted to say, 'useradd -m' is reasonable because the userfolder (aka $HOME) has to be created anyways.
The copied settings are used now. I don't know what i did wrong before. So copying the settings to the lxc container worked.
I wanted to say, 'useradd -m' is reasonable because the userfolder (aka $HOME) has to be created anyways.
Ah! Now I get it. You are correct, I made a mistake by writing useradd freecad
in the README, it should be adduser freecad
.
Besides from that the graphics is extremely slow even if i don't use shadows. Like 5 FPS or so. Feels like a remote computer session.
Was it that way before compiling against realthunder's Coin3D? I experienced the 5 FPS response when I switch to shadow mode, but it's pretty responsive when I switch to "As Is" mode.
So copying the settings to the lxc container worked.
Nice.
Let me try the Coin3D switch.
@wohltat Can you try ssh -X freecad@...
, omitting the -C
flag? Disabling compression might change response time.
@wohltat Can you try
ssh -X freecad@...
, omitting the-C
flag? Disabling compression might change response time.
much better now concerning framerate but still not as fluid as running on the host system. Furthermore this takes much more resources. If i create a torus and rotate it. It completely uses up all the cpu. If i do the same on the host it uses like around 25% whilst being more responsive. (tested without shadows)
What about using the lxc container just for reproducible compiling and generate some kind of package like AppImage or so that can be used outside?
What about using the lxc container just for reproducible compiling and generate some kind of package like AppImage or so that can be used outside?
I had the same idea for a while: #8. I was planning to use the LXC containers for AppImage updater server and maybe quick local hacks. Maybe it's time.
After no success with simply running the copied files from lxc container on the host, i tried again to build on host. But now it doesn't work anymore and i can't figure out why.
Are you able to make it work after you compiled Coin3D from realthunder? I got the following error:
/home/aea/fc-build/Release/bin/FreeCAD: error while loading shared libraries: libCoin.so.80: cannot open shared object file: No such file or directory
This is how I installed Coin3D:
#!/bin/bash
set -ue
cd $HOME
[[ -d coin ]] \
|| git clone --recurse-submodules https://github.com/realthunder/coin coin \
&& (cd coin; git pull)
cmake \
-Hcoin \
-Bcoin_build \
-G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release \
-DCOIN_BUILD_DOCUMENTATION=OFF
cd coin_build
make
sudo make install
After no success with simply running the copied files from lxc container on the host,
You can't simply copy the compiled files from guest to host, files are compiled using the actual paths. You can't even move the folder inside guest, or rename it.
Anyhow, I was thinking about running FreeCAD via chroot
and it had some little problems in terms of usage (it's still a little bit cumbersome, but nothing that can not be resolved). I tried it again and yes, there is a huge difference in terms of resource usage and response time between them. It runs way faster while using much less resources now.
Would you like to try the run-in-chroot.sh
script? Here is how:
fc4-config.sh
accordinglychroot
: ./run-in-chroot.sh fc4-config.sh
FreeCAD should run with your user settings and you can reach your files by those mounts
folders.
i compiled coin without -DCMAKE_INSTALL_PREFIX. Or without any additional parameters at all.
freecad@fc:~$ find / -name "libCoin*"
/home/freecad/coin_build/lib/libCoin.so
/home/freecad/coin_build/lib/libCoin.so.80.0.1
/home/freecad/coin_build/lib/libCoin.so.80
/usr/local/lib/libCoin.so
/usr/local/lib/libCoin.so.80.0.1
/usr/local/lib/libCoin.so.80
/usr/lib/x86_64-linux-gnu/libCoin.so
/usr/lib/x86_64-linux-gnu/libCoin.so.80c
/usr/lib/x86_64-linux-gnu/libCoin.so.4.0.0
I'm not 100% sure if it was compiled into FreeCAD but at least i had no error message when starting and the cmake output indicates that it was used.
I'll try your chroot script now.
Would you like to try the
run-in-chroot.sh
script?
Works great. Now it feels like an application on the host. Ok it is exactly that :)
What about a comment like follows, so it is more clear how to change the settings:
...
# mountpoints
# adapt to your system
# first column: src - mountpoint on host, second column: tgt - target folder on guest filesystem
read -r -d '' mounts <<-'EOF'
...
Still have not figured out why the attempt to use realthunders coin library didn't work. There is still the same error message and it looks like this
Works great. Now it feels like an application on the host. Ok it is exactly that :)
It does, doesn't it? :D I think the current approach is very much like how AppImage works under the hood.
Still have not figured out why the attempt to use realthunders coin library didn't work.
I'll look into that again. I also wonder why.
What about a comment like follows, so it is more clear how to change the settings:
I think the clearer approach might be directly parsing LXC container's config
file. This way we could maintain the same configuration file both for LXC container and the "native invocation". User will simply copy the run-in-chroot.sh
into the /var/lib/lxc/your-container
and it will parse ./config
when invoked. It will run any command passed by the arguments.
FreeCAD should run with your user settings and you can reach your files by those mounts folders.
Did you mean it should use my "normal" settings(.Freecad,.config/FreeCAD) from my host system? Id like it to do that but it does not. It takes the settings from the lxc container.
I think the current approach is very much like how AppImage works under the hood.
Actually i start to like this more than an AppImage because there is still an easy way to access the file system of the application.
One thing i miss, besides the settings from my user folder, is that the application does not see the host file system yet. So i cannot save my models to a folder like i used to. Ideally the container file system would be invisible when saving files.
Did you mean it should use my "normal" settings(.Freecad,.config/FreeCAD) from my host system?
No, I meant it will use container/home/freecad/.FreeCAD
. I used FreeCAD with my host ~/.FreeCAD
folder by mounting it to the container for a long time, it works. (I just don't prefer at the moment)
is that the application does not see the host file system yet
That's on purpose. That's the point of using a sandboxed application. I don't know how AppImage does this, but you can mount any number of directories you want into your container. I don't know if we could just expose whole filesystem to the container, but even if we could, I wouldn't prefer this approach.
Here the AppImage is being reinvented :D
@wohltat FYI: I've refactored run-in-chroot.sh
. It now parses directly the container's config file. New usage in your case:
./run-in-chroot.sh -n yourContainerName -u freecad '~/fc-build/Release/bin/FreeCAD'
(Pay attention to the single quotes, or the ~
will expand to your $HOME
folder in your host.)
I'm going to close the issue here. We can still continue discussion here, or you can open a new one.
That's the point of using a sandboxed application
Hmm, actually i don't want a sandbox. I just want a reproducible environment for compiling.
Are you able to make it work after you compiled Coin3D from realthunder? I got the following error:
/home/aea/fc-build/Release/bin/FreeCAD: error while loading shared libraries: libCoin.so.80: cannot open shared object file: No such file or directory
... You can't simply copy the compiled files from guest to host, files are compiled using the actual paths. You can't even move the folder inside guest, or rename it.
I tried realthunders AppImage builder (conda) and found these lines in the output. I don't know exactly what to make of it but i found it interesting:
Packaging coin3d
INFO:conda_build.build:Packaging coin3d
INFO conda_build.build:build(2274): Packaging coin3d
number of files: 917
Making absolute symlink relative (lib/libCoin.so -> libCoin.so.80 :-> libCoin.so.80.0.1)
...
Hmm, actually i don't want a sandbox.
I understand that you need to reach your files easily. I directly mounted my $HOME
folder on the host to the container:
lxc.mount.entry = /home/ceremcem home/aea/ none bind 0 0
However, I don't know if ~/.Xauthority
file may conflict in this case or not. I guess it won't, because both machines are using same xauth
. Let's see any possible suggestions: https://superuser.com/q/1632759/187576
Until then, it's safe to separately mount your folders into the guest.
I'm a bit confused. I didn't work on that project for the last days and now can't find the lxc container anymore. Not as user and not as root.
But i can still start it with the ./run-in-chroot.sh
script.
i used
lxc list
lxc image list
sudo lxc list
sudo lxc image list
nothing.
Any ideas how this could happen?
That's quite weird. run-in-chroot.sh
script uses a hardcoded $LXC_PATH
, that might be the difference. Can you verify /var/lib/lxc/fc/rootfs
exists?
Yes, /var/lib/lxc/fc/rootfs
exists. I can see the whole file system there.
...
Ok, i just found it. After a system restart, the LXD daemon was not running anymore. Snap!
In that situation i find lxc
pretty difficult to use. There was no indication that lxd
was not running. Also i still cannot list the containers with lxc
. I have to use lxc-ls
for that.
Probably this is something about version incompatibility. lxc
is part of lxd
(v4.12) installed via snap and lxc-ls
and lxc-XXX
comes from the ubuntu repos (v4.0.0-devel).
If i do
> sudo lxd list
internal error, please report: running "lxd" failed: cannot create transient scope: DBus error "org.freedesktop.DBus.Error.UnixProcessIdUnknown": [Process with ID 105998 does not exist.]
i get that error message.
Strangely lxc-ls
works though. Probably because the container was created by lxc-create
.
Any ideas to make it a bit less error prone?
Glad you solved it.
I had multiple attempts over time to switch to LXD, but I couldn't make it work, so I'm a little bit unfamiliar with LXD. There is no way for me to support it without using it.
Any ideas to make it a bit less error prone?
While using LXC, I've rarely experienced such strange issues. I'm just starting the container with lxc-start -n mycontainer
and move on. Works all the time.
In rare occurrences, lxc-start -n mycontainer
fails and there is no meaningful error messages at the beginning. It suggests you to start the container without sending to background (with -B
option I guess) and you eventually get some clues. The issue was generally the same: I sometimes refactor my directory structure and lxc can not find the directory to mount while executing lxc.mount.entry
. I lately learned that bind,create=dir
option automatically overcomes the issue.
I'm trying to cover those type of pitfalls for LXC.
First i tried building on host. The commands do not work as is.
With a minor modification the packages.txt is found:
Building directly on host failed with
E: Unable to locate package python3-pyside2uic
i then removed that package from packages.txt and tried again. Then it fails silently with
trying the lxc path, i got stuck at the following point after a long time setting up lxd / lxc and trying a lot of things: