ceremcem / build-freecad-asm3

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

Compile against realthunder/coin #14

Open ceremcem opened 3 years ago

ceremcem commented 3 years ago

When "View/Draw Style/Shadow" mode is enabled, following error is seen on the console window:

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

Originally posted by @wohltat in https://github.com/ceremcem/build-freecad-asm3/issues/11#issuecomment-794123139

ceremcem commented 3 years ago

First try is not successful:

/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

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

The sun is shining and it casts shadows :) image

To install realthunders coin lib, i followed the INSTALL documentation which is pretty much the same as your script. Beforehand i removed the libcoin-dev and libcoin80c packages.

But after that i rebuild FreeCAD manually. The build.sh script is trying to install libcoin-dev (and libcoin80c). This maybe leads to some problems.

The location of the libCoin files are like so:

freecad@fc:~/fc2-build$ locate libCoin
/home/freecad/coin_build/lib/libCoin.so
/home/freecad/coin_build/lib/libCoin.so.80
/home/freecad/coin_build/lib/libCoin.so.80.0.1
/usr/lib/x86_64-linux-gnu/libCoin.so
/usr/lib/x86_64-linux-gnu/libCoin.so.4.0.0
/usr/lib/x86_64-linux-gnu/libCoin.so.80c
/usr/local/lib/libCoin.so
/usr/local/lib/libCoin.so.80

FreeCAD looks in the following directory for libCoin

freecad@fc:~/fc2-build$ sudo strace -t -e trace=file -o fc-file-access.strace -vvv -s 1024 -ff -- bin/FreeCAD report > /dev/null
freecad@fc:~/fc2-build$ grep libCoin fc-file-access.strace*
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/openmpi/lib/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "/home/freecad/fc2-build/lib/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "tls/x86_64/x86_64/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "tls/x86_64/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "tls/x86_64/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "tls/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "x86_64/x86_64/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "x86_64/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "x86_64/libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "libCoin.so.80", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fc-file-access.strace.136594:15:20:15 openat(AT_FDCWD, "/usr/local/lib/libCoin.so.80", O_RDONLY|O_CLOEXEC) = 3

Now there are just some mounting problems left.

ceremcem commented 3 years ago

Wow, great news!

Beforehand i removed the libcoin-dev and libcoin80c packages.

I think my mistake was not removing libcoin80c. However, when I compiled again, I can not find /usr/lib/x86_64-linux-gnu/libCoin.so.80c:

$ find /usr -name "libCoin*"
/usr/local/lib/libCoin.so.80.0.1
/usr/local/lib/libCoin.so.80
/usr/local/lib/libCoin.so
ceremcem commented 3 years ago

The build.sh script is trying to install libcoin-dev (and libcoin80c). This maybe leads to some problems.

Btw, you can skip using build.sh and use build-fc.sh, which will skip trying to install the dependencies listed in packages.txt.

wohltat commented 3 years ago

However, when I compiled again, I can not find /usr/lib/x86_64-linux-gnu/libCoin.so.80c

i think the libCoin.so.80c is some kind of remnant. Also the 4.0.0 is the version of the older repository lib version (libCoin.so.4.0.0). The version of the realthunder coin lib is 4.0.1.

The make install doesn't mention it. Only the following libs:

...
-- Up-to-date: /usr/local/share/Coin/scxml/navigation/plane.xml
-- Up-to-date: /usr/local/share/Coin/profiler
-- Installing: /usr/local/lib/libCoin.so.80.0.1
-- Installing: /usr/local/lib/libCoin.so.80
-- Up-to-date: /usr/local/lib/libCoin.so
-- Up-to-date: /usr/local/lib/pkgconfig/Coin.pc
-- Up-to-date: /usr/local/bin/coin-config
...
ceremcem commented 3 years ago

Did you build from scratch instead of performing an incremental build after installing realthunder's Coin?

wohltat commented 3 years ago

Yes i build FreeCAD from scratch afterwards. But i guess it should also work with incremental building, but i didn't try.

ceremcem commented 3 years ago

I tried the same compilation 3 times now (starting from same backup) and all went wrong. However, this time I also run ldconfig, and now FreeCAD launches at least.

Currently I'm getting <class 'ModuleNotFoundError'>: No module named 'pivy' error.

How come we use the same build environment (Debian Buster, right?) and the same build scripts and we get different results? What are you possibly doing something differently?

wohltat commented 3 years ago

How come we use the same build environment (Debian Buster, right?) and the same build scripts and we get different results? What are you possibly doing something differently?

Yes, it's the build environment according to your instructions, Debian Buster. I used cmake like

freecad@fc:~/fc2-build$ cmake ../FreeCAD/ -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3cmake

and then just make

I don't know what could be the reason for the difference. If you feel archeological you can try to find something in my console log: lxc_debian_freecad_build.log

ceremcem commented 3 years ago

That's very good idea to keep your entire command line history with outputs.

The only thing I didn't try is compiling from scratch. Now it's being compiled.