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

Unify static linking for all operating systems and improve README #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JohnstonJ
Copy link

This commit unifies the code for static linking under all operating systems, with a focus on fixing problems for Windows:

  1. All functionality for pkg-config is now enabled for Windows as well. For example, a vcpkg-built pkgconf works great. Therefore, it seems there is no reason to prevent users from using pkg-config on Windows if they want to use it.

  2. When not using pkg-config on Windows, and statically linking against FFmpeg libraries, many system libraries will also need to be linked. A list of known system libraries will now be linked in such situations. It's best to use pkg-config, but this will at least reduce the probability of linker errors. Note that we also have to do this for vcpkg as well.

  3. Code duplication between Windows and other operating systems has been eliminated.

  4. The statik flag is now correctly passed to pkg_config when in the static_linking function.

  5. The GitHub Actions workflow is updated to test the new possibilities on Windows. The example program is also run, which revealed that the existing vcpkg-based way of finding FFmpeg was missing several system libraries for linking.

  6. Make significant improvements to the README. More detailed information about environment variables, features, how the build script works, vcpkg triples, and more is included to help users work with the crate.

Improving the functionality of dynamic linking is an obvious next step, but is out of scope of this commit. It's likely that a single, large function can eventually be used for both static and dynamic linking.

This commit unifies the code for static linking under all operating
systems, with a focus on fixing problems for Windows:

1.  All functionality for pkg-config is now enabled for Windows as well.
    For example, a vcpkg-built pkgconf works great.  Therefore, it seems
    there is no reason to prevent users from using pkg-config on Windows
    if they want to use it.

2.  When not using pkg-config on Windows, and statically linking against
    FFmpeg libraries, many system libraries will also need to be linked.
    A list of known system libraries will now be linked in such
    situations.  It's best to use pkg-config, but this will at least
    reduce the probability of linker errors.  Note that we also have to
    do this for vcpkg as well.

3.  Code duplication between Windows and other operating systems has
    been eliminated.

4.  The statik flag is now correctly passed to pkg_config when in the
    static_linking function.

5.  The GitHub Actions workflow is updated to test the new possibilities
    on Windows.  The example program is also run, which revealed that
    the existing vcpkg-based way of finding FFmpeg was missing several
    system libraries for linking.

6.  Make significant improvements to the README.  More detailed
    information about environment variables, features, how the build
    script works, vcpkg triples, and more is included to help users
    work with the crate.

Improving the functionality of dynamic linking is an obvious next step,
but is out of scope of this commit.  It's likely that a single, large
function can eventually be used for both static and dynamic linking.
@ldm0 ldm0 self-requested a review September 29, 2024 15:31
@dominikWin
Copy link

I tested this and it fixes the currently broken linking with OpenCV (#130)

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