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

Build with cmake: missing -lpthread #355

Closed
suedwestlicht opened this issue Sep 12, 2024 · 25 comments
Closed

Build with cmake: missing -lpthread #355

suedwestlicht opened this issue Sep 12, 2024 · 25 comments

Comments

@suedwestlicht
Copy link

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
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Collaborator

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

@suedwestlicht
Copy link
Author

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
Copy link
Collaborator

@suedwestlicht Please try again.

@suedwestlicht
Copy link
Author

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
Copy link
Collaborator

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

@suedwestlicht
Copy link
Author

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

@JohannesLorenz
Copy link
Collaborator

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

@suedwestlicht
Copy link
Author

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
Copy link
Collaborator

Building the pthread branch the old way produces working plugins.

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

@suedwestlicht
Copy link
Author

== 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
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Author

Branch pthreads, build type cmake:
CMAKE_BUILD_TYPE:STRING=

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

@JohannesLorenz
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Author

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

@JohannesLorenz
Copy link
Collaborator

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

@suedwestlicht
Copy link
Author

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

@JohannesLorenz
Copy link
Collaborator

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.

@suedwestlicht
Copy link
Author

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.

@JohannesLorenz
Copy link
Collaborator

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

@suedwestlicht
Copy link
Author

Perfect.

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