Skip to content

doc: Use CONFIG_SITE variable instead of --prefix option - #17934

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
hebasto:20200115-prefix-depends
Apr 13, 2021
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
hebasto:20200115-prefix-depends

Conversation

@hebasto

@hebasto hebasto commented Jan 15, 2020 •

Copy link
Copy Markdown
Member

The current examples of --prefix=... option usage to point configure script to appropriate depends directory is not standard. This causes some confusion and a bit of inconvenience.

Consider a CentOS 7 32 bit system. Packages libdb4-devel, libdb4-cxx-devel, miniupnpc-devel and zeromq-devel are unavailable from repos. After recommended build with depends:

cd depends
make
cd ..
./autogen.sh
./configure --prefix=$PWD/depends/i686-pc-linux-gnu
make

a user is unable to make install compiled binaries neither locally (to ~/.local) nor system-wide (to /usr/local) as --prefix is set already.

Meanwhile, the standard approach with using config.site files allows both possibilities:

cd depends
make
cd ..
./autogen.sh
CONFIG_SITE=$PWD/depends/i686-pc-linux-gnu/share/config.site ./configure --prefix ~/.local
make
make install

or

CONFIG_SITE=$PWD/depends/i686-pc-linux-gnu/share/config.site ./configure
make
sudo make install  # install to /usr/local

Moreover, this approach is used in Gitian descriptors already.

@hebasto

hebasto commented Jan 15, 2020

Copy link
Copy Markdown
Member Author

@practicalswift
#14959 (comment):

FWIW you're not alone here: I found the use of --prefix (for anything beyond the ordinary meaning of installation destination) unintuitive too :-)

#16691 (comment):

Should it be clarified that --prefix is used not in its usual meaning of "when you run ./configure --prefix=/foo/bar, you are indicating that the software should be installed under the /foo/bar directory"?

That seems to be a recurring source of confusion.

Has it been discussed if we could use something else than --prefix for the "where to find dependencies"-meaning we're talking about here?

ping @ryanofsky @fanquake

@ryanofsky

Copy link
Copy Markdown
Contributor

This change seems clearer to me and I think it's an improvement. But now the documentation doesn't seem to mention the prefix path at all, so it's not clear that binaries will be installed in depends/<host-platform-triplet>. It might be worth mentioning in these documents where depends build outputs will be installed if the prefix is no longer explicit in the instructions

@hebasto

hebasto commented Jan 15, 2020 •

Copy link
Copy Markdown
Member Author

This change seems clearer to me and I think it's an improvement. But now the documentation doesn't seem to mention the prefix path at all, so it's not clear that binaries will be installed in depends/<host-platform-triplet>. It might be worth mentioning in these documents where depends build outputs will be installed if the prefix is no longer explicit in the instructions

Do you mean copy-paste from ./configure --help ?

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

@ryanofsky

Copy link
Copy Markdown
Contributor

Do you mean copy-paste from ./configure --help ?

I'm suggesting adding a sentence like: "The default install prefix when using config.site is --prefix=depends/<host-platform-triplet>, so depends build outputs will be installed in that location."

Without this PR, the install location is more obvious because --prefix is explicit. The install location is less clear with this PR because it stops mentioning --prefix.

@fanquake
fanquake requested a review from theuni January 16, 2020 00:01
@fanquake

Copy link
Copy Markdown
Member

~0. It has annoyed me for a while that we've been inconsistent with --prefix and CONFIG_SITE usage in our docs, and I was going to change the windows docs to use --prefix at one point.

Consider a CentOS 7 32 bit system.

Is this the only system where this is an issue?

I know @theuni is busy, but I'd like his thoughts here as well.

@hebasto

hebasto commented Jan 16, 2020 •

Copy link
Copy Markdown
Member Author

@fanquake

~0. It has annoyed me for a while that we've been inconsistent with --prefix and CONFIG_SITE usage in our docs, and I was going to change the windows docs to use --prefix at one point.

Using --prefix in a such unusual way looks a bit like a hack. And the windows docs is ok, IMO.

Consider a CentOS 7 32 bit system.

Is this the only system where this is an issue?

This issue is not CentOS specific as using --prefix make it impossible to make install compiled binaries neither locally (to ~/.local) nor system-wide (to /usr/local) on every system.
But on other systems a user could get binaries in other ways (https://bitcoincore.org/en/download/).

@hebasto

hebasto commented Jan 16, 2020

Copy link
Copy Markdown
Member Author

@ryanofsky

I'm suggesting adding a sentence like: "The default install prefix when using config.site is --prefix=depends/<host-platform-triplet>, so depends build outputs will be installed in that location."

IIUC, "depends build outputs" (boost, qt, zmq, ...) always are placed in depends/<host-platform-triplet> directory.
And prefix is used by make install as a target to copy binaries and libraries from src tree.

What are reasons to install to depends/<host-platform-triplet>?
/home/hebasto/github/bitcoin/depends/x86_64-pc-linux-gnu/bin/bitcoind seems not very useful.
/home/hebasto/.local/bin/bitcoind or /usr/local/bitcoind looks much better, IMO.

Without this PR, the install location is more obvious because --prefix is explicit. The install location is less clear with this PR because it stops mentioning --prefix.

Without this PR mentioning prefix was mandatory as its usage was non-standard and there was a discrepancy between our docs and autotools docs (and configure --help).

With this PR a user who going to use make install command could use our depends docs, and prefix in a usual and well-documented (by autotools) way to point to a desired install location.

@ryanofsky

Copy link
Copy Markdown
Contributor

Code review ACK c8e2003. Agree that referencing the config.site file specifically is a not only clearer than current prefix magic but also more flexible, as in in the centos example.

I don't understand this comment at all: #17934 (comment). I like the PR. I'm an only trying to suggest adding another sentence to the documentation. But it's fine not to add it.

@hebasto

hebasto commented Jan 16, 2020

Copy link
Copy Markdown
Member Author

@ryanofsky Sorry, Russel. I did not want to be rude. My native language is not English, as you know. I was confused with "depends build outputs will be installed in that location" phrase. Actually, I do not understand its meaning now.

@hebasto

hebasto commented Jan 16, 2020

Copy link
Copy Markdown
Member Author

Agree that referencing the config.site file specifically is a not only clearer than current prefix magic but also more flexible, as in in the centos example.

More details from The Autoconf Manual - 15.8:

If the environment variable CONFIG_SITE is set, configure uses its value as the name of a shell script to read; it is recommended that this be an absolute file name. Otherwise, it reads the shell script prefix/share/config.site if it exists, then prefix/etc/config.site if it exists.

@Sjors

Sjors commented Jan 17, 2020

Copy link
Copy Markdown
Member

Concept ACK.

Unfortunately CONFIG_SITE isn't remembered between configure runs. This causes a problem when you switch branches or pull master sometimes, when configure is automatically re-run, it forgets about using depends.

@hebasto

hebasto commented Jan 17, 2020

Copy link
Copy Markdown
Member Author

@Sjors

Unfortunately CONFIG_SITE isn't remembered between configure runs. This causes a problem when you switch branches or pull master sometimes, when configure is automatically re-run, it forgets about using depends.

Do you mean that --prefix=... option is remembered in mentioned circumstances?

@Sjors

Sjors commented Jan 17, 2020

Copy link
Copy Markdown
Member

I believe so yes. Though hopefully there's a way to make it remember the config_site too.

@hebasto

hebasto commented Mar 9, 2020

Copy link
Copy Markdown
Member Author

@theuni from #8167:

To make my life easier while I was in there, I fixed up depends to play nice with CONFIG_SITE, which can be used now instead of abusing --prefix, though the --prefix hack still works fine.

@fanquake fanquake left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase this, and update the use of --prefix in the multiprocess documentation.

Comment thread depends/README.md Resolved
@hebasto
hebasto force-pushed the 20200115-prefix-depends branch from c8e2003 to 223b1ba Compare April 9, 2021 09:29
@hebasto

hebasto commented Apr 9, 2021

Copy link
Copy Markdown
Member Author

Updated c8e2003 -> 223b1ba (pr17934.01 -> pr17934.02):

I'm suggesting adding a sentence like: "The default install prefix when using config.site is --prefix=depends/<host-platform-triplet>, so depends build outputs will be installed in that location."

@practicalswift

Copy link
Copy Markdown
Contributor

Concept ACK

Thanks for fixing this. I've always found our use of --prefix somewhat unintuitive since it deviates from the typical meaning.

@practicalswift

Copy link
Copy Markdown
Contributor

ACK 223b1ba: patch looks correct

Comment thread depends/README.md

Common `host-platform-triplets` for cross compilation are:
The default install prefix when using `config.site` is `--prefix=depends/<host-platform-triplet>`,
so depends build outputs will be installed in that location.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "depends build outputs" I'm assuming you mean things like the fontconfig tools, which will end up installed into depends/<host-platform-triplet>. i.e:

# ls depends/x86_64-pc-linux-gnu/bin/
event_rpcgen.py  fc-cache  fc-cat  fc-list  fc-match  fc-pattern  fc-query  fc-scan  fc-validate  freetype-config  xmlwf

Is that correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the dependency packages are installed into depends/<host-platform-triplet>, using bin, lib and other subdirectories.

The make -C depends rightfully reports:

copying packages: native_b2 boost libevent qt expat libxcb xcb_proto libXau xproto freetype fontconfig libxkbcommon qrencode bdb sqlite miniupnpc libnatpmp zeromq
to: /home/hebasto/GitHub/bitcoin/depends/x86_64-pc-linux-gnu

Not to be confused with the default --prefix for Bitcoin Core, that is /usr/local. That means make install will install bitcoind into /usr/local/bin.

@fanquake fanquake left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 223b1ba

@fanquake
fanquake merged commit 3aa4935 into bitcoin:master Apr 13, 2021
@hebasto
hebasto deleted the 20200115-prefix-depends branch April 13, 2021 13:21
@hebasto

hebasto commented Apr 20, 2022

Copy link
Copy Markdown
Member Author

@Sjors

Unfortunately CONFIG_SITE isn't remembered between configure runs. This causes a problem when you switch branches or pull master sometimes, when configure is automatically re-run, it forgets about using depends.

Passing CONFIG_SITE to configure as a parameter

$ ./configure --prefix ~/.local CONFIG_SITE=$PWD/depends/i686-pc-linux-gnu/share/config.site

should work in such cases.

@bitcoin bitcoin locked and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants