Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Issues
  • #1538
Closed
Open
Issue created Sep 24, 2017 by Administrator@rootContributor

New cxx_library 'static_pic_lib' option not properly supported

Created by: voznesenskym

I am working on upgrading our BUCK to the latest version, and when making a prebuilt_cxx_library, the static_pic_lib command does not work properly.

Example: prebuilt_cxx_library ( name = 'icu', static_pic_lib = 'linux/x86/libicu/libicuuc.a', exported_deps = [ ':icuuc_headers', ], header_namespace = '', visibility = [ 'PUBLIC' ], )

Context This lib is included with other libs into a top level static pic library. However, when I attempt to link it into a shared library with -fPIC flags (for JNI), it tells me that the generated library is invalid and that I should recompile with -fPIC.

Investigation This means that the static_pic_lib command does not actually do anything, it just makes a static_lib.

I decided to dig into the BUCK source code to find the issue, and it appears as though everything is wired up under the hood, except the getStaticPicLibrary method in AbstractNewPrebuiltCxxLibraryPaths never gets called.

This is because of line 740 in CxxDescriptionEnhancer, args.getLinkStyle().orElse(Linker.LinkableDepType.STATIC), basically forces any cxx_prebuilt_library to be static. The args.getLinkStyle() it checks (CxxBinaryDescription.CommonArg) always seems to return null and does not even appear to be implemented.

Solution? Changing line 740 mentioned above to force a Linker.LinkableDepType.STATIC_PIC does work. This means everything is indeed wired up properly under the hood, there just needs to be some resolution at wherever we parse the BUCK files.

I plan to have a fix up in the next few days, but wanted to open this issue up as soon as I found it.

Assignee
Assign to
Time tracking