{"action":"created","issue":{"url":"https://api.github.com/repos/google/protobuf/issues/1373","repository_url":"https://api.github.com/repos/google/protobuf","labels_url":"https://api.github.com/repos/google/protobuf/issues/1373/labels{/name}","comments_url":"https://api.github.com/repos/google/protobuf/issues/1373/comments","events_url":"https://api.github.com/repos/google/protobuf/issues/1373/events","html_url":"https://github.com/google/protobuf/issues/1373","id":145087956,"number":1373,"title":"-lpthread in BUILD breaks Android projects that depend on protobuf","user":{"login":"andrewharp","id":3376817,"avatar_url":"https://avatars.githubusercontent.com/u/3376817?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewharp","html_url":"https://github.com/andrewharp","followers_url":"https://api.github.com/users/andrewharp/followers","following_url":"https://api.github.com/users/andrewharp/following{/other_user}","gists_url":"https://api.github.com/users/andrewharp/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewharp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewharp/subscriptions","organizations_url":"https://api.github.com/users/andrewharp/orgs","repos_url":"https://api.github.com/users/andrewharp/repos","events_url":"https://api.github.com/users/andrewharp/events{/privacy}","received_events_url":"https://api.github.com/users/andrewharp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/protobuf/labels/bazel","name":"bazel","color":"bfd4f2"},{"url":"https://api.github.com/repos/google/protobuf/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-01T05:06:24Z","updated_at":"2016-04-18T18:12:54Z","closed_at":"2016-04-18T18:12:54Z","body":"Hi,\r\nAndroid supports pthreads, but does not provide a libpthread.so library to link against. The functionality is provided in other system libraries.\r\n\r\nSince protobuf/BUILD specifies \"-lpthread\", I've had to add some hacks to get around this to get the Android Tensorflow demo working by creating a dummy pthread library, which is \"linked\" against and bundled in the APK: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/BUILD\r\n\r\nNow that I'm trying to make a standalone Android executable it's becoming even more problematic as the binary expects to find the fake libpthread.so lib somewhere on its library path.\r\n\r\nIs there a better way to build protobuf for Android? Or can the -lpthread flag be made selective on build platform, so that these workarounds are not necessary?\r\n\r\nthanks!"},"comment":{"url":"https://api.github.com/repos/google/protobuf/issues/comments/211508042","html_url":"https://github.com/google/protobuf/issues/1373#issuecomment-211508042","issue_url":"https://api.github.com/repos/google/protobuf/issues/1373","id":211508042,"user":{"login":"andrewharp","id":3376817,"avatar_url":"https://avatars.githubusercontent.com/u/3376817?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewharp","html_url":"https://github.com/andrewharp","followers_url":"https://api.github.com/users/andrewharp/followers","following_url":"https://api.github.com/users/andrewharp/following{/other_user}","gists_url":"https://api.github.com/users/andrewharp/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewharp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewharp/subscriptions","organizations_url":"https://api.github.com/users/andrewharp/orgs","repos_url":"https://api.github.com/users/andrewharp/repos","events_url":"https://api.github.com/users/andrewharp/events{/privacy}","received_events_url":"https://api.github.com/users/andrewharp/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T18:12:54Z","updated_at":"2016-04-18T18:12:54Z","body":"Fixed by https://github.com/google/protobuf/pull/1386"}}