diff -Naur speed-dreams-code-r7818-tags-2.2.3/src/libs/tgf/linuxspec.cpp fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/libs/tgf/linuxspec.cpp
--- speed-dreams-code-r7818-tags-2.2.3/src/libs/tgf/linuxspec.cpp	2021-01-19 18:38:21.000000000 +0100
+++ fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/libs/tgf/linuxspec.cpp	2021-12-15 00:11:37.112619000 +0100
@@ -54,6 +54,12 @@
 
 #include "os.h"
 
+#if defined(__FreeBSD__)
+#include <sys/cpuset.h>
+typedef cpuset_t cpu_set_t;
+#include <pthread_np.h>
+#endif
+
 static const size_t SOFileExtLen = strlen("." DLLEXT);
 static const size_t SOPathLenMax = 1024;
 
@@ -633,7 +639,7 @@
 	{
 		
 		// MacOS X, FreeBSD, OpenBSD, NetBSD, etc ...
-#if (defined(__APPLE__) && !defined(USE_MACPORTS)) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#if (defined(__APPLE__) && !defined(USE_MACPORTS)) ||  defined(__OpenBSD__) || defined(__NetBSD__)
 		
 		nt mib[4];
 		size_t len; 
@@ -654,7 +660,7 @@
 		}
 		
 		// Linux, Solaris, AIX
-#elif defined(linux) || defined(__linux__) || defined(USE_MACPORTS)
+#elif defined(__FreeBSD__) || defined(linux) || defined(__linux__) || defined(USE_MACPORTS)
 		
 		nCPUs = (unsigned)sysconf(_SC_NPROCESSORS_ONLN);
 		
@@ -712,13 +718,13 @@
 linuxSetThreadAffinity(int nCPUId)
 {
 	// MacOS X, FreeBSD, OpenBSD, NetBSD, etc ...
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
+#if defined(__APPLE__) ||  defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
 	
 	GfLogWarning("Thread affinity not yet implemented on Mac OS X or BSD or Haiku.\n");
 	// TODO.
 	
 	// Linux, Solaris, AIX ... with NPTL (Native POSIX Threads Library)
-#elif defined(linux) || defined(__linux__)
+#elif defined(linux) || defined(__linux__) || defined(__FreeBSD__)
 	
 	// Get the handle for the current thread.
 	pthread_t hCurrThread = pthread_self();
diff -Naur speed-dreams-code-r7818-tags-2.2.3/src/libs/tgfclient/CMakeLists.txt fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/libs/tgfclient/CMakeLists.txt
--- speed-dreams-code-r7818-tags-2.2.3/src/libs/tgfclient/CMakeLists.txt	2021-04-26 21:40:21.000000000 +0200
+++ fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/libs/tgfclient/CMakeLists.txt	2021-12-18 16:46:20.134571000 +0100
@@ -126,3 +126,8 @@
 
 SD_INSTALL_FILES(INCLUDE FILES glfeatures.h guiscreen.h tgfclient.h)
 
+# To avoid 'undefined reference to glActiveTextureARB [--no-allow-shlib-undefined]'
+IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    target_link_options(tgfclient PRIVATE -Wl,--allow-shlib-undefined)
+ENDIF()
+
diff -Naur speed-dreams-code-r7818-tags-2.2.3/src/main/CMakeLists.txt fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/main/CMakeLists.txt
--- speed-dreams-code-r7818-tags-2.2.3/src/main/CMakeLists.txt	2020-03-30 07:21:39.000000000 +0200
+++ fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/main/CMakeLists.txt	2021-12-19 19:45:05.786609000 +0100
@@ -58,3 +58,10 @@
 	INCLUDE(customthirdparty)
 	SD_INSTALL_CUSTOM_3RDPARTY(${_TARGET_NAME})
 ENDIF(WIN32)
+
+# To avoid 'undefined reference to glActiveTextureARB [--no-allow-shlib-undefined]'
+IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    target_link_options(${_TARGET_NAME} PRIVATE -Wl,--allow-shlib-undefined)
+ENDIF()
+
+target_link_options(${_TARGET_NAME} PRIVATE -Wl,-E)
diff -Naur speed-dreams-code-r7818-tags-2.2.3/src/tools/menuview/CMakeLists.txt fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/tools/menuview/CMakeLists.txt
--- speed-dreams-code-r7818-tags-2.2.3/src/tools/menuview/CMakeLists.txt	2020-03-30 07:21:39.000000000 +0200
+++ fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/tools/menuview/CMakeLists.txt	2021-12-18 16:52:11.594078000 +0100
@@ -58,3 +58,8 @@
 ENDIF(UNIX)
 
 SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
+
+# To avoid 'undefined reference to glActiveTextureARB [--no-allow-shlib-undefined]'
+IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    target_link_options(${_TARGET_NAME} PRIVATE -Wl,--allow-shlib-undefined)
+ENDIF()
diff -Naur speed-dreams-code-r7818-tags-2.2.3/src/tools/trackgen/CMakeLists.txt fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/tools/trackgen/CMakeLists.txt
--- speed-dreams-code-r7818-tags-2.2.3/src/tools/trackgen/CMakeLists.txt	2020-03-30 07:21:39.000000000 +0200
+++ fbsd13.speed-dreams-code-r7818-tags-2.2.3/src/tools/trackgen/CMakeLists.txt	2021-12-18 16:53:00.384985000 +0100
@@ -63,3 +63,8 @@
 ENDIF(UNIX)
 
 SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
+
+# To avoid 'undefined reference to glActiveTextureARB [--no-allow-shlib-undefined]'
+IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    target_link_options(${_TARGET_NAME} PRIVATE -Wl,--allow-shlib-undefined)
+ENDIF()
