From 38b767e58abcc10b2533ba140679a50668b80267 Mon Sep 17 00:00:00 2001 From: Manuel Binna <161041+mbinna@users.noreply.github.com> Date: Mon, 28 Jun 2021 14:46:08 +0200 Subject: [PATCH] Bazel qnx (#1192) * Don't link pthread on QNX On QNX, pthread is part of libc [1]. There's no separate pthread library to link. [1] https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html * Explain that QNX doesn't have pthread lib --- BUILD.bazel | 10 ++++++++++ README.md | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index eb35b627..b2ef33cc 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -2,8 +2,18 @@ load("@rules_cc//cc:defs.bzl", "cc_library") licenses(["notice"]) +config_setting( + name = "qnx", + constraint_values = ["@platforms//os:qnx"], + values = { + "cpu": "x64_qnx", + }, + visibility = [":__subpackages__"], +) + config_setting( name = "windows", + constraint_values = ["@platforms//os:windows"], values = { "cpu": "x64_windows", }, diff --git a/README.md b/README.md index 80996426..6e291997 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,11 @@ can link to pthread by adding `-pthread` to your linker command. Note, you can also use `-lpthread`, but there are potential issues with ordering of command line parameters if you use that. +On QNX, the pthread library is part of libc and usually included automatically +(see +[`pthread_create()`](https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html)). +There's no separate pthread library to link. + ### Building with Visual Studio 2015 or 2017 The `shlwapi` library (`-lshlwapi`) is required to support a call to `CPUInfo` which reads the registry. Either add `shlwapi.lib` under `[ Configuration Properties > Linker > Input ]`, or use the following: