mirror of
https://github.com/urbit/vere.git
synced 2024-08-15 23:00:47 +03:00
Add debug configuration to build system (#142)
Co-authored-by: Peter McEvoy <git@mcevoypeter.com>
This commit is contained in:
parent
efc45a7a72
commit
ef4af8d4f6
17
.bazelrc
17
.bazelrc
@ -1,3 +1,6 @@
|
||||
# Enable configurations specific to the host platform.
|
||||
common --enable_platform_specific_config
|
||||
|
||||
# Disallow empty `glob()`s.
|
||||
build --incompatible_disallow_empty_glob
|
||||
|
||||
@ -17,9 +20,11 @@ build --@io_bazel_rules_docker//transitions:enable=false
|
||||
build --flag_alias=clang_version=//:clang_version
|
||||
build --flag_alias=gcc_version=//:gcc_version
|
||||
|
||||
# Always include source-level debug info.
|
||||
build --copt='-g'
|
||||
build --host_copt='-g'
|
||||
# Don't include source level debug info on macOS. See
|
||||
# https://github.com/urbit/urbit/issues/5561 and
|
||||
# https://github.com/urbit/vere/issues/131.
|
||||
build:linux --copt='-g'
|
||||
build:linux --host_copt='-g'
|
||||
build --strip=never
|
||||
|
||||
# Use -O3 as the default optimization level.
|
||||
@ -31,5 +36,11 @@ build --host_copt='-O3'
|
||||
build --host_copt='-DU3_CPU_DEBUG'
|
||||
build --host_copt='-DU3_MEMORY_DEBUG'
|
||||
|
||||
# Enable maximum debug info and disable optimizations for debug config. It's
|
||||
# important that these lines come after setting the default debug and
|
||||
# optimization level flags above.
|
||||
build:dbg --copt='-O0'
|
||||
build:dbg --copt='-g3'
|
||||
|
||||
# Any personal configuration should go in .user.bazelrc.
|
||||
try-import %workspace%/.user.bazelrc
|
||||
|
22
INSTALL.md
22
INSTALL.md
@ -59,8 +59,25 @@ Once you install the prerequisites, you're ready to build:
|
||||
bazel build :urbit
|
||||
```
|
||||
|
||||
The default optimization level is `-O3`, but if you want to specify a different
|
||||
optimization level, use [`--copt`][copt]:
|
||||
If you want a debug build, which changes the optimization level from `-O3` to
|
||||
`-O0` and includes more debugging information, specify the `dbg` configuration:
|
||||
```console
|
||||
bazel build --config=dbg :urbit
|
||||
```
|
||||
Note that you cannot change the optimization level for third party
|
||||
dependencies--those targets specified in `bazel/third_party`--from the command
|
||||
line.
|
||||
|
||||
You can turn on CPU and memory debugging by defining `U3_CPU_DEBUG` and
|
||||
`U3_MEMORY_DEBUG`, respectively:
|
||||
```console
|
||||
bazel build --copt='-DU3_CPU_DEBUG' --copt='-DU3_MEMORY_DEBUG' :urbit
|
||||
```
|
||||
Note that defining these two debug symbols will produce ships that are
|
||||
incompatible with binaries without these two debug symbols defined.
|
||||
|
||||
If you need to specify arbitrary C compiler or linker options, use
|
||||
[`--copt`][copt] or [`--linkopt`][linkopt], respectively:
|
||||
```console
|
||||
bazel build --copt='-O0' :urbit
|
||||
```
|
||||
@ -115,4 +132,5 @@ run `clang --version` and pass the version number via
|
||||
[bazel-install]: https://bazel.build/install
|
||||
[copt]: https://bazel.build/docs/user-manual#copt
|
||||
[glibc]: https://www.gnu.org/software/libc
|
||||
[linkopt]: https://bazel.build/docs/user-manual#linkopt
|
||||
[musl libc]: https://musl.libc.org
|
||||
|
1
bazel/third_party/aes_siv/aes_siv.BUILD
vendored
1
bazel/third_party/aes_siv/aes_siv.BUILD
vendored
@ -14,6 +14,7 @@ cc_library(
|
||||
"config.h",
|
||||
],
|
||||
hdrs = ["aes_siv.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["."],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@openssl"],
|
||||
|
1
bazel/third_party/curl/curl.BUILD
vendored
1
bazel/third_party/curl/curl.BUILD
vendored
@ -56,6 +56,7 @@ configure_make(
|
||||
"@//:linux_x86_64": ["--host=x86_64-linux-musl"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = ["-O3"],
|
||||
env = {
|
||||
"URBIT_RUNTIME_OPENSSL": "$$PWD/$(GENDIR)/external/openssl/openssl",
|
||||
},
|
||||
|
1
bazel/third_party/ed25519/ed25519.BUILD
vendored
1
bazel/third_party/ed25519/ed25519.BUILD
vendored
@ -8,6 +8,7 @@ cc_library(
|
||||
exclude = ["src/ed25519.h"],
|
||||
),
|
||||
hdrs = ["src/ed25519.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["src"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
1
bazel/third_party/gmp/gmp.BUILD
vendored
1
bazel/third_party/gmp/gmp.BUILD
vendored
@ -21,6 +21,7 @@ configure_make(
|
||||
"@//:linux_x86_64": ["--host=x86_64-linux-musl"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = ["-O3"],
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libgmp.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
9
bazel/third_party/h2o/h2o.BUILD
vendored
9
bazel/third_party/h2o/h2o.BUILD
vendored
@ -21,6 +21,7 @@ cc_library(
|
||||
name = "cloexec",
|
||||
srcs = ["deps/cloexec/cloexec.c"],
|
||||
hdrs = ["deps/cloexec/cloexec.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/cloexec"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:private"],
|
||||
@ -30,6 +31,7 @@ cc_library(
|
||||
cc_library(
|
||||
name = "golombset",
|
||||
hdrs = ["deps/golombset/golombset.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/golombset"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:private"],
|
||||
@ -40,6 +42,7 @@ cc_library(
|
||||
name = "klib",
|
||||
srcs = glob(["deps/klib/*.c"]),
|
||||
hdrs = glob(["deps/klib/*.h"]),
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/klib"],
|
||||
linkstatic = True,
|
||||
local_defines = select({
|
||||
@ -61,6 +64,7 @@ cc_library(
|
||||
name = "libgkc",
|
||||
srcs = ["deps/libgkc/gkc.c"],
|
||||
hdrs = ["deps/libgkc/gkc.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/libgkc"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:private"],
|
||||
@ -96,6 +100,7 @@ cc_library(
|
||||
name = "picohttpparser",
|
||||
srcs = ["deps/picohttpparser/picohttpparser.c"],
|
||||
hdrs = ["deps/picohttpparser/picohttpparser.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/picohttpparser"],
|
||||
linkstatic = True,
|
||||
local_defines = select({
|
||||
@ -148,6 +153,7 @@ cc_library(
|
||||
cc_library(
|
||||
name = "ssl_conservatory",
|
||||
hdrs = ["deps/ssl-conservatory/openssl/openssl_hostname_validation.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/ssl-conservatory/openssl"],
|
||||
linkstatic = True,
|
||||
textual_hdrs = ["deps/ssl-conservatory/openssl/openssl_hostname_validation.c"],
|
||||
@ -158,6 +164,7 @@ cc_library(
|
||||
cc_library(
|
||||
name = "yoml",
|
||||
hdrs = glob(["deps/yoml/*.h"]),
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/yoml"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:private"],
|
||||
@ -208,6 +215,7 @@ cc_library(
|
||||
"deps/picotls/deps/cifra/src/ext/*.h",
|
||||
],
|
||||
),
|
||||
copts = ["-O3"],
|
||||
includes = [
|
||||
"deps/picotls/deps/cifra/src",
|
||||
"deps/picotls/deps/cifra/src/ext",
|
||||
@ -226,6 +234,7 @@ cc_library(
|
||||
"deps/picotls/deps/micro-ecc/uECC_vli.h",
|
||||
],
|
||||
hdrs = ["deps/picotls/deps/micro-ecc/uECC.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["deps/picotls/deps/micro-ecc"],
|
||||
textual_hdrs = [
|
||||
"deps/picotls/deps/micro-ecc/asm_arm.inc",
|
||||
|
@ -5,6 +5,7 @@ cc_library(
|
||||
"keccak-tiny.c",
|
||||
],
|
||||
hdrs = ["keccak-tiny.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["."],
|
||||
local_defines = select({
|
||||
# TODO: confirm which platforms have memset_s().
|
||||
|
1
bazel/third_party/openssl/openssl.BUILD
vendored
1
bazel/third_party/openssl/openssl.BUILD
vendored
@ -29,6 +29,7 @@ configure_make(
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = ["-O3"],
|
||||
lib_source = ":all",
|
||||
out_static_libs = [
|
||||
"libssl.a",
|
||||
|
1
bazel/third_party/secp256k1/secp256k1.BUILD
vendored
1
bazel/third_party/secp256k1/secp256k1.BUILD
vendored
@ -23,6 +23,7 @@ configure_make(
|
||||
"@//:linux_x86_64": ["--host=x86_64-linux-musl"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = ["-O3"],
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libsecp256k1.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
1
bazel/third_party/sigsegv/sigsegv.BUILD
vendored
1
bazel/third_party/sigsegv/sigsegv.BUILD
vendored
@ -24,6 +24,7 @@ configure_make(
|
||||
"@//:linux_x86_64": ["--host=x86_64-linux-musl"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = ["-O3"],
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libsigsegv.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
1
bazel/third_party/sse2neon/sse2neon.BUILD
vendored
1
bazel/third_party/sse2neon/sse2neon.BUILD
vendored
@ -1,6 +1,7 @@
|
||||
cc_library(
|
||||
name = "sse2neon",
|
||||
hdrs = ["sse2neon.h"],
|
||||
copts = ["-O3"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
1
bazel/third_party/uv/uv.BUILD
vendored
1
bazel/third_party/uv/uv.BUILD
vendored
@ -20,6 +20,7 @@ configure_make(
|
||||
"@//:linux_x86_64": ["--host=x86_64-linux-musl"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = ["-O3"],
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libuv.a"],
|
||||
targets = ["install"],
|
||||
|
1
bazel/third_party/whereami/whereami.BUILD
vendored
1
bazel/third_party/whereami/whereami.BUILD
vendored
@ -2,6 +2,7 @@ cc_library(
|
||||
name = "whereami",
|
||||
srcs = ["src/whereami.c"],
|
||||
hdrs = ["src/whereami.h"],
|
||||
copts = ["-O3"],
|
||||
includes = ["src"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
1
bazel/third_party/zlib/zlib.BUILD
vendored
1
bazel/third_party/zlib/zlib.BUILD
vendored
@ -12,6 +12,7 @@ configure_make(
|
||||
"//conditions:default": ["--jobs=`nproc`"],
|
||||
}),
|
||||
configure_options = ["--static"],
|
||||
copts = ["-O3"],
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libz.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
Loading…
Reference in New Issue
Block a user