Skip to content

Drop pkg-config for static libs #68

Closed

Description

@ljbade

For all the statically linked libs we should stop using pkg-config becuase most libraries do not provide a valid .pc file for static linking.

See http://stackoverflow.com/questions/27586503/how-to-use-pkg-config-to-link-a-library-statically

Currently I am seeing link commnads with a mix of static and dynamic link flags for the same library. This is just asking for trouble, no to mention a missing symbol will result in a run-time error instead of a compile time error - I have hit this many times on Android.

@kkaefer Said pkg-config is needed for GLFW, so assuming they maintain a valid .pc we can leave that lib alone.

Activity

  1. springmeyer commented on Feb 4, 2015

    @springmeyer
    Contributor

    I'm on board with reducing dependence on pkg-config wherever possible (#12). But GLFW is certainly a case we should keep pkg-config around for.

  2. kkaefer commented on Feb 4, 2015

    @kkaefer
    Member

    An example of a package that seems broken is curl and openssl:

    'openssl_static_libs%': ['/Users/kkaefer/Code/gl/native/mason_packages/android-arm-v5-9/openssl/1.0.1l/lib/libssl.a'],
    'openssl_cflags%': ['-I/Users/kkaefer/Code/gl/native/mason_packages/android-arm-v5-9/openssl/1.0.1l/include'],
    'openssl_ldflags%': ['-L/Users/kkaefer/Code/gl/native/mason_packages/android-arm-v5-9/openssl/1.0.1l/lib', '-lssl', '-lcrypto', '-ldl'],
    'curl_static_libs%': ['/Users/kkaefer/Code/gl/native/mason_packages/android-arm-v5-9/libcurl/7.40.0/lib/libcurl.a'],
    'curl_cflags%': ['-DCURL_STATICLIB', '-I/Users/kkaefer/Code/gl/native/mason_packages/android-arm-v5-9/libcurl/7.40.0/include'],
    'curl_ldflags%': ['-L/Users/kkaefer/Code/gl/native/mason_packages/android-arm-v5-9/libcurl/7.40.0/lib', '-lcurl', '-lssl', '-lcrypto', '-lssl', '-lcrypto', '-lz'],
    

    You'll see that the ldflags contain other libs as well, even though they should be folded into the static archives.

  3. springmeyer commented on Nov 10, 2016

    @springmeyer
    Contributor

    Closing. The motivation for this ticket was solved by using mason.cmake to avoid a runtime dependency on pkg-config after mapbox/mapbox-gl-native#5359

  4. kkaefer commented on Nov 11, 2016

    @kkaefer
    Member

    In particular, this is solved by including a mason.ini file in packages to avoid calling the original packages build system in #176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions