Skip to content

external_deps: revamp lib build, add cmake and configure wrapper, update lib feature disablement, update lib versions #1433

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

illwieckz
Copy link
Member

@illwieckz illwieckz commented Nov 11, 2024

This is WIP, current external_deps build status:

system deps build static build test
linux-amd64-default ✅️ ✅️ ✅️
linux-arm64-default ✅️
linux-i686-default ✅️ ✅️ ✅️
linux-armhf-default ✅️
windows-amd64-mingw ✅️ N/A ✅️
windows-i686-mingw ✅️ Buster ❌️ GLEW Noble N/A ✅️
windows-amd64-msvc ✅️
windows-i686-msvc ✅️
macos-amd64-default ✅️ N/A ✅️

I haven't tested if the engine builds and runs properly with those. WIP

What this PR does:

  • Use CMake when packages provide a CMakeLists.txt file
  • Factorize much code
  • Make a nice list of package base url, so it's easy to click all of them and check for new versions
  • Update package versions
  • Update package build options

@illwieckz illwieckz marked this pull request as draft November 11, 2024 16:57
@illwieckz
Copy link
Member Author

illwieckz commented Nov 11, 2024

For windows-i686-mingw I get this with GLEW:

i686-w64-mingw32-ld -nostdlib -shared -soname libglew32.dll --out-implib lib/libglew32.dll.a
     -o lib/glew32.dll tmp/linux-mingw32/default/shared/glew.o
     -Lexternal_deps/build-windows-i686-mingw_10/prefix/lib -L/usr/i686-w64-mingw32/lib
     -lopengl32 -lgdi32 -luser32 -lkernel32 
i686-w64-mingw32-ld: tmp/linux-mingw32/default/shared/glew.o:glew.c:(.text+0x141ab):
 undefined reference to `strlen'

Everything else build.

@illwieckz
Copy link
Member Author

illwieckz commented Nov 11, 2024

For windows-amd64-msvc I get this with Vorbis:

[ 84%] Linking C shared library libvorbis.dll
/usr/bin/x86_64-w64-mingw32-ld:
 external_deps/build-windows-amd64-msvc_10/vorbis/libvorbis-1.3.7/win32/vorbis.def:3: syntax error
/usr/bin/x86_64-w64-mingw32-ld:
 external_deps/build-windows-amd64-msvc_10/vorbis/libvorbis-1.3.7/win32/vorbis.def: file format not recognized; treating as linker script
/usr/bin/x86_64-w64-mingw32-ld:
 external_deps/build-windows-amd64-msvc_10/vorbis/libvorbis-1.3.7/win32/vorbis.def:2: syntax error

Everything else build.

@illwieckz
Copy link
Member Author

illwieckz commented Nov 11, 2024

  • OGG has a CMakeLists.txt file but no install target, so I returned back to configure for this one.
  • Opus requires at least CMake 3.16.

@illwieckz
Copy link
Member Author

illwieckz commented Nov 11, 2024

When building newer Opus on Debian buster (the distro we use for our releases), I get this:

opus/opus-1.5.2/silk/x86/NSQ_del_dec_avx2.c:959:43: warning: implicit declaration of function '_mm_loadu_si64'; did you mean '_mm_loadu_si32'? [-Wimplicit-function-declaration]
         __m256i x = _mm256_cvtepi16_epi64(_mm_loadu_si64(&x16[i]));
                                           ^~~~~~~~~~~~~~
                                           _mm_loadu_si32

Debian Buster provides GCC 8, but GCC 11.3 or GCC 12 may be required:
https://stackoverflow.com/questions/72837929/mm-loadu-si32-not-recognized-by-gcc-on-ubuntu

@illwieckz
Copy link
Member Author

When building newer Opus on Debian buster (the distro we use for our releases), I get this: […]

Telling Opus to not assume more than SSE2 fixed that.

@illwieckz
Copy link
Member Author

So, the MinGW GLEW and MSVC Vorbis errors are the only ones.

@illwieckz
Copy link
Member Author

So the Vorbis build error is actually a bug:

I added a workaround.

@illwieckz
Copy link
Member Author

I don't get why I get that GLEW build error with MinGW, the build function has not been modified, and the version has not been updated.

@illwieckz
Copy link
Member Author

I don't get why I get that GLEW build error with MinGW, the build function has not been modified, and the version has not been updated.

Also the code is the same for both windows-amd64-msvc, windows-i686-msvc, windows-amd64-mingw and windows-i686-mingw, but it only fails with windows-i686-mingw… That doesn't make sense.

@illwieckz
Copy link
Member Author

So, I don't know what happened, now I don't reproduce the MinGW GLEW error… Maybe I gorgot to prune the prefix folder and some stray files messed-up…

@illwieckz
Copy link
Member Author

Ah, I now see something: I reproduce the bug with MinGW from Ubuntu 24.04 Noble, not with MinGW from Debian 10 Buster. So, since we produce release builds with Debian Buster, it's not a big problem, but it should be fixed for the future…

@slipher
Copy link
Member

slipher commented Nov 11, 2024

What's the purpose of migrating things to build with CMake?

@illwieckz
Copy link
Member Author

So with this a static build for linux-amd64 completes and runs.

@slipher
Copy link
Member

slipher commented Nov 16, 2024

So with this a static build for linux-amd64 completes and runs.

Huh? It worked before, so I have a hard time believing that is suddenly necessary to change the build system of 8 packages.

@illwieckz
Copy link
Member Author

I never said this is a response to “What's the purpose of migrating things to build with CMake?”, I'm just reporting the status of me testing that branch. I said in first post:

I haven't tested if the engine builds and runs properly with those.

So now I'm running those tests.

@DolceTriade
Copy link
Contributor

What's the motivation behind this change?

@illwieckz
Copy link
Member Author

illwieckz commented Nov 18, 2024

Purposes:

  1. Update packages to latest versions,
  2. Update packages build options for latest versions (for example curl adds protocols, so we have to disable them),
  3. Mutualize cmake/configure code as generic reused functions and avoid copy/paste boilerplate,
  4. Rely on CMake as much as possible to make it easy to spot new CMake build options to disable them and other changes.

When using configure it is hard to compare the list of already used options with the new options, one has to read configure's whole output and compare with what's currently used. On the contrary with cmake, one just runs the existing command, then go to the build dir and run ccmake, and see what's enabled and should not, and report the difference to the build script.

@illwieckz illwieckz force-pushed the illwieckz/deps branch 2 times, most recently from ac1c6e1 to 5653846 Compare November 18, 2024 01:26
@illwieckz
Copy link
Member Author

windows-amd64-mingw and windows-i686-mingw engine both build and run.

@@ -8,7 +8,7 @@ set( CMAKE_CXX_COMPILER i686-w64-mingw32-g++ )
set( CMAKE_RC_COMPILER i686-w64-mingw32-windres )

# Target prefix
set( CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 )
set( CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32;${CMAKE_PREFIX_PATH} )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely this doesn't do anything, as the toolchain file is executed before CMakeLists.txt, so CMAKE_PREFIX_PATH wouldn't be set (unless you set it on the command line.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it's for building external_deps, not compiling the game. Could use a comment

case "${PLATFORM}" in
windows-*-*)
# CMake looks for libSDL2.a and aborts if missing if this file exists:
rm -rf "${PKG_PREFIX}/lib/cmake/SDL2/SDL2staticTargets.cmake"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this? I don't see a file like this anywhere, and if I revert this commit it does not appear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, this file came up and sabotaged the build not for Windows, but for Linux targets by injecting a -lsamplerate flag. Anyway on the slipher/deps-combined branch I reverted that commit and did a proper fix by configuring the SDL build not to use the dependency.

-DCURL_USE_MBEDTLS=OFF \
-DCURL_USE_NSS=OFF \
-DCURL_USE_OPENSSL=OFF \
-DCURL_USE_WOLFSSL=ON \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why on?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusion with USE/DISABLE, should be OFF.

@slipher
Copy link
Member

slipher commented Apr 21, 2025

The zlib build is not usable for MSVC because it produces a zconf.h including <unistd.h>.

@slipher
Copy link
Member

slipher commented Apr 22, 2025

For MSVC platforms, the resulting JPEG, WebP, and Curl DLLs have a libgcc DLL dependency. This problem is actually already present with JPEG in the version 10 deps package.
So you currently cannot run a client built with Visual Studio if you do not have MinGW in your PATH. With webp and curl it is a new regression.

@slipher
Copy link
Member

slipher commented Apr 22, 2025

I have pushed a branch named slipher/deps-combined which fixes all issues known to me. It contains the commits from #1642, #1643, this PR, and several more on top of that.

@illwieckz
Copy link
Member Author

illwieckz commented May 1, 2025

Note to myself: There may be some absolute path to rewrite in some installed .cmake files using ${CMAKE_CURRENT_LIST_DIR} instead. Especially with SDL2.

@slipher
Copy link
Member

slipher commented May 1, 2025

I know about the absolute path issue and fixed all cases in the slipher/deps-combined branch.

@slipher
Copy link
Member

slipher commented May 30, 2025

Rebased illwieckz/deps and slipher/deps-combined following merge of #1642.

@illwieckz
Copy link
Member Author

Thanks

@illwieckz illwieckz force-pushed the illwieckz/deps branch 7 times, most recently from 6b6439a to d72b466 Compare July 19, 2025 20:35

base_linux_armhf_default_packages="${base_linux_arm64_default_packages}"
release_linux_armhf_default_packages="${release_linux_arm64_default_packages}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slipher
Copy link
Member

slipher commented Jul 23, 2025

What's the status of this, is it ready for the next round of review yet?

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.

3 participants