Trying to compile CasparCG Server for Linux - Several dependencies issues

I try to compile CasparCG Server for Gentoo Linux and I have run into several seemingly unrelated issues. However, the amount of issues makes me wonder, if something is completely wrong. I downloaded the latest source code release 2.4.3 as a tarball as of Feb 26th, 2025. I have not used the head of the GIT master branch.

  1. Dependency on boost/filesystem/convenience.hpp: I cannot compile CasparCG Server release 2.4.3 as it tries to include boost/filesystem/convenience.hpp which is long gone from Boost and is ancient. The source file src/common/stdafx.h from the tarball includes this Boost header in line 36. However, when I inspect that file on GIThub the last commit to this file is 8 years ago and the Boost header is not included.
    What is going on here? The GIThub source code correctly does not include that header for the last eight 8 years, but a recently published release does it?!
  2. Calling boost::lexical_cast: The source file src/common/log.cpp line 118 calls boost::lexical_cast, but does not include the necessary header lexical_cast.hpp. That header file became part of Boost 25 years ago. In computer terms, those are the medieval times. Again, what is going on here?

Probably, there will be more of those errors, when I am going to proceed, but I have to fix one compilation error at a time. However, I believe I am clearly missing something here. Has anybody been able to successfully compile CasparCG from the published released tarball? Or is this tarball just completely broken?

  1. What does ENABLE_HTML do and what is the CEF library? What does CEF stand for and how does it relate to ENABLE_HTML? If I use the build time defaults with ENABLE_HTML=ON and USE_SYSTEM_CEF=OFF, then the build scripts attempt do download additional source files themselves which Gentoo does not allow due to sand boxing. For now, I am going with ENABLE_HTML=OFF, but I don’t know what I am missing. I would rather like to use ENABLE_HTML=ON in combination with USE_SYSTEM_CEF=ON, but this requires me to compile that ominous CEF library from sources first. Where do I find it?
  1. This sounds like a combination of issues.
    The precompiled header files are likely a bit stale in their content, I have not found a workflow to keep them up to date with what is actually needed, so things often only get removed once it causes a build error.
    It looks like that header file went away in boost 1.85, and a patch was submitted to fix support for it fix: boost 1.85/1.86 (#1584) ¡ CasparCG/server@8c84357 ¡ GitHub, which did not land in 2.4.3, so will not be fixed in the tarball you are building.
    The main build targets for us are Ubuntu LTS, so our expectations for library versions is pretty old..

  2. This is probably a similar issue, that header was likely being pulled in via one of the other headers for the versions of boost we have tested building against. And noone has reported an issue around this so we haven’t known to fix it.

As you are building on Gentoo which is much more bleeding edge for library versions than we usually test against (I do sometimes dev on fedora, so a bit less ancient), you will likely find numerous issues before we do. Please do submit pull requests which fix these, we are happy to accept them. There have been a bunch in the past (typically boost compilation fixes) from the maintainers of the arch package AUR (en) - casparcg-server

  1. CEF is ‘Chromium Embedded Framework’ (Bitbucket), the HTML engine we use. From the little I know about Gentoo (it builds everything locally?), supporting that may not be viable.
    We use the official prebuilt binaries from CEF Automated Builds (mirrored elsewhere to ensure availability), and have a naive process of using a version installed to system paths, intended to be provided by a deb repacking we do of those prebuilt binaries.
    Be aware that compiling CEF from source typically takes multiple hours.

Let’s postpone issue 3 for the time being. After I know that CEF stands for “Chromium Embedded Framework”, I am going to look into that later. Maybe Gentoo has already a package for that. I am going to check that out.

I have been able to fix the compilation errors by applying to patch files locally. One of them is the fix: boost 1.85/1.86 (#1584). Thank you for the pointer. The other patch is even more trivial, it only adds some missing headers to the appropriate source files.

Patch which adds one missing header to each out of four source files
diff -ur a/common/filesystem.cpp b/common/filesystem.cpp
--- a/common/filesystem.cpp     2025-02-26 17:19:21.000000000 +0100
+++ b/common/filesystem.cpp     2025-04-22 19:24:09.239048365 +0200
@@ -26,6 +26,7 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/path.hpp>
+#include <boost/filesystem/directory.hpp>
 
 namespace caspar {
 
diff -ur a/common/log.cpp b/common/log.cpp
--- a/common/log.cpp    2025-02-26 17:19:21.000000000 +0100
+++ b/common/log.cpp    2025-04-22 19:33:03.111473653 +0200
@@ -26,6 +26,7 @@
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/core/null_deleter.hpp>
 #include <boost/filesystem/operations.hpp>
+#include <boost/lexical_cast.hpp>
 #include <boost/locale.hpp>
 #include <boost/log/attributes/function.hpp>
 #include <boost/log/core.hpp>
diff -ur a/modules/decklink/consumer/config.h b/modules/decklink/consumer/config.h
--- a/modules/decklink/consumer/config.h        2025-02-26 17:19:21.000000000 +0100
+++ b/modules/decklink/consumer/config.h        2025-04-22 19:51:01.990662754 +0200
@@ -21,6 +21,7 @@
 
 #pragma once
 
+#include <boost/property_tree/ptree.hpp>
 #include <core/video_format.h>
 
 namespace caspar { namespace decklink {
@@ -101,4 +102,4 @@
 configuration parse_amcp_config(const std::vector<std::wstring>&     params,
                                 const core::video_format_repository& format_repository);
 
-}} // namespace caspar::decklink
\ Kein Zeilenumbruch am Dateiende.
+}} // namespace caspar::decklink
diff -ur a/modules/ffmpeg/consumer/ffmpeg_consumer.cpp b/modules/ffmpeg/consumer/ffmpeg_consumer.cpp
--- a/modules/ffmpeg/consumer/ffmpeg_consumer.cpp       2025-02-26 17:19:21.000000000 +0100
+++ b/modules/ffmpeg/consumer/ffmpeg_consumer.cpp       2025-04-22 19:43:38.374445458 +0200
@@ -73,6 +73,7 @@
 #include <tbb/parallel_invoke.h>
 
 #include <memory>
+#include <optional>
 #include <thread>
 
 namespace caspar { namespace ffmpeg {

So, compilation phase succeeds now, but linking phase fails. I paste the entire error here, maybe someone can make some sense out of it

Linking error
FAILED: shell/casparcg 
: && /usr/bin/x86_64-pc-linux-gnu-g++ -O2 -march=znver3 -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=512 -pipe -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs     -Wl,--dependency-file=shell/CMakeFiles/casparcg.dir/link.d shell/CMakeFiles/casparcg.dir/main.cpp.o shell/CMakeFiles/casparcg.dir/server.cpp.o shell/CMakeFiles/casparcg.dir/linux_specific.cpp.o -o shell/casparcg  -Wl,-rpath,/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/protocol:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/image:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/oal:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/decklink:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/screen:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/newtek:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/artnet:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/accelerator:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/ffmpeg:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/core:/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/common  protocol/libprotocol.so  modules/image/libimage.so  modules/oal/liboal.so  modules/decklink/libdecklink.so  modules/screen/libscreen.so  modules/newtek/libnewtek.so  modules/artnet/libartnet.so  /usr/lib64/libboost_system.so.1.85.0  /usr/lib64/libboost_log_setup.so.1.85.0  /usr/lib64/libboost_log.so.1.85.0  /usr/lib64/libboost_locale.so.1.85.0  /usr/lib64/libboost_regex.so.1.85.0  /usr/lib64/libboost_date_time.so.1.85.0  /usr/lib64/libboost_coroutine.so.1.85.0  /usr/lib64/libtbb.so  /usr/lib64/libsfml-graphics.so  /usr/lib64/libsfml-window.so  /usr/lib64/libsfml-system.so  /usr/lib64/libGLEW.so  /usr/lib64/libSM.so  /usr/lib64/libICE.so  /usr/lib64/libX11.so  /usr/lib64/libXext.so  -lavcodec  -lavformat  -lavutil  -lavdevice  -lavfilter  -lpostproc  -lswscale  -lswresample  -ldl  -licui18n  -licuuc  -lz  -lpthread  -lfreeimage  -lopenal  accelerator/libaccelerator.so  modules/ffmpeg/libffmpeg.so  core/libcore.so  common/libcommon.so  /usr/lib64/libboost_filesystem.so.1.85.0  /usr/lib64/libboost_atomic.so.1.85.0  /usr/lib64/libboost_thread.so.1.85.0  /usr/lib64/libboost_chrono.so.1.85.0  /usr/lib64/libboost_context.so.1.85.0  -lavcodec  -lavformat  -lavutil  -lavdevice  -lavfilter  -lpostproc  -lswscale  -lswresample  /usr/lib64/libGLX.so  /usr/lib64/libOpenGL.so && cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell && /usr/bin/cmake -E copy /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell/casparcg /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/bin/casparcg && cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell && /usr/bin/cmake -E copy /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src/shell/casparcg.config /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/casparcg.config && cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell && /usr/bin/cmake -E copy /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src/shell/liberation-fonts/LiberationMono-Regular.ttf /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/LiberationMono-Regular.ttf && cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell && /usr/bin/cmake -E copy /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src/shell/run.sh /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/run.sh
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Transform::translate(float, float)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Transformable::getTransform() const'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Transformable::~Transformable()'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::View::View()'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Font::Font()'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::operator*=(sf::Transform&, sf::Transform const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::RenderTarget::setView(sf::View const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::View::setViewport(sf::Rect<float> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Text::getLocalBounds() const'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Text::Text(sf::String const&, sf::Font const&, unsigned int)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `typeinfo for sf::Transformable'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Transformable::Transformable()'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Transformable::move(float, float)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Text::setColor(sf::Color const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Font::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::VertexArray::operator[](unsigned long)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Shape::setOutlineThickness(float)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::RectangleShape::RectangleShape(sf::Vector2<float> const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Transform::scale(float, float)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::View::setSize(float, float)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `vtable for sf::RectangleShape'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Transformable::setPosition(float, float)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::RenderStates::Default'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `vtable for sf::VertexArray'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::View::setCenter(float, float)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Font::~Font()'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `vtable for sf::Text'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::VertexArray::VertexArray(sf::PrimitiveType, unsigned long)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Shape::~Shape()'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::VertexArray::append(sf::Vertex const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::RenderTarget::draw(sf::Vertex const*, unsigned long, sf::PrimitiveType, sf::RenderStates const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Vertex::Vertex(sf::Vector2<float> const&, sf::Color const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: core/libcore.so: undefined reference to `sf::Text::setStyle(unsigned int)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

As far as I understand it, the Ninja build system calls the script src/shell/run.sh. However, I cannot make any sense out of this script. It tries to repeatedly rung the command bin/casparcg until the return value does not equal 5. That sounds odd.

But maybe the script isn’t the problem and the linking error is caused by something different.

As far as I understand it, the Ninja build system calls the script src/shell/run.sh. However, I cannot make any sense out of this script.

No, there are multiple commands on that line joined by &&. The first one is doing the linking, the rest are copying some files.

All those sf:: references are to SFML, which I can see as being referenced in the linker command, but it looks like the order of the linking is causing that to fail.
The shell project is linking with ${SFML_LIBRARIES}, even though these references are in core (I don’t know why, its always been that way and worked).

This is a strange one, as I can say that right now on Fedora 41 it is working for me with gcc and ninja. All I can suggest is maybe linking the core project with ${SFML_LIBRARIES} will resolve it, or maybe it needs some deeper fiddling with the linking order. I wouldn’t be surprised if this becomes a few different linking order issues

I did the work and formatted the command much nicer with indention of parameters, etc.

Better formatted command
FAILED: shell/casparcg:
&&
	/usr/bin/x86_64-pc-linux-gnu-g++
		-O2
		-march=znver3
		-mshstk
		--param=l1-cache-line-size=64
		--param=l1-cache-size=32
		--param=l2-cache-size=512
		-pipe
		-Wl,-O1
		-Wl,--as-needed
		-Wl,-z,pack-relative-relocs
		-Wl,--dependency-file=shell/CMakeFiles/casparcg.dir/link.d
		shell/CMakeFiles/casparcg.dir/main.cpp.o
		shell/CMakeFiles/casparcg.dir/server.cpp.o
		shell/CMakeFiles/casparcg.dir/linux_specific.cpp.o
		-o shell/casparcg
		-Wl,-rpath,\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/protocol:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/image:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/oal:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/decklink:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/screen:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/newtek:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/artnet:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/accelerator:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/modules/ffmpeg:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/core:\
			/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/common
		protocol/libprotocol.so
		modules/image/libimage.so
		modules/oal/liboal.so
		modules/decklink/libdecklink.so
		modules/screen/libscreen.so
		modules/newtek/libnewtek.so
		modules/artnet/libartnet.so
		/usr/lib64/libboost_system.so.1.85.0
		/usr/lib64/libboost_log_setup.so.1.85.0
		/usr/lib64/libboost_log.so.1.85.0
		/usr/lib64/libboost_locale.so.1.85.0
		/usr/lib64/libboost_regex.so.1.85.0
		/usr/lib64/libboost_date_time.so.1.85.0
		/usr/lib64/libboost_coroutine.so.1.85.0
		/usr/lib64/libtbb.so
		/usr/lib64/libsfml-graphics.so
		/usr/lib64/libsfml-window.so
		/usr/lib64/libsfml-system.so
		/usr/lib64/libGLEW.so
		/usr/lib64/libSM.so
		/usr/lib64/libICE.so
		/usr/lib64/libX11.so
		/usr/lib64/libXext.so
		-lavcodec
		-lavformat
		-lavutil
		-lavdevice
		-lavfilter
		-lpostproc
		-lswscale
		-lswresample
		-ldl
		-licui18n
		-licuuc
		-lz
		-lpthread
		-lfreeimage
		-lopenal
		accelerator/libaccelerator.so
		modules/ffmpeg/libffmpeg.so
		core/libcore.so
		common/libcommon.so
		/usr/lib64/libboost_filesystem.so.1.85.0
		/usr/lib64/libboost_atomic.so.1.85.0
		/usr/lib64/libboost_thread.so.1.85.0
		/usr/lib64/libboost_chrono.so.1.85.0
		/usr/lib64/libboost_context.so.1.85.0
		-lavcodec
		-lavformat
		-lavutil
		-lavdevice
		-lavfilter
		-lpostproc
		-lswscale
		-lswresample
		/usr/lib64/libGLX.so
		/usr/lib64/libOpenGL.so
&&
	cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell
&&
	/usr/bin/cmake -E copy
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell/casparcg
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/bin/casparcg
&&
	cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell
&&
	/usr/bin/cmake -E copy
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src/shell/casparcg.config
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/casparcg.config
&&
	cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell
&&
	/usr/bin/cmake -E copy
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src/shell/liberation-fonts/LiberationMono-Regular.ttf
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/LiberationMono-Regular.ttf
&&
	cd /var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/shell
&&
	/usr/bin/cmake -E copy
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src/shell/run.sh
		/var/tmp/portage/media-video/casparcg-server-2.4.3/work/server-2.4.3-stable/src_build/staging/run.sh

Probably. I know that the order matters, but I always keep forgetting which one it the correct order. (Dependencies in forward or reverse order.) However, the idea of a build system is that the build system should figure that out for you.

Good to know and yes, completely strange. I would expect this to work either always or never.

That’s really encouraging. :scream:

I think the problem is that we haven’t told it that core needs sfml, only that shell needs sfml. Also that shell needs core, which is probably why that usually works. No clue why it isn’t for you though. Maybe newer cmake made a bit of a change in the linking order? or gentoo has configured gcc/cmake to be stricter about something that affects this?

I think it will just be a case of adding ${SFML_LIBRARIES} to the link libraries of core, hopefully that is the case.

Luckily it was that easy. :partying_face: I created a pull request #1617.

1 Like

I was able to create an Ebuild script for Gentoo (but without CEF-support for HTML so far). However, the Ebuild is rather fragile due to some aspects who the current build system works right now. But this is probably another topic.

The build system does not work on fedora, right?
Do you have your own, and can you share it?

For development purposes the current build system works fine on fedora.
Until this post there hasnt been any effort into tooling to produce a build suitable for distribution to other machines.

I cannot say anything about Fedora, but the CMakeFileLists.txt works fine for Gentoo. You can use cmake to build the final binaries. (Installation, i.e. moving the binaries into their correct place on the host system, is another another story, see https://casparcgforum.org/t/questions-about-the-build-system/).

On Gentoo there have been some issues with missing included C++ headers and a linking order, but those have been fixed with recent patches. However, this had nothing to do with the build system as such. Gentoo uses rather recent version of the toolchain (GCC, ldd, etc.) and they have become more fussy about what needs to include/link what in which order.

interesting. I had a bazillion problems getting it to compile on latest fedora.

What kind of problems? Of course, you need to install all dependencies to successfully build the project. It’s not the responsibility of the build system (aka CMakeLists.txt) to do that. I bazillion problems sounds like missing dependencies.

For Debian/Ubuntu you can extract the list of packages from the script install-dependencies.sh. However, this list does not seem to be complete as it only additionally installs those packages which are not normally installed anyway. For Gentoo the (rather) complete list of packages is

# dev-cpp/tbb                  from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (TBB REQUIRED)
# >=dev-libs/boost-1.67.0:*    from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (Booost 1.67.0)
# dev-libs/icu                 from src/shell/CMakeLists.txt: target_link_libraries(casparcg ... icui18n icuuc ...)
# dev-libs/nss                 from tools/linux/install-dependencies and output of `ldd` on final executable
# media-libs/freeimage         from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (FreeImage)
# media-libs/glew              from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (GLEW)
# media-libs/libglvnd          from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (OpenGL)
# >=media-libs/libsfml-2.0.0   from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (SFML 2)
# media-libs/openal            from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (OpenAL)
# media-video/ffmpeg           from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (FFmpeg)
# sys-libs/zlib                from src/shell/CMakeLists.txt: target_link_libraries(casparcg ... z ...)
# x11-libs/libICE              from linker output
# x11-libs/libSM               from linker output
# x11-libs/libX11              from src/CMakeModules/Bootstrap_Linux.cmake: FIND_PACKAGE (X11)
# x11-libs/libXext             from linker output

I also noted where I found the hint that the package is necessary. For Fedora the packages probably have different, but similar names.

➜  build cmake --build . --parallel  
[  6%] Built target cef
[  7%] Built target bin2c
[  7%] Built target casparcg_copy_dependencies
[ 17%] Built target common
[ 35%] Built target core
[ 37%] Built target oal
[ 44%] Built target ffmpeg
[ 53%] Built target accelerator
[ 56%] Built target artnet
[ 61%] Built target image
[ 64%] Built target html
[ 79%] Built target protocol
[ 84%] Built target screen
[ 91%] Built target decklink
[ 96%] Built target newtek
[ 97%] Linking CXX executable casparcg
/usr/bin/ld: /home/joel/server-2.4.3-stable/build/_deps/ffmpeg-lib-src/ffmpeg/lib/libavcodec.a(libx264.o): in function `X264_init':
/FFmpeg-n5.1.3/libavcodec/libx264.c:980:(.text.unlikely+0xcfd): undefined reference to `x264_encoder_open_163'
/usr/bin/ld: /home/joel/server-2.4.3-stable/build/_deps/ffmpeg-lib-src/ffmpeg/lib/libavcodec.a(libx265.o): in function `libx265_encode_init_csp':
/FFmpeg-n5.1.3/libavcodec/libx265.c:699:(.text.unlikely+0x41b): undefined reference to `x265_api_get_199'
/usr/bin/ld: /FFmpeg-n5.1.3/libavcodec/libx265.c:701:(.text.unlikely+0x437): undefined reference to `x265_api_get_199'
/usr/bin/ld: /FFmpeg-n5.1.3/libavcodec/libx265.c:703:(.text.unlikely+0x453): undefined reference to `x265_api_get_199'
/usr/bin/ld: /home/joel/server-2.4.3-stable/build/_deps/ffmpeg-lib-src/ffmpeg/lib/libavcodec.a(libx265.o): in function `libx265_encode_init':
/FFmpeg-n5.1.3/libavcodec/libx265.c:132:(.text.unlikely+0x61b): undefined reference to `x265_api_get_199'
/usr/bin/ld: /FFmpeg-n5.1.3/libavcodec/libx265.c:134:(.text.unlikely+0x62b): undefined reference to `x265_api_get_199'
collect2: error: ld returned 1 exit status
gmake[2]: *** [shell/CMakeFiles/casparcg.dir/build.make:175: shell/casparcg] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:919: shell/CMakeFiles/casparcg.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

This is after already building sndio from source to fix an earlier linking problem

It works if:

cmake ../src -DUSE_SYSTEM_CEF=OFF -DUSE_SYSTEM_FFMPEG=ON 

But then running the server yields:

➜  shell ./casparcg                                                                                               
Type "q" to close application.
Logging [info] or higher severity to log/

[2025-04-27 14:51:18.403] [info]    ############################################################################
[2025-04-27 14:51:18.403] [info]    CasparCG Server is distributed by the Swedish Broadcasting Corporation (SVT)
[2025-04-27 14:51:18.403] [info]    under the GNU General Public License GPLv3 or higher.
[2025-04-27 14:51:18.403] [info]    Please see LICENSE.TXT for details.
[2025-04-27 14:51:18.403] [info]    http://www.casparcg.com/
[2025-04-27 14:51:18.403] [info]    ############################################################################
[2025-04-27 14:51:18.403] [info]    Starting CasparCG Video and Graphics Playout Server 2.4.3 N/A Stable
[2025-04-27 14:51:18.404] [info]    "/home/joel/server-2.4.3-stable/build/shell/casparcg.config":
[2025-04-27 14:51:18.404] [info]    -----------------------------------------
[2025-04-27 14:51:18.404] [info]    <?xml version="1.0" encoding="utf-8"?>
[2025-04-27 14:51:18.404] [info]    <configuration>
[2025-04-27 14:51:18.404] [info]       <paths>
[2025-04-27 14:51:18.404] [info]          <media-path>media/</media-path>
[2025-04-27 14:51:18.404] [info]          <log-path disable="false">log/</log-path>
[2025-04-27 14:51:18.404] [info]          <data-path>data/</data-path>
[2025-04-27 14:51:18.404] [info]          <template-path>template/</template-path>
[2025-04-27 14:51:18.404] [info]       </paths>
[2025-04-27 14:51:18.404] [info]       <lock-clear-phrase>secret</lock-clear-phrase>
[2025-04-27 14:51:18.404] [info]       <channels>
[2025-04-27 14:51:18.404] [info]          <channel>
[2025-04-27 14:51:18.404] [info]             <video-mode>720p5000</video-mode>
[2025-04-27 14:51:18.404] [info]             <consumers>
[2025-04-27 14:51:18.404] [info]                <screen/>
[2025-04-27 14:51:18.404] [info]                <system-audio/>
[2025-04-27 14:51:18.404] [info]             </consumers>
[2025-04-27 14:51:18.404] [info]          </channel>
[2025-04-27 14:51:18.404] [info]       </channels>
[2025-04-27 14:51:18.404] [info]       <controllers>
[2025-04-27 14:51:18.404] [info]          <tcp>
[2025-04-27 14:51:18.404] [info]             <port>5250</port>
[2025-04-27 14:51:18.404] [info]             <protocol>AMCP</protocol>
[2025-04-27 14:51:18.404] [info]          </tcp>
[2025-04-27 14:51:18.404] [info]       </controllers>
[2025-04-27 14:51:18.404] [info]       <amcp>
[2025-04-27 14:51:18.404] [info]          <media-server>
[2025-04-27 14:51:18.404] [info]             <host>localhost</host>
[2025-04-27 14:51:18.404] [info]             <port>8000</port>
[2025-04-27 14:51:18.404] [info]          </media-server>
[2025-04-27 14:51:18.404] [info]       </amcp>
[2025-04-27 14:51:18.404] [info]    </configuration>
[2025-04-27 14:51:18.404] [info]    -----------------------------------------
[2025-04-27 14:51:18.405] [info]    Initialized video modes.
[2025-04-27 14:51:18.647] [info]    Initializing OpenGL Device.
[2025-04-27 14:51:18.650] [info]    Initialized OpenGL 4.5.0 NVIDIA 570.144 NVIDIA Corporation
[2025-04-27 14:51:18.877] [info]    Initialized OpenGL Accelerated GPU Image Mixer for channel 1
[2025-04-27 14:51:18.877] [info]    video_channel[1|720p5000] Successfully Initialized.
[2025-04-27 14:51:18.878] [info]    Initialized channels.
[2025-04-27 14:51:18.878] [info]    Initialized command repository.
[2025-04-27 14:51:18.878] [info]    Initialized image module.
[2025-04-27 14:51:18.878] [info]    Initialized ffmpeg module.
[2025-04-27 14:51:18.878] [info]    Initialized oal module.
[2025-04-27 14:51:18.878] [info]    Initialized decklink module.
[2025-04-27 14:51:18.878] [info]    Initialized screen module.
[2025-04-27 14:51:18.878] [info]    Initialized newtek module.
[2025-04-27 14:51:18.878] [info]    Initialized artnet module.
[0427/145118.880046:ERROR:icu_util.cc(240)] Invalid file descriptor to ICU data received.

yeah you will need to use that. In 2.5/master it is now always ON, partly because of issues like this.

[0427/145118.880046:ERROR:icu_util.cc(240)] Invalid file descriptor to ICU data received.

I can’t explain that error, based on the format of it that is something being produced by cef. Maybe something icu related isnt installed?


I am using fedora 41, and there is a compile error in decklink_producer.cpp, simply commenting out the line makes it build, but I haven’t had a chance to test the impact of that so haven’t wanted to commit it yet.

I have probably avoided that icu error by having chromium installed, which would likely make sure the dependencies needed are installed.

Yes, got this one as well and same fix. At a loss about this icu error though…
I’m installing chromium and will report back I guess :slight_smile:

EDIT:
Already had it installed, so that wasn’t it for me.