calf-studio-gear/calf

Build with cmake: missing -lpthread

suedwestlicht opened this issue · 25 comments

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.

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?

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.

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

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

@suedwestlicht Please try again.

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

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

I cloned the repo freshly and used the main branch.

  • -lpthread missing
  • wrong links
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

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

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.

Building the pthread branch the old way produces working plugins.

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

== 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

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.

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?

Branch pthreads, build type cmake:
CMAKE_BUILD_TYPE:STRING=

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

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.

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.

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?

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

@suedwestlicht One more idea: Can you please compile in the old way, but when configuring, use ./configure --enable-debug ? How much CPU is being used in that case?

A little bit more. 58% instead of 57% – and with more and higher CPU spikes compared to the cmake debug build.

Perfect. That proves that CMake did not make it worse. I merged all relevant commits to master, so please feel free to close the issue.

But the default cmake build is a debug build. The default automake build is a release build.

I recommend making the default cmake build a release build else people will think that CALF plugins are very ressource hungry.

Good point! I fixed it in #359 and merged it to master.

Perfect.