calf-studio-gear / calf

Developers repository of Calf Studio Gear. Expect some issues when using it for production.
http://calf-studio-gear.org
GNU Lesser General Public License v2.1
678 stars 96 forks source link

Build with cmake: missing -lpthread #355

Open suedwestlicht opened 1 week ago

suedwestlicht commented 1 week ago

When I use the new cmake build system then calfjackhost cannot be linked together because of missing -lpthread.

Appending -lpthread in src/CMakeFiles/calfjackhost.dir/link.txt fixes it.

JohannesLorenz commented 1 week ago

When I use the new cmake build system then calfjackhost cannot be linked together because of missing -lpthread.

Appending -lpthread in src/CMakeFiles/calfjackhost.dir/link.txt fixes it.

@suedwestlicht Thanks a lot! Do you mind submitting a PR with the working code and add me to the list of reviewers, so I can check and merge it?

suedwestlicht commented 1 week ago

Since build/src/CMakeFiles/calfjackhost.dir/link.txt is generated by cmake and I don't have any deeper cmake knowledge I am sorry that I can't help fixing it.

JohannesLorenz commented 1 week ago

@suedwestlicht Can you please try if #356 fixes it on your system?

suedwestlicht commented 1 week ago

Nearly. The reported bug is fixed. "make" completes without errors.

But "sudo make install" gives:

-- Installing: /usr/local/share/calf/styles/Calf_Wood/side_d_nw.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/side_d_ne.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/side_d_e.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/notebook_screw.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/knob_5.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/knob_4.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/knob_3.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/knob_2.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/knob_1.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/combo_arrow.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/background_plugin.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/background_menu.png
-- Installing: /usr/local/share/calf/styles/Calf_Wood/gtk.rc
CMake Error at icons/cmake_install.cmake:118:
  Parse error.  Function missing ending ")".  End of file reached.
Call Stack (most recent call first):
  cmake_install.cmake:57 (include)

CMake Error at cmake_install.cmake:57 (include):
  include could not load requested file:

    /tmp/calf/calf/build/icons/cmake_install.cmake

make: *** [Makefile:100: install] Fehler 1
JohannesLorenz commented 1 week ago

@suedwestlicht Please try again.

suedwestlicht commented 1 week ago

It's getting better and better. No errors with "make" and "sudo make install" anymore.

But the links to calf libs go to the build directory (in my case in /tmp) instead of the lib directory:

root@regen:/usr/local/lib/lv2/calf.lv2# ls -l calf*
lrwxrwxrwx 1 root root 41 Sep 15 17:49 calflv2gui.so -> /tmp/calf/calf/build/src/libcalflv2gui.so
lrwxrwxrwx 1 root root 35 Sep 15 17:49 calf.so -> /tmp/calf/calf/build/src/libcalf.so

It should be:

root@regen:/usr/local/lib/lv2/calf.lv2# ls -l calf*
lrwxrwxrwx 1 root root 36 Sep 15 18:03 calflv2gui.so -> /usr/local/lib/calf/libcalflv2gui.so
lrwxrwxrwx 1 root root 30 Sep 15 18:03 calf.so -> /usr/local/lib/calf/libcalf.so
JohannesLorenz commented 1 week ago

@suedwestlicht I just rebased to the current master, there were a lot of changes. Can you please test again now?

suedwestlicht commented 6 days ago

I cloned the repo freshly and used the main branch.

hm@bubu:/usr/local/lib/lv2/calf.lv2$ ls -l calf*
lrwxrwxrwx 1 root root 41 Sep 16 09:49 calflv2gui.so -> /tmp/calf/calf/build/src/libcalflv2gui.so
lrwxrwxrwx 1 root root 35 Sep 16 09:49 calf.so -> /tmp/calf/calf/build/src/libcalf.so
JohannesLorenz commented 5 days ago

Sorry again. Please retry now, but please use branch pthreads (from #356).

suedwestlicht commented 4 days ago

It builds with cmake and the links are ok. But there's something wrong with the plugins, probably not with all plugins but definitely with multiband compressor. Non-mixer-xt writes error messages about the gtk2 UI that can't be opened and endless loops that are so intense that I have to switch off my computer.

Building the pthread branch the old way produces working plugins.

JohannesLorenz commented 4 days ago

Building the pthread branch the old way produces working plugins.

With "the old way", you mean using automake?

suedwestlicht commented 3 days ago
== old ==
cd calf
./autogen.sh --enable-sse
make clean
make -j`nproc`
sudo make install

== new ==
cd calf
mkdir build && cd $_
cmake -DWANT_EXPERIMENTAL=true ..
make -j`nproc`
sudo make install
suedwestlicht commented 3 days ago

I made some more tests. The new build method produces /usr/local/lib/calf/*.so that have the same libs shown by ldd as the old method.

But loading an existing .*carxp into Carla makes it use 100% CPU and the machine becomes unusable when the plugins are built with the new build method. I'll examine it further.

JohannesLorenz commented 3 days ago

One reason I could imagine would be the different CMAKE_BUILD_TYPE values - does the problem change if you switch between Debug and Release?

Your Automake (old way) build seems to be release mode (since you did not specify --enable-debug). What does grep CMAKE_BUILD_TYPE build/CMakeCache.txt say?

suedwestlicht commented 2 days ago

Branch pthreads, build type cmake: CMAKE_BUILD_TYPE:STRING=

It's unset. Shall I set it explicitely? How?

JohannesLorenz commented 2 days ago

Shall I set it explicitely? How?

Unset means a "system specific" build type is being used. You could try building once with cmake -DCMAKE_BUILD_TYPE=Debug and once with ...=Release.

suedwestlicht commented 2 days ago

I think I have sorted it out. I loaded Multiband Compressor and Multiband Limiter into Carla and determined their realtime CPU usage.

autogen: 17% cmake CMAKE_BUILD_TYPE Release: 17% cmake CMAKE_BUILD_TYPE Debug: 57% cmake CMAKE_BUILD_TYPE empty: 57%

That means that CMAKE_BUILD_TYPE should default to Release or an empty CMAKE_BUILD_TYPE should build as if was set to Release. Then automake and cmake have the same default results.

Loading my real world mastering chain into Carla with many Calf plugins simply made the Computer unusable due to high realtime CPU load when Calf plugins were build with Debug.

JohannesLorenz commented 2 days ago

Awesome, thank you!

I remember there were some debug flags which I could add to Debug build to make its CPU usage "acceptable". I try to add them now. Can you please try the updated pthreads branch in Debug mode and tell me if it got better?

suedwestlicht commented 1 day ago

Unchanged. About 57% when Carla has loaded Multiband Compressor and Multiband Limiter.