Skip to content

fix: detection of Vorbis, VorbisFile and OGG in CMake for non-Windows targets#1508

Merged
mehah merged 2 commits intoopentibiabr:mainfrom
grepwood:GI-1507-fix-vorbis-detection-on-non-windows
Dec 30, 2025
Merged

fix: detection of Vorbis, VorbisFile and OGG in CMake for non-Windows targets#1508
mehah merged 2 commits intoopentibiabr:mainfrom
grepwood:GI-1507-fix-vorbis-detection-on-non-windows

Conversation

@grepwood
Copy link
Copy Markdown
Contributor

Description

Summary:
If a non-Windows target is detected by CMake, then Vorbis, VorbisFile and OGG will not be added by find_package, but by pkg_check_modules. In order to bridge the gap between these two methods in a way that doesn't break CMake later during source configuration, each library must also pass through add_library and set_target_properties.

Motivation:
I want to package OTClient for Gentoo in my own overlay because I have a personal use for it.

Context:
You'll be hard-pressed to find a Linux distribution that ships Vorbis, VorbisFile and OGG with their CMake helper files. The reason for this is that Vorbis' CMake build system is deprecated. Try to touch it with anything recent (I'm using CMake 4.1.2), and it'll result in an error with an explanation, that support for CMake 3.5 is deprecated and will be disabled soon. Depending on Vorbis' CMake infrastructure is not a sustainable strategy for package maintainers in basically every Linux distribution. If this was the only way to compile those libraries, they would find themselves unable to be used on Linux distributions that upgrade to a version of CMake that eventually drops this functionality entirely.

Dependencies:
No extra dependencies are required.

Behavior

Actual

When attempting to configure the source code of OTClient, this error will occur:

-- Enabled: ipo
-- Found Protobuf Compiler: /usr/bin/protoc
-- Use precompiled header: ON
-- Enabled: Build unity for speed up compilation
-- Disabled: asan
-- Disabled: DEBUG LOG
-- Build type: 
-- Build commit: 
-- Build revision: 
CMake Error at src/CMakeLists.txt:219 (find_package):
  Could not find a package configuration file provided by "Vorbis" with any
  of the following names:

    VorbisConfig.cmake
    vorbis-config.cmake

  Add the installation prefix of "Vorbis" to CMAKE_PREFIX_PATH or set
  "Vorbis_DIR" to a directory containing one of the above files.  If "Vorbis"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

Expected

The source configuration stage should always complete without errors.

Fixes

#1507

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested

In order to test this change, create a directory called build in the source tree, cd into it, and run cmake ... Source configuration should perform without any siginificant issues and result in a similar message as the one posted below.

-- The C compiler identification is GNU 15.2.1
-- The CXX compiler identification is GNU 15.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Enabled: ipo
-- Found Protobuf: /usr/lib64/libprotobuf.so (found version "6.31.1")
-- Found Threads: TRUE
-- Found Protobuf Compiler: /usr/bin/protoc
-- Use precompiled header: ON
-- Enabled: Build unity for speed up compilation
-- Disabled: asan
-- Disabled: DEBUG LOG
-- Build type: 
-- Build commit: 
-- Build revision: 
-- Found ZLIB: /usr/lib64/libz.so (found version "1.3.1")
-- Looking for C++ include parallel_hashmap/phmap.h
-- Looking for C++ include parallel_hashmap/phmap.h - found
-- Looking for C++ include parallel_hashmap/btree.h
-- Looking for C++ include parallel_hashmap/btree.h - found
-- Looking for lzma_auto_decoder in /usr/lib64/liblzma.so
-- Looking for lzma_auto_decoder in /usr/lib64/liblzma.so - found
-- Looking for lzma_easy_encoder in /usr/lib64/liblzma.so
-- Looking for lzma_easy_encoder in /usr/lib64/liblzma.so - found
-- Looking for lzma_lzma_preset in /usr/lib64/liblzma.so
-- Looking for lzma_lzma_preset in /usr/lib64/liblzma.so - found
-- Found LibLZMA: /usr/lib64/liblzma.so (found version "5.8.1")
-- Found nlohmann_json: /usr/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.12.0")
-- Found asio: /usr/include
-- Found OpenSSL: /usr/lib64/libcrypto.so (found suitable version "3.5.4", minimum required is "3.0.0") found components: Crypto SSL
-- Found httplib: /usr/lib64/libcpp-httplib.so.0.26.0 (found version "0.26.0")
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Checking for module 'vorbisfile'
--   Found vorbisfile, version 1.3.7
-- Checking for module 'vorbis'
--   Found vorbis, version 1.3.7
-- Checking for module 'ogg'
--   Found ogg, version 1.3.6
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:430 (message):
  The package name passed to find_package_handle_standard_args() (X11) does
  not match the name of the calling package (OpenGL).  This can lead to
  problems in calling code that expects find_package() result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindX11.cmake:684 (find_package_handle_standard_args)
  cmake/FindOpenGL.cmake:128 (INCLUDE)
  src/CMakeLists.txt:256 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found GLEW: /usr/lib64/libGLEW.so
-- Found LuaJIT: /usr/lib64/libluajit-5.1.so
-- Configuring done (4.8s)
-- Generating done (0.0s)
-- Build files have been written to: /var/tmp/otclient-4.0b3/build

The parts that specifically indicate the successful execution of this change, are as follows:

-- Checking for module 'vorbisfile'
--   Found vorbisfile, version 1.3.7
-- Checking for module 'vorbis'
--   Found vorbis, version 1.3.7
-- Checking for module 'ogg'
--   Found ogg, version 1.3.6

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings (tested only on Linux)
  • I have added tests that prove my fix is effective or that my feature works

@majestyotbr majestyotbr changed the title Fix detection of Vorbis, VorbisFile and OGG in CMake for non-Windows targets fix: detection of Vorbis, VorbisFile and OGG in CMake for non-Windows targets Dec 29, 2025
@grepwood
Copy link
Copy Markdown
Contributor Author

1771.5 wasm-ld: error: unable to find library -lvorbisfile
1771.5 wasm-ld: error: unable to find library -lvorbis
1771.5 wasm-ld: error: unable to find library -logg

This means that those libraries are not detectable via pkg-config. Is WASM really using CMake helper files to find them? If yes, in such case I should improve the condition, so that Windows and WASM continue using find_package.

@sonarqubecloud
Copy link
Copy Markdown

@mehah
Copy link
Copy Markdown
Collaborator

mehah commented Dec 30, 2025

@grepwood
is done?

@grepwood
Copy link
Copy Markdown
Contributor Author

@mehah yes, this is done :)

@mehah mehah merged commit 8b68c8b into opentibiabr:main Dec 30, 2025
9 checks passed
@mehah
Copy link
Copy Markdown
Collaborator

mehah commented Dec 30, 2025

@grepwood
8b68c8b

compile error
image

mehah added a commit that referenced this pull request Dec 30, 2025
@grepwood
Copy link
Copy Markdown
Contributor Author

@mehah what environment do I need to set up to reproduce this compilation error?

@grepwood
Copy link
Copy Markdown
Contributor Author

grepwood commented Jan 5, 2026

@mehah I can see now this is Windows. How did Windows not get caught in if(NOT WIN32 AND NOT WASM)?

grepwood added a commit to grepwood/otclient that referenced this pull request Jan 5, 2026
grepwood pushed a commit to grepwood/otclient that referenced this pull request Jan 5, 2026
libergod added a commit to gabrielew/otclient that referenced this pull request Jan 5, 2026
commit 5c276fa
Author: André Morais <andreoam@gmail.com>
Date:   Mon Jan 5 12:15:09 2026 -0300

    fix: cyclopedia map (opentibiabr#1545)

commit 62f9bb5
Author: divinity76 <hans@loltek.net>
Date:   Mon Jan 5 16:13:36 2026 +0100

    fix: remove vBot upstream version check (opentibiabr#1547)

commit b967b44
Author: Renato Machado <mehahx@gmail.com>
Date:   Sun Jan 4 20:55:57 2026 -0300

    fix(drawpool): guard against nullptr coords when batching

commit 3db1163
Author: Renato Machado <mehahx@gmail.com>
Date:   Sun Jan 4 17:16:21 2026 -0300

    fix: auto-repaint for foreground and map when shader is enabled

commit a751caf
Author: Gabriel Alcântara Bernardes <gabrielalcantaratp@gmail.com>
Date:   Sun Jan 4 10:59:31 2026 -0300

    fix: bestiary search (opentibiabr#1536)

commit 7518e6b
Author: divinity76 <hans@loltek.net>
Date:   Sat Jan 3 14:55:39 2026 +0100

    fix(vbot):  item list scroll to bottom on new entry (opentibiabr#1530)

commit 5466028
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Sat Jan 3 10:55:06 2026 -0300

    fix(vbot): typo in method name: 'hasCreature' to 'hasCreatures' (opentibiabr#1534)

commit a4bd7d4
Author: divinity76 <hans@loltek.net>
Date:   Sat Jan 3 04:26:14 2026 +0100

    fix(vbot): Expose Directions to bot sandbox (opentibiabr#1533)

    Allow doing
    ```lua
    g_game.walk(Directions.South)
    ```
    instead of
    ```lua
    g_game.walk(2)
    ```
    in cavebot waypoint Functions.

    Was in a situation where I needed the cavebot to walk exactly 1 sqm south, and the cavebot's built-in "Go To" command is not reliable for that, when you need precision walking.

commit 8f2959d
Author: Copilot <198982749+Copilot@users.noreply.github.com>
Date:   Fri Jan 2 22:04:04 2026 +0100

    fix: auto loot distance check (opentibiabr#1525)

commit 4067a07
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Fri Jan 2 16:01:03 2026 -0300

    fix: violation rule Windows length opentibiabr#1519 (opentibiabr#1522)

commit e4a07ec
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Thu Jan 1 17:02:18 2026 -0300

    rollback: UIItem onClick fix vbot issues opentibiabr#1520 (opentibiabr#1521)

commit 1e2da94
Author: Renato Machado <mehahx@gmail.com>
Date:   Tue Dec 30 19:08:27 2025 -0300

    improve: use GameDoublePlayerGoodsMoney flag instead of version check for u64 money support

commit b47799e
Author: Gabriel Alcântara Bernardes <gabrielalcantaratp@gmail.com>
Date:   Tue Dec 30 16:40:47 2025 -0300

    feat: stash stow items (opentibiabr#1480)

commit a6856e0
Author: Renato Machado <mehahx@gmail.com>
Date:   Tue Dec 30 15:43:39 2025 -0300

    Revert "fix: detection of Vorbis, VorbisFile and OGG in CMake for non-Windows targets (opentibiabr#1508)"

    This reverts commit 8b68c8b.

commit 8b68c8b
Author: grepwood <4225739+grepwood@users.noreply.github.com>
Date:   Tue Dec 30 18:30:42 2025 +0100

    fix: detection of Vorbis, VorbisFile and OGG in CMake for non-Windows targets (opentibiabr#1508)

commit 3fe17bf
Author: Renato Machado <mehahx@gmail.com>
Date:   Tue Dec 30 13:20:28 2025 -0300

    perf: parallelize draw pipeline (FOREGROUND starts collecting without waiting MAP preLoad) (opentibiabr#1510)

commit 0c17f86
Author: Renato Machado <mehahx@gmail.com>
Date:   Tue Dec 30 13:20:17 2025 -0300

    feat: add public config.ini support for client-exposed settings (opentibiabr#1513)

commit b263bc8
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Tue Dec 30 13:18:32 2025 -0300

    fix: hook flag in protobuf opentibiabr#1482 (opentibiabr#1517)

commit a43c1ca
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Tue Dec 30 13:18:17 2025 -0300

    fix: modules html opentibiabr#1505 opentibiabr#1506 (opentibiabr#1516)

commit ce858a2
Author: SkullzOTS <86809689+SkullzOTS@users.noreply.github.com>
Date:   Tue Dec 30 13:17:38 2025 -0300

    fix: android (opentibiabr#1515)

commit a7251bc
Author: André Morais <andreoam@gmail.com>
Date:   Tue Dec 30 01:30:37 2025 -0300

    fix: market value format (opentibiabr#1509)

commit 6e2c568
Author: javiertringol <javier.tringo@gmail.com>
Date:   Mon Dec 29 14:04:56 2025 -0300

    fix: opentibiabr#1501 Mouse Control Mode save (opentibiabr#1503)

commit 285a906
Author: Renato Machado <mehahx@gmail.com>
Date:   Mon Dec 29 13:01:49 2025 -0300

    perf: streamline DrawPool repaint flow and reduce hot-path overhead

    Refines the DrawPool repaint flow by simplifying canRepaint() and adjusting release() / repaint() to avoid unnecessary work. Reduces synchronization overhead by switching hot-path atomics to memory_order_relaxed (e.g. LightView, TextureAtlas), removes redundant logic in DrawPoolManager’s pre-draw flow, and makes draw-hash reset behavior more consistent.

    Results: +5.46% performance

commit 5bbc87d
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 26 23:14:30 2025 -0300

    chore: cleanup attachedEffect

commit fe99915
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 26 23:12:13 2025 -0300

    feat: add followOwner flag to the attachedEffect system so effects can follow the owner during bounce

commit ccdb09b
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 26 18:47:54 2025 -0300

    fix: don’t force creature bounce on attached effects

    Attached effects should not automatically inherit the owner’s bounce. When needed, reuse the same bounce/elevation data used by the creature. For visuals that must always stay bound to the character (e.g., wings), use the paperdoll system.

commit aafef1c
Author: Renato Machado <mehahx@gmail.com>
Date:   Wed Dec 24 13:46:36 2025 -0300

    feat: paperdoll (Ho Ho Ho!!!) (opentibiabr#1500)

commit b3bee2b
Author: Avaji <103899149+AvajiOT@users.noreply.github.com>
Date:   Tue Dec 23 14:41:31 2025 -0500

    fix: Adding datdump cpp/h to vcxproj (opentibiabr#1499)

commit 318ed83
Author: divinity76 <hans@loltek.net>
Date:   Tue Dec 23 19:18:15 2025 +0100

    feat: add dat dump cli (opentibiabr#1492)

commit 4ff2d4b
Author: divinity76 <hans@loltek.net>
Date:   Tue Dec 23 18:09:41 2025 +0100

    fix: handle floor-change tiles in walk logic (opentibiabr#1494)

commit 3442323
Author: divinity76 <hans@loltek.net>
Date:   Tue Dec 23 18:04:21 2025 +0100

    fix: f(char*) f(std::string) + replace c_str() with data() (opentibiabr#1485)

commit 0005d3e
Author: divinity76 <hans@loltek.net>
Date:   Tue Dec 23 18:04:06 2025 +0100

    fix: optimize color tolower (opentibiabr#1490)

commit 81ccbd8
Author: divinity76 <hans@loltek.net>
Date:   Tue Dec 23 18:03:48 2025 +0100

    ci/cd: fix emscripten build (opentibiabr#1491)

commit 7b132aa
Author: Luan Luciano <luanluciano@outlook.com>
Date:   Sun Dec 21 12:06:28 2025 -0300

    feat: compatibility with 15.11 (only bytes)

    Co-authored-by: kokekanon <114332266+kokekanon@users.noreply.github.com>

commit 9d485b5
Author: divinity76 <hans@loltek.net>
Date:   Sat Dec 20 02:04:21 2025 +0100

    fix: cleanup unused sha1 (opentibiabr#1486)

commit dad1f4d
Author: Renato Machado <mehahx@gmail.com>
Date:   Thu Dec 18 21:41:54 2025 -0300

    fix(localplayer): avoid forced step to next tile when overlapping passable creatures (thx @nekiro)

commit 0646982
Author: divinity76 <hans@loltek.net>
Date:   Tue Dec 16 17:06:20 2025 +0100

    fix: capacity scaling for 7.6 protocol

    Co-authored-by: kokekanon <114332266+kokekanon@users.noreply.github.com>

commit eb656a7
Author: Renato Machado <mehahx@gmail.com>
Date:   Sun Dec 7 16:07:50 2025 -0300

    fix: avoid concurrent thing texture loading with atomic flag

commit dc2ff31
Author: Renato Machado <mehahx@gmail.com>
Date:   Sun Dec 7 16:03:15 2025 -0300

    fix: rare crash on close client

commit 1d26861
Author: Renato Machado <mehahx@gmail.com>
Date:   Sat Dec 6 14:24:44 2025 -0300

    fix(hash): resolve compilation issues on x86 platforms

commit 730835a
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 5 23:33:10 2025 -0300

    fix(hud): make crosshair and attached widgets respect HUD scale (fix opentibiabr#1436)

commit 3aa478e
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 5 23:13:07 2025 -0300

    fix(draw): wait for all draw pools to finish before processing next cycle (fix opentibiabr#1472)

commit 8a0d43b
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 5 22:27:35 2025 -0300

    fix(drawpool): set repaint flag only after preparing draw objects

commit a47fdf2
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 5 22:25:03 2025 -0300

    feat(drawpool): add hash support to addAction

commit cb29a60
Author: Renato Machado <mehahx@gmail.com>
Date:   Fri Dec 5 19:51:35 2025 -0300

    fix: ThingType loading sets default boolean to false

commit 66c2ad7
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Tue Dec 2 11:04:00 2025 -0300

    fix: skill Miniwindows in Old protocol (opentibiabr#1477)

commit acc928e
Author: Renato Machado <mehahx@gmail.com>
Date:   Sun Nov 30 20:53:30 2025 -0300

    feat: add recursive loading for style files

commit 8fa1bce
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Fri Nov 28 14:42:43 2025 -0300

    fix: protocol 12.91 (opentibiabr#1478)

commit fa77ad0
Author: Renato Machado <mehahx@gmail.com>
Date:   Mon Nov 24 21:21:08 2025 -0300

    improve: use `addEvent` instead of `scheduleEvent` to trigger the `onGameStart` event

commit fc57601
Author: Renato Machado <mehahx@gmail.com>
Date:   Mon Nov 24 20:03:01 2025 -0300

    feat: enable atlas in UI (opentibiabr#1471)

commit 806c9c7
Author: Renato Machado <mehahx@gmail.com>
Date:   Mon Nov 24 19:51:52 2025 -0300

    chore: cleanup leftover anti-bot logic

commit 7d57547
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Sun Nov 23 21:56:52 2025 -0300

    fix: compilation Encryption Mode (opentibiabr#1474)

commit c0dd2a7
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Sun Nov 23 21:56:46 2025 -0300

    fix: compilation in FRAMEWORK_EDITOR (opentibiabr#1473)

commit 7cd36e2
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Sat Nov 22 10:23:43 2025 -0300

    fix: prevent ERROR: /game_battle/battle.lua:20: stack overflow (opentibiabr#1470)

commit 8ffba36
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Fri Nov 21 20:55:38 2025 -0300

    fix: opentibiabr#1460 Failed to fetch sprite (opentibiabr#1468)

commit 34c52dc
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Fri Nov 21 16:21:07 2025 -0300

    fix. NPC message text duplication in console (opentibiabr#1469)

commit a6ee810
Author: kokekanon <114332266+kokekanon@users.noreply.github.com>
Date:   Thu Nov 20 21:49:23 2025 -0300

    fix: prevent WARNING: Lua warning: member function call skipped becau… (opentibiabr#1467)

commit f726bb0
Author: SkullzOTS <86809689+SkullzOTS@users.noreply.github.com>
Date:   Thu Nov 20 16:55:02 2025 -0300

    feat: dragging item icon (opentibiabr#1466)

commit 67460c0
Author: Eduardo Dantas <eduardo.dantas@hotmail.com.br>
Date:   Thu Nov 20 02:08:02 2025 -0300

    refactor: string encoding to use utf8cpp and add tests (opentibiabr#1443)

    Update string encoding implementation to use utf8cpp

    This change updates the string encoding implementation to use the utf8cpp library for improved robustness and consistency across platforms. It refactors the encoding functions in src/framework/stdext/string.cpp, adds comprehensive unit tests, updates build configurations to include utf8cpp, and documents the new encoding policy and behavior.

    String encoding improvements

    Refactored all string encoding functions in src/framework/stdext/string.cpp to use the utf8cpp library, providing strict UTF-8 validation, robust conversions between UTF-8, Latin-1, and UTF-16, and consistent error handling.

    Added a new documentation file docs/string-encoding-policy.md detailing the updated encoding policy, error handling, dependencies, and testing strategy.

    Testing enhancements

    Added a new unit test suite in tests/stdext/string_encoding_test.cpp covering UTF-8 validation, conversions, roundtrip consistency, control character handling, and platform-specific UTF-16 conversions.

    Updated the test build configuration to include the new test directory and sources.

    Build system updates

    Updated src/CMakeLists.txt to require and link the utf8cpp library for all platforms, ensuring proper integration.

    Added utf8cpp as a dependency in vcpkg.json for package management.

commit bf6e3c5
Author: cynio <dominik.smolinski19@gmail.com>
Date:   Wed Nov 19 22:32:45 2025 +0100

    fix(game_console): WASD toggle for game_hotkeys (opentibiabr#1461)
@grepwood grepwood deleted the GI-1507-fix-vorbis-detection-on-non-windows branch March 22, 2026 13:12
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

Successfully merging this pull request may close these issues.

2 participants