Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppImage issue & crash with RealThunder fork #456

Open
ysard opened this issue Oct 14, 2024 · 9 comments
Open

AppImage issue & crash with RealThunder fork #456

ysard opened this issue Oct 14, 2024 · 9 comments

Comments

@ysard
Copy link
Contributor

ysard commented Oct 14, 2024

Hi, I've noticed that rendering engines may require different libraries from those embedded in the AppImage (libatk-bridge-2.0.so.0 for LuxCore, for example).
In this case, the LD_LIBRARY_PATH variable must be specified at runtime.
A wrapper such as this one works very well, and all you need to do is specify its path instead of that of the luxcoreui binary:

#!/bin/bash
LUXCORE_BIN=$(readlink -f $(dirname $0))
LUXCORE_LIB=/lib/x86_64-linux-gnu/
export LD_LIBRARY_PATH=$LUXCORE_LIB:$LD_LIBRARY_PATH
$LUXCORE_BIN/luxcoreui "$@"

It's a problem that can be very confusing for new users, yet it's easily corrected. I think a note on this should be included in the documentation.
It's a subject already covered (but discovered after quite some time) here: #159


Also, RealThunder crashes with a segfault shortly after workbench selection (even without any project opened).

Tested with the “20241003” version

Here's the log (although not very informative?):

Msg: FreeCAD 0.21.0, Libs: 2024.1006.0R14555 (Git shallow)
Log: Time = 2024-Oct-14 17:09:56
Log: AboutImage = freecad_link_splash.png
Log: AppDataSkipVendor = true
Log: AppHomePath = /tmp/.mount_FreeCAcC15Ox/usr/
Log: AppIcon = freecad
Log: AppTempPath = /tmp/
Log: Application = FreeCAD Link Branch
Log: BOOST_VERSION = 1_84
Log: BinPath = /tmp/.mount_FreeCAcC15Ox/usr/bin/
Log: BuildRepositoryURL = Unknown
Log: BuildRevision = 14555 (Git shallow)
Log: BuildRevisionBranch = (HEAD detached at 20241003stable)
Log: BuildRevisionDate = 20241006
Log: BuildRevisionHash = a9810d509a6f112b5ac03d4d4831b67e6bffd5b7
Log: BuildVersionMajor = 2024
Log: BuildVersionMinor = 1006
Log: BuildVersionPoint = 0
Log: Console = 0
Log: CopyrightInfo = 
Log: Debug = 0
Log: DocPath = /tmp/.mount_FreeCAcC15Ox/usr/doc/
Log: EIGEN_VERSION = 3.4.0
Log: ExeName = FreeCAD
Log: ExeVendor = FreeCAD
Log: ExeVersion = 0.21.0
Log: IssuePage = https://github.com/realthunder/FreeCAD/issues
Log: LoggingConsole = 1
Log: LoggingFile = 1
Log: LoggingFileName = /tmp/log.log
Log: MaintainerUrl = https://github.com/realthunder/FreeCAD
Log: OCC_VERSION = 7.7.2
Log: PATH = /tmp/.mount_FreeCAcC15Ox/usr/bin:/home/<User>/.local/bin:/home/<User>/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/<User>/.dotnet/tools:/home/<User>/.platformio/penv/bin:/usr/local/cuda/bin
Log: PYSIDE_VERSION = 5.15.8
Log: PYTHONHOME = /tmp/.mount_FreeCAcC15Ox/usr
Log: PYTHONPATH = 
Log: PYTHON_VERSION = 3.11.9
Log: PythonSearchPath = /tmp/.mount_FreeCAcC15Ox/usr/lib/python311.zip:/tmp/.mount_FreeCAcC15Ox/usr/lib/python3.11:/tmp/.mount_FreeCAcC15Ox/usr/lib/python3.11/lib-dynload
Log: QT_VERSION = 5.15.13
Log: RunMode = Gui
Log: SMESH_VERSION = 9.8.0.2
Log: SplashAlignment = Bottom|Left
Log: SplashGif = freecad_link_logo.gif
Log: SplashInfoColor = #101010
Log: SplashInfoExeName = FreeCAD Link Branch
Log: SplashInfoPosition = 12 38
Log: SplashInfoVersion = 2024.10.06
Log: SplashScreen = freecad_link_splash.png
Log: SplashTextColor = #000000
Log: StartWorkbench = StartWorkbench

...

Log: [Render][Init] Starting Render initialization
Log: [Render][Init] Importing 'Assembly3'
Log: [Render][Init] Importing 'Assembly3'... done
Log: Loading MeshPart module... done
Log: Loading Mesh module... done
Msg: [Render][Init] Checking dependencies...
Log: [Render][Init] Checking Render virtual environment
Log: [Render][Init] >>> Environment folder exists: OK
Log: [Render][Init] >>> Environment provides Python: OK
Log: [Render][Init] >>> Environment provides Pip: OK
Log: [Render][Init] >>> /home/<User>/.local/share/FreeCAD/.rendervenv/bin/python -u -m pip install --no-warn-script-location --only-binary=:all: --upgrade --find-links=/home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse PyQt6
Log: [Render][Init] >>> /home/<User>/.local/share/FreeCAD/.rendervenv/bin/python -u -m pip install --no-warn-script-location --only-binary=:all: --upgrade --find-links=/home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse PyQt6-WebEngine
Log: [Render][Init] >>> /home/<User>/.local/share/FreeCAD/.rendervenv/bin/python -u -m pip install --no-warn-script-location --only-binary=:all: --upgrade --find-links=/home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse -I renderplugin
Log: [Render][Init] >>> /home/<User>/.local/share/FreeCAD/.rendervenv/bin/python -u -m pip install --no-warn-script-location --only-binary=:all: --upgrade --find-links=/home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse QtPy
Log: [Render][Init] >>> Looking in links: /home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse
Log: [Render][Init] >>> Requirement already satisfied: QtPy in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (2.4.1)
Log: [Render][Init] >>> Looking in links: /home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse
Log: [Render][Init] >>> Requirement already satisfied: PyQt6 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (6.7.1)
Log: [Render][Init] >>> Looking in links: /home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse
Log: [Render][Init] >>> Looking in links: /home/<User>/.local/share/FreeCAD/Mod/Render/./wheelhouse
Log: [Render][Init] >>> Requirement already satisfied: PyQt6-WebEngine in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (6.7.0)
Log: [Render][Init] >>> Requirement already satisfied: PyQt6-sip<14,>=13.8 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from PyQt6) (13.8.0)
Log: [Render][Init] >>> Requirement already satisfied: PyQt6-Qt6<6.8.0,>=6.7.0 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from PyQt6) (6.7.3)
Log: [Render][Init] >>> Requirement already satisfied: packaging in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from QtPy) (24.1)
Log: [Render][Init] >>> Processing /home/<User>/.local/share/FreeCAD/Mod/Render/wheelhouse/renderplugin-0.0.1-py2.py3-none-any.whl
Log: [Render][Init] >>> Requirement already satisfied: PyQt6-sip<14,>=13.6 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from PyQt6-WebEngine) (13.8.0)
Log: [Render][Init] >>> Requirement already satisfied: PyQt6-WebEngine-Qt6<6.8.0,>=6.7.0 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from PyQt6-WebEngine) (6.7.3)
Log: [Render][Init] >>> Requirement already satisfied: PyQt6>=6.2.0 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from PyQt6-WebEngine) (6.7.1)
Log: [Render][Init] >>> Requirement already satisfied: PyQt6-Qt6<6.8.0,>=6.7.0 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from PyQt6>=6.2.0->PyQt6-WebEngine) (6.7.3)
Log: [Render][Init] >>> Requirement already satisfied: PyQt6-WebEngineSubwheel-Qt6==6.7.3 in /home/<User>/.local/share/FreeCAD/.rendervenv/lib/python3.11/site-packages (from PyQt6-WebEngine-Qt6<6.8.0,>=6.7.0->PyQt6-WebEngine) (6.7.3)
Msg: [Render][Init] Checking package 'QtPy' - OK
Wrn: QObject::killTimer: Timers cannot be stopped from another thread
Wrn: QObject::~QObject: Timers cannot be stopped from another thread
Msg: [Render][Init] Checking package 'PyQt6' - OK
Wrn: QObject::killTimer: Timers cannot be stopped from another thread
Wrn: QObject::~QObject: Timers cannot be stopped from another thread
Log: [Render][Init] >>> Installing collected packages: renderplugin
Log: [Render][Init] >>> Successfully installed renderplugin-0.0.1
Msg: [Render][Init] Checking package 'renderplugin' - OK
Wrn: QObject::killTimer: Timers cannot be stopped from another thread
Wrn: QObject::~QObject: Timers cannot be stopped from another thread
Msg: [Render][Init] Checking package 'PyQt6-WebEngine' - OK
Wrn: QObject::killTimer: Timers cannot be stopped from another thread
Wrn: QObject::~QObject: Timers cannot be stopped from another thread
Log: [Render][Init] Render virtual environment: OK
Msg: [Render][Init] Done.
Log: Loading Render module... done
Err: Program received signal SIGSEGV, Segmentation fault.
Err: #0  /lib/x86_64-linux-gnu/libc.so.6(+0x3d580) [0x7f218a858580]
Err: #1  0x7f218b0b6a94 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/libQt5Core.so.5+0x74
Err: #2  0x7f218b109f51 in QTimerInfoList::activateTimers() from /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/libQt5Core.so.5+0x381
Err: #3  /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/libQt5Core.so.5(+0x30a724) [0x7f218b10a724]
Err: #4  /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/./libglib-2.0.so.0(+0x5bad7) [0x7f2189110ad7]
Err: #5  /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/./libglib-2.0.so.0(+0x5eac7) [0x7f2189113ac7]
Err: #6  /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_iteration+0x2e) [0x7f21891140ce]
Err: #7  0x7f218b10aa36 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/libQt5Core.so.5+0x66
Err: #8  0x7f218b0b570b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/libQt5Core.so.5+0x11b
Err: #9  0x7f218b0bd212 in QCoreApplication::exec() from /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/libQt5Core.so.5+0x82
Err: #10  0x7f218d98f076 in Gui::Application::runApplication() from /tmp/.mount_FreeCAcC15Ox/usr/bin/../lib/libFreeCADGui.so+0x4b6
Err: #11  ./FreeCADLink(+0x780b) [0x5643dee4080b]
Err: #12  /lib/x86_64-linux-gnu/libc.so.6(+0x27c8a) [0x7f218a842c8a]
Err: #13  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f218a842d45]
Err: #14  ./FreeCADLink(+0x7be1) [0x5643dee40be1]
@howetuft
Copy link
Collaborator

Hello,

Thank you very much for your report!
The LD_LIBRARY_PATH trick is mentioned in the FAQ in the README. However, your wrapper suggestion is more complete, so I've updated the README: https://github.com/FreeCAD/FreeCAD-render?tab=readme-ov-file#faq
This is my own wording, but it could undoubtedly be improved: please feel free to propose PR - it's just markdown!

For the crash, I must think a bit...

@howetuft
Copy link
Collaborator

howetuft commented Oct 14, 2024

(continued)
I've removed a piece of code (status display) that I'm not sure about. However, I don't have an AppImage installed: could you please test it yourself? Thank you!

Edit: the code is fixed in the master, you just have to update the workbench with the addon manager.

@ysard
Copy link
Contributor Author

ysard commented Oct 14, 2024

Oh, I'm so sorry, I was so focused on the installation tutorial that I didn't think to go back to the readme...

Ok fantastic, the addon launches correctly in both FreeCad and its fork.

After that I had the following error in the console (when rendering the project with luxcore):

    22:51:39  GLFW Error: 65544
    22:51:39  Description: Linux: Failed to initialize inotify: Too many open files

Fixed according to this post:
https://stackoverflow.com/questions/32281277/too-many-open-files-failed-to-initialize-inotify-the-user-limit-on-the-total

    # 128 to 256:
    echo 256 | sudo tee /proc/sys/fs/inotify/max_user_instances 

Now it's my CUDA installation that's incorrect, but that's no longer a matter for your addon :p

Thanks!

@howetuft
Copy link
Collaborator

Oh, I'm so sorry, I was so focused on the installation tutorial that I didn't think to go back to the readme...

Don't apologize, it means that it lacks a mention of it in the install tuto: would you mind adding that mention where you consider it should appear (with a PR)?

@ysard
Copy link
Contributor Author

ysard commented Oct 15, 2024

I've added 2 links to the relevant sections.

I also have a few other remarks from use, I can open other issues but for the moment I'm centralizing them here.

  • Settings:

    • Rendering width/height options are not systematically updated in the Project.cfg file.
      For example, if I specify 1920 and 1080, I get in this file:

            film.width = 800
            film.height = 600
      

      Sometimes the right values are inserted, but I haven't found a reproducible way.
      I assume you are better able to correct this problem.

  • Camera:

    • The camera position in the GUI doesn't seem to be updated when changing the attributes FarDistance/NearDistance attributes.

      The attributes are also not updated when you use FreeCAD's “Right-click / Transform” function to move the camera object.

    • Also, once a camera has been placed, the GUI view (angle, zoom, etc.) continues to influence the final scene.
      the final scene, whereas I thought the Camera was a fixed point in space independent
      of the GUI.

    • The link in the Camera doc is dead:
      https://developer.openinventor.com/UserGuides/Oiv9/Inventor_Mentor/Cameras_and_Lights/Cameras.html

  • Luxcore (again):

    • Compilation time;
      Kernels are apparently compiled in 2 stages (Base + Film modules),
      the first takes ~3min, the second takes ~55min in my case.

      My graphics card is old (670MX) but it's worth noting that it's “normal” that
      on older configurations an hour-long compilation is possible at first launch.

    • Rendering options; According to the doc:
      If you use LuxCore with OpenCL Render Engines, ie PATHOCL, RTPATHOCL or TILEPATHOCL, LuxCore will have to compile the associated GPU kernels.

      In fact, if the GPU is detected as CUDA-compatible, there are 3 devices
      used for rendering: OpenCL GPU, OpenCL CPU, CUDA GPU (in that order, this is important for later).

      Compilation will take place for CUDA cores even if PATHCPU is active.

      However, if the CUDA installation is not functional (GPU driver not synchronized with the expected Cuda Toolkit version),
      then the process will fail with the following error:

        nvrtc: error: invalid value for --gpu-architecture (-arch)`
      

      On my system, NVIDIA support ended in 2020.
      I have almost no chance of getting my CUDA cores to work on my recent distribution (thanks).

      So I have to select the devices involved in the calculation by adding configuration lines
      to the Project.cfg file using the wrapper we've talked above:

        cat >> "$2" << EOL
      
        # default
        opencl.gpu.use = 1
        # default
        opencl.cpu.use = 1
        # disable CUDA cores (GPU_OCL, CPU_OCL, GPU_CUDA)
        opencl.devices.select = 110
        # disable Nvidia OptiX denoiser
        cuda.optix.devices.select = 000
        film.opencl.enable = 1
        # Use the first device (GPU_OCL)
        film.opencl.device = 0
        EOL
      

      Documentation of this settings: https://wiki.luxcorerender.org/LuxCore_SDL_Reference_Manual_v2.6

  • Color export of faces

    • If you take an object on which faces have been colored (right-click on the Body / Define colors, then select a color and the faces concerned), the colors are not retained in the final export.

      Ex:
      before_after_small

EDIT: add color problem

@howetuft
Copy link
Collaborator

Many questions! I'll answer some of them now and the rest later...

The camera position in the GUI doesn't seem to be updated when changing the attributes FarDistance/NearDistance attributes.

The attributes are also not updated when you use FreeCAD's “Right-click / Transform” function to move the camera object.

Why should the camera position be updated? Near and Far Distances are just related to clipping, not to position...

Also, once a camera has been placed, the GUI view (angle, zoom, etc.) continues to influence the final scene.
the final scene, whereas I thought the Camera was a fixed point in space independent
of the GUI.

Did you add a View of your camera to your rendering project? Otherwise, the camera won't have any effect on your rendering...

So I have to select the devices involved in the calculation by adding configuration lines
to the Project.cfg file using the wrapper we've talked above:

Very smart, I think your approach deserves to be shared, if you want to add something to doc again...

Color export of faces

I'll try to have a look, but color management in FreeCAD is a mess (many different color settings, transparency not standard etc.), so it may not be fully successful.

@ysard
Copy link
Contributor Author

ysard commented Oct 16, 2024

Hi, thanks for your answers.

  • Understood about the cameras. I missed the "attach to view" part of the tutorial... The transform tool modifies the scene well now.
  • For the width/height options, I missed the attributes of the Project object. I thought it was only in the Render settings. Thus an already created object is not updated.
  • Ok for face coloring; I can imagine how difficult that would be.

@howetuft
Copy link
Collaborator

For the width/height options, I missed the attributes of the Project object. I thought it was only in the Render settings. Thus an already created object is not updated.

Do you think I should remove those options from settings, and leave only the parameters in the Project object?

@ysard
Copy link
Contributor Author

ysard commented Oct 16, 2024

Do you think I should remove those options from settings, and leave only the parameters in the Project object?

No I don't think so, modifying properties is the way FreeCAD works.
I suppose that It's a beginner problem here.

BTW, I managed to get CUDA working on my platform. LuxCore 2.6 embeds versions 11.x of the libnvrtc libnvrtc-builtins libraries.
Their changelog for version 2.4 shows CUDA 10.2 compatibility, but subsequent changelogs have not mentioned the switch to version 11.x, while NVIDIA has removed support for Kepler architectures (Compute Compatibility 3.0) for the versions 11.x.
Binaries remain compatible, but the compiler refuses to accept the architecture.
This is a compiler flag that has simply been removed, making my machine artificially less “efficient” than it was 4 years ago...

I will write some lines about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants