ceremcem / build-freecad-asm3

Build FreeCAD Asm3 inside a Debian container and run from there.
6 stars 0 forks source link

problems compiling on ubuntu 20.04 #11

Closed ceremcem closed 3 years ago

ceremcem commented 3 years ago

From https://github.com/realthunder/FreeCAD_assembly3/issues/504#issuecomment-792978479

First i tried building on host. The commands do not work as is.

$ git clone https://github.com/ceremcem/build-freecad-asm3
$ ./build-freecad-asm3/build.sh 

With a minor modification the packages.txt is found:

$ git clone https://github.com/ceremcem/build-freecad-asm3
$ cd build-freecad-asm3/
$ ./build.sh 

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

-------------------------------
Building in ../fc-build/Release
-------------------------------

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:

>>> sudo lxc-create -n fc -t debian -- -r buster --packages xbase-clients nano sudo tmux git                                                                                                  19:30.45 Mon Mar 08 2021 >>> 
[sudo] password for user: 
debootstrap is /usr/sbin/debootstrap
Checking cache download in /var/cache/lxc/debian/rootfs-buster-amd64 ... 
gpg: key 7638D0442B90D010: 4 signatures not checked due to missing keys
gpg: key 7638D0442B90D010: "Debian Archive Automatic Signing Key (8/jessie) <ftpmaster@debian.org>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
Downloading debian minimal ...
I: Retrieving InRelease 
I: Checking Release signature
E: Release signed by unknown key (key id DCC9EFBF77E11517)
   The specified keyring /var/cache/lxc/debian/archive-key.gpg may be incorrect or out of date.
   You can find the latest Debian release key at https://ftp-master.debian.org/keys.html
Failed to download the rootfs, aborting.
Failed to download 'debian base'
failed to install debian
lxc-create: fc: lxccontainer.c: create_run_template: 1620 Failed to create container from template
lxc-create: fc: tools/lxc_create.c: main: 319 Failed to create container fc
ceremcem commented 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.

wohltat commented 3 years ago

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?

ceremcem commented 3 years ago

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?

ceremcem commented 3 years ago

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.

wohltat commented 3 years ago

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.

wohltat commented 3 years ago

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.

ceremcem commented 3 years ago

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
wohltat commented 3 years ago

ah, ok. I missed that. Makes more sense now.

ceremcem commented 3 years ago

Should we close the issue? (No need to rush, just let me know)

wohltat commented 3 years ago

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.

ceremcem commented 3 years ago

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:

Build log ``` aea@fc4:~$ ./build-freecad-asm3/build-fc.sh --only-compile ------------------------------- Building in /home/aea/fc-build/Release ------------------------------- -- Compiler: GNU, version: 8.3.0 -- prefix: /usr/local -- bindir: bin -- datadir: share -- docdir: share/doc/FreeCAD -- includedir: include -- libdir: lib -- cmake: 3.13.4 -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) ===================================================== Doxygen not found, will not build documentation. ===================================================== -- Boost version: 1.67.0 -- Found the following Boost libraries: -- filesystem -- program_options -- regex -- system -- thread -- chrono -- date_time -- atomic -- PyCXX found: -- Headers: /home/aea/FreeCAD/src -- Sources: /home/aea/FreeCAD/src/CXX -- Version: 6.2.8 -- -- Found OCE/OpenCASCADE version: 7.3.0 -- -- OCE/OpenCASCADE include directory: /usr/include/opencascade -- -- OCE/OpenCASCADE shared libraries directory: /usr/lib/x86_64-linux-gnu -- The imported target "vtkParseOGLExt" references the file "/usr/bin/vtkParseOGLExt-7.1" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- The imported target "vtkRenderingPythonTkWidgets" references the file "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- The imported target "vtk" references the file "/usr/bin/vtk" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- The imported target "pvtk" references the file "/usr/bin/pvtk" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- VTK components: vtkCommonCore;vtkCommonDataModel;vtkFiltersVerdict;vtkIOXML;vtkFiltersCore;vtkFiltersGeneral;vtkIOLegacy;vtkFiltersExtraction;vtkFiltersSources;vtkFiltersGeometry;vtkIOMPIParallel;vtkParallelMPI;vtkhdf5;vtkFiltersParallelDIY2;vtkRenderingCore;vtkInteractionStyle;vtkRenderingFreeType;vtkRenderingOpenGL2 -- Check for medfile (libmed and libmedc) ... -- We guess that libmed was built using hdf5-openmpi version -- Found Netgen: /usr/lib/cmake/netgen -- Found NETGEN version 6.2, calculated: 393728 -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Checking for module 'Coin' -- No package 'Coin' found -- Coin3D libraries found -- Shiboken2Config: Using default python: -python2.7.x86_64-linux-gnu -- libshiboken built for Release -- PYTHON_CONFIG_SUFFIX: .cpython-37m-x86_64-linux-gnu -- libshiboken built for Release -- =============================================== PySide2 Python module found at /usr/lib/python3/dist-packages/PySide2. =============================================== -- -- matplotlib-3.0.2 has been found. -- Platform is 64-bit, set -D_OCC64 -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- setting gcc options: -Wall -Werror -Wno-deprecated -pedantic-errors -- Boost version: 1.67.0 -- Found the following Boost libraries: -- python37 -- found Boost: 1_67 -- boost-incude dirs are: /usr/include -- boost-python lib is: -- boost_LIBRARY_DIRS is: /usr/lib/x86_64-linux-gnu -- Boost_LIBRARIES is: /usr/lib/x86_64-linux-gnu/libboost_python37.so -- area module (for Path Workbench) will be installed to: lib -- ============== Summary report ============== -- Build type: Release -- Compiler: /usr/bin/c++ (8.3.0) -- Flags: -Wall -Wextra -Wno-write-strings -- Standard: Requires C++11 -- Python: 3.7.3 [/usr/bin/python3] [.cpython-37m-x86_64-linux-gnu] -- PCL: not enabled -- pybind11: not enabled -- Boost: 1.67.0 (106700) -- XercesC: 3.2.2 [/usr/lib/x86_64-linux-gnu/libxerces-c.so] [/usr/include] -- ZLIB: 1.2.11 -- PyCXX: 6.2.8 [/home/aea/FreeCAD/src] -- OCC: 7.3.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/usr/lib/x86_64-linux-gnu] [/usr/include/opencascade] -- SMESH: build internal -- MEDFile: 4.0.0 [/usr/lib/x86_64-linux-gnu/libmedC.so] [/usr/include] -- HDF5: 1.10.4 -- VTK: 7.1.1 -- NETGEN: 6.2.0 (6.2-dev) [-DNO_PARALLEL_THREADS;-DOCCGEOMETRY;-DNETGEN_VERSION=393728] [] [/usr/include/netgen/include;/usr/include/netgen] [nglib] [/usr/include/netgen/include;/usr/include/netgen] -- SWIG: 3.0.12 -- Eigen3 3.3.7 -- Qt5Core: 5.11.3 -- Qt5Network: 5.11.3 -- Qt5Xml: 5.11.3 -- Qt5XmlPatterns: 5.11.3 -- Qt5Widgets: 5.11.3 -- Qt5PrintSupport: 5.11.3 -- Qt5OpenGL: 5.11.3 -- Qt5Svg: 5.11.3 -- Qt5UiTools: 5.11.3 -- Qt5Concurrent: 5.11.3 -- Qt5WebKitWidgets: 5.212.0 -- Shiboken2: 5.11.2 [/usr/lib/x86_64-linux-gnu/cmake/Shiboken2-5.11.2] [/usr/include/shiboken2] -- PySide2: 5.11.2 [/usr/include/PySide2] -- PySide2Tools: [/usr/bin/pyside2-uic] [/usr/bin/pyside2-rcc] -- Freetype: 2.9.1 -- OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so -- OpenGLU: [/usr/lib/x86_64-linux-gnu/libGLU.so][/usr/include] -- Coin3D: 4.0.0 [/usr/lib/x86_64-linux-gnu/libCoin.so] [/usr/include] -- SPNAV: [/usr/lib/libspnav.so] [/usr/include] -- Matplotlib: 3.0.2 -- Rift: not enabled (BUILD_VR) -- Doxygen: not found ================================================= Now run 'cmake --build /home/aea/fc-build/Release' to build FreeCAD ================================================= -- Configuring done -- Generating done -- Build files have been written to: /home/aea/fc-build/Release ----------------------------------------------- Configuration done in 5s -> Compiling ----------------------------------------------- [ 1%] Built target lazy_loader [ 1%] Built target Driver [ 1%] Built target MEFISTO2 [ 1%] Generating version_check [ 2%] Built target SMDS [ 2%] Built target Test [ 2%] Built target ImageScripts [ 2%] Built target MeshScripts [ 2%] Built target PartScripts [ 2%] Built target MaterialToolsLib [ 3%] Built target MaterialLib [ 3%] Built target Material [ 3%] Built target FluidMaterialLib [ 4%] Built target PartDesignHole [ 6%] Built target FreeCADBase [ 7%] Built target PartDesignScripts [ 7%] Built target WizardShaft [ 8%] Built target RaytracingScripts [ 9%] Built target DrawingScripts [ 10%] Built target RobotScripts [ 10%] Built target SketcherScripts [ 10%] Built target ReverseEngineeringScripts [ 11%] Built target WebScripts [ 17%] Built target Draft git /home/aea/fc-build/Release/src/Build/Version.h.out written [ 17%] Built target SurfaceScripts [ 17%] Built target StartTests [ 17%] Generating Version.h [ 17%] Built target StartScripts [ 17%] Built target StartPage [ 17%] Built target fc_version [ 18%] Built target Idf [ 18%] Built target ImportScripts [ 19%] Built target ImportPy [ 20%] Built target Arch [ 22%] Built target FemGuiScriptsTarget [ 28%] Built target FemScriptsTarget [ 28%] Built target FemPythonUi [ 28%] Built target OpenSCAD [ 29%] Built target OpenSCADTests [ 29%] Built target SpreadsheetScripts [ 30%] Built target PathTests [ 34%] Built target PathScripts [ 34%] Built target area-native [ 34%] Built target Show [ 34%] Built target TDTestTarget [ 34%] Built target AddonManager [ 35%] Built target TechDraw_Data [ 35%] Built target Tux [ 35%] Built target fc_cadquery_impl_COPY_SOURCE [ 35%] Built target fc_cadquery_COPY_SOURCE [ 35%] Built target FreeCADGui_Resources [ 35%] Built target Example_data [ 37%] Built target Stylesheets_data [ 37%] Built target DriverSTL [ 37%] Built target SMESHDS [ 37%] Built target DriverDAT [ 37%] Built target area [ 38%] Built target DriverUNV [ 41%] Built target FreeCADApp [ 41%] Built target FreeCADMainPy [ 41%] Built target FreeCADMainCmd [ 41%] Built target Image [ 42%] Built target SMESH [ 42%] Built target Points [ 43%] Built target Spreadsheet [ 43%] Built target Web [ 44%] Built target Start [ 47%] Built target Mesh [ 49%] Built target StdMeshers [ 49%] Built target NETGENPlugin [ 62%] Built target FreeCADGui [ 62%] Built target FreeCADMain [ 62%] Built target FreeCADGuiPy [ 62%] Built target PointsGui [ 63%] Built target QtUnitGui [ 64%] Built target ImageGui [ 64%] Built target WebGui [ 64%] Built target StartGui [ 64%] Built target SpreadsheetGui [ 65%] Built target MeshGui [ 70%] Built target Part [ 70%] Built target Raytracing [ 71%] Built target Drawing [ 73%] Built target Robot [ 74%] Built target Sketcher [ 74%] Built target ReverseEngineering [ 74%] Built target DraftUtils [ 74%] Built target MeshPart [ 75%] Built target Surface [ 75%] Built target Import [ 76%] Built target Inspection [ 77%] Built target PartDesign [ 78%] Built target Path [ 78%] Built target Measure [ 81%] Built target PartGui [ 81%] Built target RaytracingGui [ 81%] Built target DrawingGui [ 82%] Built target Fem [ 82%] Built target ReverseEngineeringGui [ 83%] Built target MeshPartGui [ 83%] Built target SurfaceGui [ 83%] Built target ImportGui [ 84%] Built target RobotGui [ 84%] Built target InspectionGui [ 84%] Built target PathSimulator [ 85%] Built target PathGui [ 87%] Built target SketcherGui [ 90%] Built target FemGui [ 93%] Built target PartDesignGui [ 96%] Built target TechDraw [100%] Built target TechDrawGui ----------------------------------------------- FreeCAD is compiled in 0m ----------------------------------------------- Clone (or update) Assembly3 Workbench ------------------------------------- + cd /home/aea/fc-build/Release/Mod/asm3 Already up to date. Already on 'master' Your branch is up to date with 'origin/master'. Installing SolveSpace solver backend Clone (or update) py3_slvs ------------------------------------- + cd /home/aea/fc-build/Release/Mod/asm3/freecad/asm3/slvs Already up to date. -- python version 3.7 -- python package -- Configuring done -- Generating done -- Build files have been written to: /home/aea/fc-build/Release/Mod/asm3/freecad/asm3/slvs/build [ 8%] Built target slvs_swig_compilation [ 83%] Built target slvs_static_excp [100%] Built target _slvs py3_slvs is compiled. Finished installing Assembly3 Workbench. ```
ceremcem commented 3 years ago

Please update build-freecad-asm3 repo, I recently pushed some more path fixes.

wohltat commented 3 years ago

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.

ceremcem commented 3 years ago

How did that happen? What commands did you issue till you get there?

ceremcem commented 3 years ago

CMake Error: The source directory "/home/user/build/realthunder/ceremcem/FreeCAD" does not exist.

Where is your FreeCAD source directory currently?

wohltat commented 3 years ago

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.

ceremcem commented 3 years ago

# -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?

wohltat commented 3 years ago

# -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 to GUEST:/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

ceremcem commented 3 years ago

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.

  1. Is ~/.FreeCAD directory created when it's not present?
  2. Are permissions correct? (ownership may differ between host and guest when you copy your ~/.FreeCAD directory from host to guest)
wohltat commented 3 years ago

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.

ceremcem commented 3 years ago

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.

ceremcem commented 3 years ago

@wohltat Can you try ssh -X freecad@..., omitting the -C flag? Disabling compression might change response time.

wohltat commented 3 years ago

@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?

ceremcem commented 3 years ago

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.

wohltat commented 3 years ago

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.

build log ``` ~> build-freecad-asm3/build.sh [sudo] password for user: Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'cmake-qt-gui' instead of 'cmake-gui' Note, selecting 'python3-pyside2.qtxml' for regex 'PySide2.QtXml' Note, selecting 'python3-pyside2.qtxmlpatterns' for regex 'PySide2.QtXml' libocct-data-exchange-dev is already the newest version (1:7.5.1+dfsg1-0~202102252047~ubuntu20.04.1). libocct-ocaf-dev is already the newest version (1:7.5.1+dfsg1-0~202102252047~ubuntu20.04.1). libocct-visualization-dev is already the newest version (1:7.5.1+dfsg1-0~202102252047~ubuntu20.04.1). netgen is already the newest version (1:6.2.2006+really6.2.1905+dfsg-0~202102251943~ubuntu20.04.1). netgen-headers is already the newest version (1:6.2.2006+really6.2.1905+dfsg-0~202102251943~ubuntu20.04.1). occt-draw is already the newest version (1:7.5.1+dfsg1-0~202102252047~ubuntu20.04.1). cmake is already the newest version (3.16.3-1ubuntu1). libboost-dev is already the newest version (1.71.0.0ubuntu2). libboost-filesystem-dev is already the newest version (1.71.0.0ubuntu2). libboost-program-options-dev is already the newest version (1.71.0.0ubuntu2). libboost-thread-dev is already the newest version (1.71.0.0ubuntu2). libmetis-dev is already the newest version (5.1.0.dfsg-5). python3-dev is already the newest version (3.8.2-0ubuntu2). python3-ply is already the newest version (3.11-3build1). calculix-ccx is already the newest version (2.11-1build3). cmake-qt-gui is already the newest version (3.16.3-1ubuntu1). libboost-date-time-dev is already the newest version (1.71.0.0ubuntu2). libboost-graph-dev is already the newest version (1.71.0.0ubuntu2). libboost-iostreams-dev is already the newest version (1.71.0.0ubuntu2). libboost-python-dev is already the newest version (1.71.0.0ubuntu2). libboost-regex-dev is already the newest version (1.71.0.0ubuntu2). libboost-serialization-dev is already the newest version (1.71.0.0ubuntu2). libcoin-dev is already the newest version (4.0.0+ds-1build1). libeigen3-dev is already the newest version (3.3.7-2). libgts-bin is already the newest version (0.7.6+darcs121130-4). libgts-dev is already the newest version (0.7.6+darcs121130-4). libkdtree++-dev is already the newest version (0.7.1+git20101123-5build1). libmedc-dev is already the newest version (4.0.0+repack-9build1). libopencv-dev is already the newest version (4.2.0+dfsg-5). libproj-dev is already the newest version (6.3.1-1). libpyside2-dev is already the newest version (5.14.0-1~exp1ubuntu5). libqt5opengl5-dev is already the newest version (5.12.8+dfsg-0ubuntu1). libqt5svg5-dev is already the newest version (5.12.8-0ubuntu1). libqt5webkit5-dev is already the newest version (5.212.0~alpha4-1ubuntu2). libqt5x11extras5-dev is already the newest version (5.12.8-0ubuntu1). libqt5xmlpatterns5-dev is already the newest version (5.12.8-0ubuntu1). libshiboken2-dev is already the newest version (5.14.0-1~exp1ubuntu5). libspnav-dev is already the newest version (0.2.3-1). libvtk7-dev is already the newest version (7.1.1+dfsg2-2ubuntu1). libxerces-c-dev is already the newest version (3.2.2+debian-1build3). libzipios++-dev is already the newest version (0.1.5.9+cvs.2007.04.28-11build1). pyside2-tools is already the newest version (5.14.0-1~exp1ubuntu5). python3-matplotlib is already the newest version (3.1.2-1ubuntu4). python3-pivy is already the newest version (0.6.5-1build2). python3-pyside2.qtcore is already the newest version (5.14.0-1~exp1ubuntu5). python3-pyside2.qtgui is already the newest version (5.14.0-1~exp1ubuntu5). python3-pyside2.qtsvg is already the newest version (5.14.0-1~exp1ubuntu5). python3-pyside2.qtwidgets is already the newest version (5.14.0-1~exp1ubuntu5). python3-pyside2.qtxml is already the newest version (5.14.0-1~exp1ubuntu5). python3-pyside2.qtxmlpatterns is already the newest version (5.14.0-1~exp1ubuntu5). qtbase5-dev is already the newest version (5.12.8+dfsg-0ubuntu1). qttools5-dev is already the newest version (5.12.8-0ubuntu1). swig is already the newest version (4.0.1-5build1). libx11-dev is already the newest version (2:1.6.9-2ubuntu1.1). The following packages were automatically installed and are no longer required: gmsh-doc libfltk-gl1.3 libfltk-images1.3 libfltk1.3 Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded. Already on 'LinkStage3' Your branch is up to date with 'origin/LinkStage3'. HEAD is now at 6fe58a6615 Web: change warning dialog to a warning log message Already up to date. ------------------------------- Building in /home/user/fc-build/Release ------------------------------- -- Compiler: GNU, version: 9.3.0 -- prefix: /usr/local -- bindir: bin -- datadir: share -- docdir: share/doc/FreeCAD -- includedir: include -- libdir: lib -- cmake: 3.18.4 -- Found PythonInterp: /usr/bin/python3 (found version "3.8.5") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found suitable exact version "3.8.5") -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.55") found components: filesystem program_options regex system thread -- PyCXX found: -- Headers: /home/user/FreeCAD/src -- Sources: /home/user/FreeCAD/src/CXX -- Version: 6.2.8 CMake Error at /usr/lib/cmake/opencascade/OpenCASCADEConfig.cmake:101 (include): include could not find load file: /usr/lib/cmake/opencascade/OpenCASCADEDrawTargets.cmake Call Stack (most recent call first): cMake/FindOpenCasCade.cmake:39 (find_package) cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package) CMakeLists.txt:52 (SetupOpenCasCade) CMake Warning (dev) at /home/user/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message): The package name passed to `find_package_handle_standard_args` (OCC) does not match the name of the calling package (OpenCasCade). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern. Call Stack (most recent call first): cMake/FindOpenCasCade.cmake:120 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package) CMakeLists.txt:52 (SetupOpenCasCade) This warning is for project developers. Use -Wno-dev to suppress it. -- -- Found OCE/OpenCASCADE version: 7.5.1 -- -- OCE/OpenCASCADE include directory: /usr/include/opencascade -- -- OCE/OpenCASCADE shared libraries directory: /usr/lib/x86_64-linux-gnu -- The imported target "vtkParseOGLExt" references the file "/usr/bin/vtkParseOGLExt-7.1" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- The imported target "vtkRenderingPythonTkWidgets" references the file "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- The imported target "vtk" references the file "/usr/bin/vtk" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- The imported target "pvtk" references the file "/usr/bin/pvtk" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake" but not all the files it references. -- VTK components: vtkCommonCore;vtkCommonDataModel;vtkFiltersVerdict;vtkIOXML;vtkFiltersCore;vtkFiltersGeneral;vtkIOLegacy;vtkFiltersExtraction;vtkFiltersSources;vtkFiltersGeometry;vtkIOMPIParallel;vtkParallelMPI;vtkhdf5;vtkFiltersParallelDIY2;vtkRenderingCore;vtkInteractionStyle;vtkRenderingFreeType;vtkRenderingOpenGL2 -- Check for medfile (libmed and libmedc) ... -- We guess that libmed was built using hdf5-openmpi version -- Found Netgen: /usr/lib/cmake/netgen -- Found NETGEN version 6.2, calculated: 393728 -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Checking for module 'Coin' -- Found Coin, version 4.0.1 -- Coin3D libraries found -- Shiboken2Config: Using default python: .cpython-38-x86_64-linux-gnu -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.5", minimum required is "3") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found suitable version "3.8.5", minimum required is "3") -- SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: '/usr/include/python3.8' -- SHIBOKEN_PYTHON_LIBRARIES computed to value: '' -- libshiboken built for RelWithDebInfo -- PYTHON_CONFIG_SUFFIX: .cpython-38-x86_64-linux-gnu -- libshiboken built for RelWithDebInfo -- =============================================== PySide2 Python module found at /usr/lib/python3/dist-packages/PySide2. =============================================== -- -- matplotlib-3.1.2 has been found. -- Platform is 64-bit, set -D_OCC64 -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- Performing Test _flag_found -- Performing Test _flag_found - Success -- setting gcc options: -Wall -Werror -Wno-deprecated -pedantic-errors -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: python38 -- found Boost: 1_71 -- boost-incude dirs are: /usr/include -- boost-python lib is: -- boost_LIBRARY_DIRS is: /usr/lib/x86_64-linux-gnu -- Boost_LIBRARIES is: Boost::python -- area module (for Path Workbench) will be installed to: lib -- Coin3D doc is not installed -- ============== Summary report ============== -- Build type: Release -- Compiler: /usr/bin/c++ (9.3.0) -- Flags: -Wall -Wextra -Wno-write-strings -- Standard: Requires C++11 -- Python: 3.8.5 [/usr/bin/python3] [.cpython-38-x86_64-linux-gnu] -- PCL: not enabled -- pybind11: not enabled -- Boost: 1.71.0 (1.71.0) -- XercesC: 3.2.2 [/usr/lib/x86_64-linux-gnu/libxerces-c.so] [/usr/include] -- ZLIB: 1.2.11 -- PyCXX: 6.2.8 [/home/user/FreeCAD/src] -- OCC: 7.5.1 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/usr/lib/x86_64-linux-gnu] [/usr/include/opencascade] -- SMESH: build internal -- MEDFile: 4.0.0 [/usr/lib/x86_64-linux-gnu/libmedC.so] [/usr/include] -- HDF5: 1.10.4 -- VTK: 7.1.1 -- NETGEN: 6.2.0 (6.2-dev) [-DNO_PARALLEL_THREADS;-DOCCGEOMETRY;-DNETGEN_VERSION=393728] [] [/usr/include/netgen/include;/usr/include/netgen] [nglib] [/usr/include/netgen/include;/usr/include/netgen] -- SWIG: 4.0.1 -- Eigen3 3.3.7 -- Qt5Core: 5.12.8 -- Qt5Network: 5.12.8 -- Qt5Xml: 5.12.8 -- Qt5XmlPatterns: 5.12.8 -- Qt5Widgets: 5.12.8 -- Qt5PrintSupport: 5.12.8 -- Qt5OpenGL: 5.12.8 -- Qt5Svg: 5.12.8 -- Qt5UiTools: 5.12.8 -- Qt5Concurrent: 5.12.8 -- Qt5WebKitWidgets: 5.212.0 -- Shiboken2: 5.14.0 [/usr/lib/x86_64-linux-gnu/cmake/Shiboken2-5.14.0] [/usr/include/shiboken2;/usr/include/python3.8] -- PySide2: 5.14.0 [/usr/lib/../include/PySide2] -- PySide2Tools: [/usr/local/bin/pyside2-uic] [/usr/local/bin/pyside2-rcc] -- Freetype: 2.10.1 -- 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] -- Matplotlib: 3.1.2 -- Rift: not enabled (BUILD_VR) -- Doxygen: 1.8.17 -- Language: English -- Coin3D_DOC: not found ================================================= Now run 'cmake --build /home/user/fc-build/Release' to build FreeCAD ================================================= -- Configuring incomplete, errors occurred! See also "/home/user/fc-build/Release/CMakeFiles/CMakeOutput.log". See also "/home/user/fc-build/Release/CMakeFiles/CMakeError.log". ```
CMakeError.log ``` Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /home/user/fc-build/Release/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_83012/fast && /usr/bin/make -f CMakeFiles/cmTC_83012.dir/build.make CMakeFiles/cmTC_83012.dir/build make[1]: Entering directory '/home/user/fc-build/Release/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_83012.dir/src.c.o /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_83012.dir/src.c.o -c /home/user/fc-build/Release/CMakeFiles/CMakeTmp/src.c Linking C executable cmTC_83012 /home/user/.local/lib/python3.8/site-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/cmTC_83012.dir/link.txt --verbose=1 /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD CMakeFiles/cmTC_83012.dir/src.c.o -o cmTC_83012 /usr/bin/ld: CMakeFiles/cmTC_83012.dir/src.c.o: in function `main': src.c:(.text+0x46): undefined reference to `pthread_create' /usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach' /usr/bin/ld: src.c:(.text+0x5e): undefined reference to `pthread_cancel' /usr/bin/ld: src.c:(.text+0x6f): undefined reference to `pthread_join' collect2: error: ld returned 1 exit status make[1]: *** [CMakeFiles/cmTC_83012.dir/build.make:106: cmTC_83012] Error 1 make[1]: Leaving directory '/home/user/fc-build/Release/CMakeFiles/CMakeTmp' make: *** [Makefile:140: cmTC_83012/fast] Error 2 Source file was: #include void* test_func(void* data) { return data; } int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); pthread_cancel(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL); return 0; } Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/user/fc-build/Release/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_16615/fast && /usr/bin/make -f CMakeFiles/cmTC_16615.dir/build.make CMakeFiles/cmTC_16615.dir/build make[1]: Entering directory '/home/user/fc-build/Release/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_16615.dir/CheckFunctionExists.c.o /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_16615.dir/CheckFunctionExists.c.o -c /home/user/.local/lib/python3.8/site-packages/cmake/data/share/cmake-3.18/Modules/CheckFunctionExists.c Linking C executable cmTC_16615 /home/user/.local/lib/python3.8/site-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/cmTC_16615.dir/link.txt --verbose=1 /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_16615.dir/CheckFunctionExists.c.o -o cmTC_16615 -lpthreads /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status make[1]: *** [CMakeFiles/cmTC_16615.dir/build.make:106: cmTC_16615] Error 1 make[1]: Leaving directory '/home/user/fc-build/Release/CMakeFiles/CMakeTmp' make: *** [Makefile:140: cmTC_16615/fast] Error 2 ```
ceremcem commented 3 years ago

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:

  1. Edit the fc4-config.sh accordingly
  2. Run in chroot: ./run-in-chroot.sh fc4-config.sh

FreeCAD should run with your user settings and you can reach your files by those mounts folders.

wohltat commented 3 years ago

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.

wohltat commented 3 years ago

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 image

ceremcem commented 3 years ago

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.

wohltat commented 3 years ago

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.

ceremcem commented 3 years ago

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

ceremcem commented 3 years ago

@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.

wohltat commented 3 years ago

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)
...
ceremcem commented 3 years ago

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.

wohltat commented 3 years ago

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?

ceremcem commented 3 years ago

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?

wohltat commented 3 years ago

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?

ceremcem commented 3 years ago

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.