Skip to content

Update README.md for mac osx users#2

Merged
taiar merged 1 commit into
asdf-community:masterfrom
SgtPooki:patch-1
Apr 16, 2021
Merged

Update README.md for mac osx users#2
taiar merged 1 commit into
asdf-community:masterfrom
SgtPooki:patch-1

Conversation

@SgtPooki

Copy link
Copy Markdown

I required libxt and cairo to be installed, as well as modifying PATH, LDFLAGS, CPPFLAGS, and PKG_CONFIG_PATH as all the dependencies installed by those requested. I used regex and some find and replace to generate the export statements from the brew install output, so these could be combined into single statements per environment variable:

export PATH="/usr/local/opt/expat/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/expat/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/expat/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export LDFLAGS="-L/usr/local/opt/expat/lib"
export CPPFLAGS="-I/usr/local/opt/expat/include"
export PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig"
export C_INCLUDE_PATH="/opt/X11/include:${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export LDFLAGS="-L/usr/local/opt/libffi/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/libffi/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/sqlite/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/sqlite/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export LDFLAGS="-L/usr/local/opt/icu4c/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/icu4c/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export LDFLAGS="-L/usr/local/opt/libffi/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/libffi/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/sqlite/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/sqlite/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export LDFLAGS="-L/usr/local/opt/icu4c/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/icu4c/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"

I required `libxt` and `cairo` to be installed, as well as modifying `PATH`, `LDFLAGS`, `CPPFLAGS`, and `PKG_CONFIG_PATH` as all the dependencies installed by those requested. I used regex and some find and replace to generate the export statements from the brew install output, so these could be combined into single statements per environment variable:

```
export PATH="/usr/local/opt/expat/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/expat/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/expat/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export LDFLAGS="-L/usr/local/opt/expat/lib"
export CPPFLAGS="-I/usr/local/opt/expat/include"
export PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig"
export C_INCLUDE_PATH="/opt/X11/include:${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export LDFLAGS="-L/usr/local/opt/libffi/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/libffi/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/sqlite/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/sqlite/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export LDFLAGS="-L/usr/local/opt/icu4c/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/icu4c/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export LDFLAGS="-L/usr/local/opt/libffi/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/libffi/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/sqlite/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/sqlite/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export LDFLAGS="-L/usr/local/opt/icu4c/lib${LDFLAGS:+ }${LDFLAGS}"
export CPPFLAGS="-I/usr/local/opt/icu4c/include${CPPFLAGS:+ }${CPPFLAGS}"
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}"
```
@taiar

taiar commented Apr 15, 2021

Copy link
Copy Markdown
Member

Hey @SgtPooki, thanks for the Mac OS updates and also the long env setup reference.

I'm thinking of a way to reference this content on the readme as well. As you already described very well here, I think that just to reference this pull request on the readme would be nice, what do you think?

PS: I can do it myself, I just want to know if you agree this is a good option :)

@taiar
taiar merged commit ee466be into asdf-community:master Apr 16, 2021
@taiar

taiar commented Apr 16, 2021

Copy link
Copy Markdown
Member

I just did, thank you!

@SgtPooki

Copy link
Copy Markdown
Author

awesome :) Thanks

@SgtPooki
SgtPooki deleted the patch-1 branch April 20, 2021 05:03
@noahgaertner

Copy link
Copy Markdown

Hi,
I just tried following this guide and I get this error

configure: error: "liblzma library and headers are required"

despite having xz installed (which has now replaced liblzma)
Do you know how I would go about fixing this?
Thanks!

@Nathaniel-Haines

Copy link
Copy Markdown

@noahgaertner I am having the same issue, did you ever come across a solution?

@noahgaertner

noahgaertner commented Sep 28, 2021

Copy link
Copy Markdown

@noahgaertner I am having the same issue, did you ever come across a solution?

Nope, I ended up just installing it from brew directly @Nathaniel-Haines

@Nathaniel-Haines

Copy link
Copy Markdown

@noahgaertner fell upon a solution today! I think the problem was that the compiler could not locate lzma. After installing xz/lzma through:

brew install xz

the following worked for me:

R_EXTRA_CONFIGURE_OPTIONS="CFLAGS=-I/opt/homebrew/lib CPPFLAGS=-I/opt/homebrew/include LDFLAGS=-L/opt/homebrew/include --enable-R-shlib --with-cairo --with-x=no" asdf install R 4.1.0

@hyiltiz

hyiltiz commented Mar 7, 2023

Copy link
Copy Markdown

Is it possible to let the build script actually include CFLAGS=-I/opt/homebrew/lib CPPFLAGS=-I/opt/homebrew/include LDFLAGS=-L/opt/homebrew/include as additional paths to check for so end users do not have to dig until they end up here? @SgtPooki @taiar

@SgtPooki

SgtPooki commented Apr 2, 2023

Copy link
Copy Markdown
Author

@hyiltiz i imagine not. Especially not assuming homebrew is installed on every machine.

CFLAGS can vary in location by system, and it’s pretty common for compiler flags to require consumer intervention and manual config, because the locations and flags can vary widely and need customization/overriding for various reasons

Idk if there’s a good library out there for automatic CFLAG settings for users who are only using a tool and not developing it, but there might be.

A switch on os/platform/arch with some sane defaults and guiding error messages could be a good middleground 🤷

@hyiltiz

hyiltiz commented Apr 5, 2023

Copy link
Copy Markdown

There may be a confusion here; I am asking if we should also check for those paths before setting the variables CFLAGS etc., without assuming the existence of homebrew. I think one of the problems the build system could solve is to check for the existence of libraries etc. under various highly-likely paths in the system, and set appropriate defaults. The user could still override if they so wish by mechanisms such as manual configs or environment variables etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants