{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/1740","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1740/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1740/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1740/events","html_url":"https://github.com/bazelbuild/bazel/issues/1740","id":175670944,"number":1740,"title":"Building shared objects: is there any way to stop cc_libraries from generating non-PIC static libraries?","user":{"login":"ahyangyi","id":700956,"avatar_url":"https://avatars.githubusercontent.com/u/700956?v=3","gravatar_id":"","url":"https://api.github.com/users/ahyangyi","html_url":"https://github.com/ahyangyi","followers_url":"https://api.github.com/users/ahyangyi/followers","following_url":"https://api.github.com/users/ahyangyi/following{/other_user}","gists_url":"https://api.github.com/users/ahyangyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ahyangyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahyangyi/subscriptions","organizations_url":"https://api.github.com/users/ahyangyi/orgs","repos_url":"https://api.github.com/users/ahyangyi/repos","events_url":"https://api.github.com/users/ahyangyi/events{/privacy}","received_events_url":"https://api.github.com/users/ahyangyi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bazelbuild/bazel/labels/category:%20rules%20%3E%20C++","name":"category: rules > C++","color":"d4c5f9"},{"url":"https://api.github.com/repos/bazelbuild/bazel/labels/P3","name":"P3","color":"fbca04"},{"url":"https://api.github.com/repos/bazelbuild/bazel/labels/type:%20bug","name":"type: bug","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"calpeyser","id":6312235,"avatar_url":"https://avatars.githubusercontent.com/u/6312235?v=3","gravatar_id":"","url":"https://api.github.com/users/calpeyser","html_url":"https://github.com/calpeyser","followers_url":"https://api.github.com/users/calpeyser/followers","following_url":"https://api.github.com/users/calpeyser/following{/other_user}","gists_url":"https://api.github.com/users/calpeyser/gists{/gist_id}","starred_url":"https://api.github.com/users/calpeyser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calpeyser/subscriptions","organizations_url":"https://api.github.com/users/calpeyser/orgs","repos_url":"https://api.github.com/users/calpeyser/repos","events_url":"https://api.github.com/users/calpeyser/events{/privacy}","received_events_url":"https://api.github.com/users/calpeyser/received_events","type":"User","site_admin":false},"assignees":[{"login":"calpeyser","id":6312235,"avatar_url":"https://avatars.githubusercontent.com/u/6312235?v=3","gravatar_id":"","url":"https://api.github.com/users/calpeyser","html_url":"https://github.com/calpeyser","followers_url":"https://api.github.com/users/calpeyser/followers","following_url":"https://api.github.com/users/calpeyser/following{/other_user}","gists_url":"https://api.github.com/users/calpeyser/gists{/gist_id}","starred_url":"https://api.github.com/users/calpeyser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calpeyser/subscriptions","organizations_url":"https://api.github.com/users/calpeyser/orgs","repos_url":"https://api.github.com/users/calpeyser/repos","events_url":"https://api.github.com/users/calpeyser/events{/privacy}","received_events_url":"https://api.github.com/users/calpeyser/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-09-08T05:53:06Z","updated_at":"2016-10-18T00:29:26Z","closed_at":null,"body":"Here's an example:\r\n```\r\ncc_library(name=\"foo\", srcs = [...], hdrs = [...])\r\ncc_library(name=\"bar\", srcs = [...], hdrs = [...])\r\ncc_library(name=\"baz\", deps=[\":foo\", \":bar\"], alwayslink = 1, srcs = [...], hdrs = [...])\r\ncc_binary(name=\"libbaz_release.so\", deps=[\":baz\"], linkshared=1)\r\n```\r\nwhich is what I believe the currently recommended idiom for building a shared object.\r\n\r\nHere's the question:\r\nif I type `bazel build //...:all`, all source code in libraries `foo`, `bar` and `baz` will be built twice, once with -fPIC and once without. However, since I have no actual use with the non-fPIC versions, such building time and energy is wasted.\r\n\r\nIs there some way to fix this?\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/254373372","html_url":"https://github.com/bazelbuild/bazel/issues/1740#issuecomment-254373372","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1740","id":254373372,"user":{"login":"steven-johnson","id":328955,"avatar_url":"https://avatars.githubusercontent.com/u/328955?v=3","gravatar_id":"","url":"https://api.github.com/users/steven-johnson","html_url":"https://github.com/steven-johnson","followers_url":"https://api.github.com/users/steven-johnson/followers","following_url":"https://api.github.com/users/steven-johnson/following{/other_user}","gists_url":"https://api.github.com/users/steven-johnson/gists{/gist_id}","starred_url":"https://api.github.com/users/steven-johnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steven-johnson/subscriptions","organizations_url":"https://api.github.com/users/steven-johnson/orgs","repos_url":"https://api.github.com/users/steven-johnson/repos","events_url":"https://api.github.com/users/steven-johnson/events{/privacy}","received_events_url":"https://api.github.com/users/steven-johnson/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T00:29:26Z","updated_at":"2016-10-18T00:29:26Z","body":"Adding fuel to the fire here: in -c opt mode, a library produces both \".a\" and \".pic.a\" outputs; if you have a genrule downstream that needs to consume this output, this makes it hard to do so, since you need to use $(location :foo) for dbg and fast, but $(locations :foo) with some filtering for opt..."}}
{"actor":{"display_login":"steven-johnson"}}