Commit Graph

79 Commits

Author SHA1 Message Date
Matt Whitlock 2d904d3655 configure: recognize --disable-ub-sanitizer option
There was a typo in the `case` pattern. Now we recognize both forms.

Changelog-None
2023-09-25 13:58:59 +09:30
Rusty Russell 3d3bf87b34 build: remove all trace of DEVELOPER.
If you previously configured with `--enable-developer` we turn that into `--enable-debugbuild`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: build: `--enable-developer` arg to configure (and DEVELOPER variables): use `./configure --enable-debugbuild` and `developer` setting at runtime.
2023-09-21 20:08:24 +09:30
Matt Morehouse 6334797991 configure: define macro for fuzzing builds
Sometimes we want to disable certain functionality or otherwise modify
code for fuzzing. The FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION macro is
a standard way to accomplish this.

See https://llvm.org/docs/LibFuzzer.html#fuzzer-friendly-build-mode.
2023-09-18 13:58:45 +09:30
Dusty Daemon 2a870eb5fa configure: typo fix
Fix typo in configure script

ChangeLog-None
2023-09-15 09:28:49 +09:30
Rusty Russell e3b1549b64 configure: don't assume python3, create $PYTHON var.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-08-28 12:18:06 +02:00
Christian Decker df10a7ec9b config: Detect presence of USDT header in configure 2023-07-28 09:21:42 +09:30
Rusty Russell fa596a9446 configure: --enable-debugbuild flag for debug builds.
This controls debug flags for the build, rather than --developer,
which is going away.

I thought about making this flag control the RUST_PROFILE too, but
it seems that we want that set to "release" for CI, whereas for the
C code we want --enable-debugbuild.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-09 16:49:48 +09:30
Matt Morehouse aa9356b961 make: allow Clang coverage instrumentation
Clang's coverage instrumentation [1] is the best I've seen, with
precision down to the expressions within a line of code. Add an option
to use this instrumentation for better coverage reports.

[1] https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
2023-06-15 10:47:56 +09:30
Jon Griffiths 8b4136bad5 build: remove gmp
Core and secp have not used gmp for a very long time now (core disabled
it in 2015).

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
2023-05-24 18:21:43 +09:30
Rusty Russell e7d4c3175a build: remove --enable-experimental-features / EXPERIMENTAL_FEATURES
Changelog-EXPERIMENTAL: Build: all experimental features are now runtime-enabled; no more ./configure --enable-experimental-features
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Matt Morehouse eed73082f5 make: build dependencies with fuzzing flags
By using fuzzer instrumentation for dependencies, we get more coverage
signal during fuzzing. This is useful when the fuzzer must figure out
how to take certain branches in a dependency.

In our case, the fuzz-bip32 target was failing to create a data buffer
that successfully passed fromwire_ext_key() parsing because the fuzzer
couldn't see what was happening inside libwally-core.
2023-05-21 12:46:27 +02:00
Rusty Russell 3be36a66e3 configure: support sanitizers properly.
For example, if we use -fsanitize=undefined, we can't do unaligned
integer access, but since we didn't test with the sanitizer flags, we
didn't know this, and set `HAVE_UNALIGNED_ACCESS=1`.

Also, add -fno-sanitize-recover= in developer mode, so we actually
fail binaries if something is detected.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-05 06:12:24 +09:30
Rusty Russell 50d1043a91 external: build lowdown if not already found.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-08 00:36:51 +03:00
Rusty Russell 2c72229106 configure: add -Wshadow=local flag.
This will warn us if there are local variables which shadow the
same-named variable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-31 12:18:28 +03:00
Christian Decker 74c3325208 mac: Ensure that we compile the configurator with the M1 libs 2022-07-11 14:06:39 -05:00
Christian Decker e3f53e072f make: Add macos M1 support
The M1 Macs support both x86_64 and arm64 architectures, which forced
homebrew to use a different path for its storage (`/opt/homebrew/`
instead of `/usr/local`). If we don't adjust the path we'd mix x86_64
and arm64 libraries which can lead to weird compiler and linker
errors.

This patch just introduces `CPATH` and `LIBRARY_PATH` as suggested by
the homebrew team, and detects the current architecture automatically.

Changelog-Added: macos: Added m1 architecture support for macos
2022-07-11 14:06:39 -05:00
Clay Shoaf 43ace03685 "removed asterisks, in case that's what made build fail" 2022-05-01 14:36:20 +09:30
Clay Shoaf 55b5653726 Slight problem with `./configure help` 2022-05-01 14:36:20 +09:30
Rusty Russell e5abc10ae2 configure: require rustfmt as well, for rust support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-13 05:25:00 +09:30
Rusty Russell 836c1b805b doc: update c-lightning to Core Lightning almost everywhere.
Mostly comments and docs: some places are actually paths, which
I have avoided changing.  We may migrate them slowly, particularly
when they're user-visible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-07 06:53:26 +09:30
Christian Decker edf6832f8f rust: Actually check if we have cargo
Seems a temporary edit to check the detection slipped in during the
previous PR. This fixes that :-)
2022-02-28 23:25:37 +00:00
Rusty Russell 05bd62fee4 configure: restore -Og default on non-developer builds.
Reverts change in 1ef77504b1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-02-28 14:42:41 -06:00
Christian Decker 1ef77504b1 misc: Add build targets for the tarball and debian packages
The tarball needs to materialze all submodules, and git needs to be
removed as a build dependency.
2022-02-22 09:43:56 +10:30
Christian Decker 7fdad0a60c rust: Add rust detection to configure and a target to add binaries
We detect whether we have the rust tooling available (mainly `cargo`)
and enable or disable the rust libraries, plugins and examples when it
is enabled. Since the rest of the Makefiles assumes that executables
have an associated header and C source file, we also needed to add a
target that we can add non-C binaries to.
2022-02-11 16:02:25 +01:00
Rusty Russell 2e01d26588 configure: update from -fstack-protector to -fstack-protector-strong.
This would have caught the bug found in the next commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-02 15:06:18 +02:00
Rusty Russell 225fec065a Build race fixes: create ccan/config.h atomically, make tools/test/test_gen.c depend on it
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-08-14 12:43:54 +09:30
Christian Decker 2a44ad113d configure: Pick up the correct pytest executable
We were looking for `python` in the `pytest --version` output
2021-03-11 14:07:47 +10:30
Christian Decker 16801e31e9 configure: Prefer pytest over pytest3
When looking for a pytest executable we should be looking for the ones
that `pip` installs in a virtualenv (`pytest` and `py.test`) before we
look for the ones that `apt` installs system-wide (`pytest3` and
`py.test3`) because these may not be part of the virtualenv that all
other packages are installed in.
2021-01-08 19:28:30 +01:00
Antoine Poinsot b3594690d9 configure: allow to run with UB sanitizer
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-10-21 19:34:39 +02:00
Antoine Poinsot 62b54d0125 build: introduce a fuzzing mode
This adds a new configuration, --enable-fuzzing (which is more than
welcome to be coupled with --enable-address-sanitizer), to pass the
fuzzer sanitizer argument when compiling objects. This allows libfuzzer
to actually be able "to fuzz" by detecting coverage and be smart when
mutating inputs.

As libfuzzer brings its own ~~fees~~ main(), we compile objects with
fsanitize=fuzzer-no-link, and special-case the linkage of the fuzz
targets.

A "lib" is added to abstract out the interface to the fuzzing tool used.
This allow us to use the same targets to fuzz using AFL, hongfuzz or w/e
by adding their entrypoints into libfuzz. (h/t to practicalswift who
introduced this for bitcoin-core, which i mimiced)

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-10-21 19:34:39 +02:00
grubles 94f84d3843 Update configure
OpenBSD's `sha256sum` equivalent is `sha256`. This adds support in `configure` for it.
2020-10-15 10:39:42 +10:30
Antoine Poinsot 3382dafaee configure: allow to run clang with ASAN
Prefer adding LSAN_OPTIONS="suppressions=$PWD/tests/sanitizer_suppressions/lsan" when CC=clang instead.

Changelog-Added: build: clang build now supports --enable-address-sanitizer .
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-09-24 13:57:43 +09:30
Rusty Russell 4e67b4fd03 Makefile: work with shasum -a as well as sha256sum.
At least on my Ubuntu box, they're compatible. If they're not, we need
to disable regeneration altogether.

Fixes: #4075
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-23 14:34:42 +02:00
Rusty Russell a08e83522b configure: clean up tmpfile if we fail.
Reported-by: @whitslack
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-21 13:07:01 +02:00
Rusty Russell d56f8b6c5d configure: refuse to create config.vars without any database.
We alter the script to do the move to config.vars right at the end,
which is probably a good idea anyway.

Fixes: #4054
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-19 12:38:54 +09:30
Rusty Russell 390c6470ad configure: we don't need mako any more.
And guard the mako-specific tests with a check instead.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-08-31 21:33:26 -05:00
Matt Whitlock abbc712afb allow building without sqlite3
Changelog-Changed: build: SQLite3 is no longer a hard build requirement. C-Lightning can now be built to support only the PostgreSQL back-end.
2020-08-30 12:44:56 +02:00
Matt Whitlock c1aa33a62a configure: hoist defaulting of PG_CONFIG var to top of script
See: https://github.com/ElementsProject/lightning/pull/3995#discussion_r478899639
2020-08-30 10:24:37 +09:30
Matt Whitlock 94472f67c5 configure: Use pg_config to locate the library location too
Also, allow the pg_config binary to be specified through the PG_CONFIG
environment variable, defaulting to 'pg_config' if unset. Explicitly
setting PG_CONFIG to an empty string will forcibly disable PostgreSQL
support, even if a PostgreSQL library is installed.

Changelog-Fixed: build: On systems with multiple installed versions of the PostgreSQL client library, C-Lightning might link against the wrong version or fail to find the library entirely. `./configure` now uses `pg_config` to locate the library.
2020-08-30 10:24:37 +09:30
Christian Decker 0a501b3646 configure: Use pg_config to locate the header location
Changelog-Fixed: build: On some operating systems the postgresql library would not get picked up. `./configure` now uses `pg_config` to locate the headers.
2020-08-28 11:59:57 +09:30
Niklas Claesson de5eaf2238 configurator: Enable running configurator in wrapper
Since the probing binaries compiled by the configurator needs to run on
the host machine we provide a variable CONFIGURATOR_WRAPPER that can be
set to anything that you want to wrap the calls with.

One example is `qemu-aarch64-static`.
2020-02-06 13:37:54 +10:30
Vasil Dimov cd30f76539 build: fix ./configure options' descriptions
The description of

--enable/disable-experimental-features was a bogus "Developer mode, good
for testing" and

--enable/disable-valgrind was "Valgrind binary to use for tests" which
gave the false impression that it should be set to something like
/usr/local/bin/valgrind whereas it is a boolean option.
2019-12-11 00:50:20 +01:00
Rusty Russell f6571460ff configure: fix FreeBSD which has sqlite3 in /usr/local
Fixes: #3080
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-27 21:42:54 -05:00
darosior 4083e077a4 configure: test XChaCha20Poly1305 stream state for HAVE_GOOD_LIBSODIUM
author: @rustyrussell
2019-10-17 23:42:15 +02:00
Rusty Russell c617f19a29 Makefile: fix static linking.
And update --enable-static, since it doesn't actually create a static
binary since 65fa1c4f39.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-14 14:04:43 -05:00
Christian Decker 9025a3cd39 pytest: Allow switching chaind depending on a config option
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-10-03 04:32:57 +00:00
Christian Decker 62dc8dc110 make: Add configuration detection and linking of libpq
If we have the client library for postgres configure will define HAVE_POSTGRES
the same way it already handled libsqlite3 an we start linking against it.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-09-22 02:03:43 +00:00
Rusty Russell 8843ab4fb7 configure: test for pwritev
MacOS doesn't have it apparently.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-11 05:58:36 +00:00
Christian Decker e4ab98459c wallet: Add tooling to extract SQL queries and generate driver info
This is the counterpart of the annotations we did in the last few commits. It
extracts queries, passes them through a driver-specific query rewriter and
dumps them into a driver-specific query-list, along with some metadata to
facilitate processing later on. The generated query list is then registered as
a `db_config` and will be loaded by the driver upon instantiation.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-09-05 23:41:05 +00:00
Rusty Russell 0fdf22988d configure: absorb python3-mako check.
This is a better place for such checks than the Makefile, and we'll likely
have more in future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-21 05:07:15 +00:00