-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Minimum recommended toolchain - document and test it #1874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,6 @@ Implementation details | |
| * No runtime heap allocation. | ||
| * Extensive testing infrastructure. | ||
| * Structured to facilitate review and analysis. | ||
| * Intended to be portable to any system with a C89 compiler and uint64_t support. | ||
| * No use of floating types. | ||
| * Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.") | ||
| * Field operations | ||
|
|
@@ -97,8 +96,15 @@ This can be done with the following steps: | |
| Subkey fingerprint: 4BBB 845A 6F5A 65A6 9DFA EC23 4861 DBF2 6212 3605 | ||
| ``` | ||
|
|
||
| Building with Autotools | ||
| ----------------------- | ||
| ## Building from source | ||
|
|
||
| The project is intended to be portable to any system with a C89/C90-compatible toolchain. | ||
| Additionally, the C standard library must provide the `<stdint.h>` header. | ||
|
|
||
| Toolchains older than the default one shipped in the current Debian "oldoldstable" release | ||
| are not tested and are not recommended for building the project. | ||
|
Comment on lines
+104
to
+105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should remove this sentence (and change the PR title accordingly).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. I'm not sure there's much value (for this project) in trying to establish a minimum supported compiler version, and it seems possible that tests for this are going to add more friction than value. As long as they are low-effort, and can be deleted/changed easily, probably fine. I'd also say that if we were going to document something, just state the particular compiler, rather than make people look up what compiler/version pair happened to ship on an old version of some Linux distro.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No strong opinion here but I still I tend to simply say "oldoldstable". Then we won't run into the need to bump the version regularly (e.g., because something breaks on an old compiler/docker image) and worse, use our brain cycles to make a decision whether the bump is justified without clear guidelines. |
||
|
|
||
| ### Building with Autotools | ||
|
|
||
| $ ./autogen.sh # Generate a ./configure script | ||
| $ ./configure # Generate a build system | ||
|
|
@@ -108,12 +114,11 @@ Building with Autotools | |
|
|
||
| To compile optional modules (such as Schnorr signatures), you need to run `./configure` with additional flags (such as `--enable-module-schnorrsig`). Run `./configure --help` to see the full list of available flags. | ||
|
|
||
| Building with CMake | ||
| ------------------- | ||
| ### Building with CMake | ||
|
|
||
| To maintain a pristine source tree, CMake encourages to perform an out-of-source build by using a separate dedicated build tree. | ||
|
|
||
| ### Building on POSIX systems | ||
| #### Building on POSIX systems | ||
|
|
||
| $ cmake -B build # Generate a build system in subdirectory "build" | ||
| $ cmake --build build # Run the actual build process | ||
|
|
@@ -122,7 +127,7 @@ To maintain a pristine source tree, CMake encourages to perform an out-of-source | |
|
|
||
| To compile optional modules (such as Schnorr signatures), you need to run `cmake` with additional flags (such as `-DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON`). Run `cmake -B build -LH` or `ccmake -B build` to see the full list of available flags. | ||
|
|
||
| ### Cross compiling | ||
| #### Cross compiling | ||
|
|
||
| To alleviate issues with cross compiling, preconfigured toolchain files are available in the `cmake` directory. | ||
| For example, to cross compile for Windows: | ||
|
|
@@ -133,7 +138,7 @@ To cross compile for Android with [NDK](https://developer.android.com/ndk/guides | |
|
|
||
| $ cmake -B build -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28 | ||
|
|
||
| ### Building on Windows | ||
| #### Building on Windows | ||
|
|
||
| The following example assumes Visual Studio 2022. Using clang-cl is recommended. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| FROM debian:oldoldstable-slim | ||
|
|
||
| SHELL ["/bin/bash", "-c"] | ||
|
|
||
| WORKDIR /root | ||
|
|
||
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
| git \ | ||
| autoconf automake libtool make \ | ||
| gcc \ | ||
| python3-full && \ | ||
| apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| ENV VIRTUAL_ENV=/root/venv | ||
| RUN python3 -m venv $VIRTUAL_ENV | ||
| ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
| RUN pip install lief | ||
|
Comment on lines
+14
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should omit python from this job to simplify maintenance. We don't want to be restricted to whatever Python version oldoldstable ships (and who knows if lief will runs on that version in the future).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disabling Python would require more changes in this PR to handle the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, yeah. I was thinking we can just set |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
Maybe it's just me, but "building from source" sounds like this is a special thing and we also ship binaries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my "code" suggestion: Just "Building"