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

Can't pass extra cabal parameters for readline on Mac OS X #2237

Closed
edyu opened this Issue Jun 4, 2016 · 9 comments

Comments

Projects
None yet
4 participants
@edyu

edyu commented Jun 4, 2016

My project needs readline, so I added a line under build-depends. However, on Mac OS X, readline needs the Gnu c readline to be installed and if I use homebrew to install it, cabal install would need the following extra flags: --extra-include-dirs=/usr/local/opt/readline/include --extra-lib-dirs=/usr/local/opt/readline/lib readline --configure-option=--with-readline-includes=/usr/local/opt/readline/include --configure-option=--with-readline-libraries=/usr/local/opt/readline/lib
How do I pass to Stack those extra flags in order to build readline for my project?

I get the following error if I don't supply those flags:
Linking /private/var/folders/pf/fjqk_sm161dc2_hnvqr99q280000gn/T/stack95780/readline-1.0.3.0/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup/setup ...
Warning: defaultUserHooks in Setup script is deprecated.
Configuring readline-1.0.3.0...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for GNUreadline.framework... checking for readline... no
checking for tputs in -lncurses... yes
checking for readline in -lreadline... yes
checking for rl_readline_version... yes
checking for rl_begin_undo_group... no
configure: error: readline not found, so this package cannot be built
See `config.log' for more details.

@edyu edyu changed the title from How do you pass extra cabal parameters for readline on Mac OS X? to Can't pass extra cabal parameters for readline on Mac OS X Jun 5, 2016

@mgsloan

This comment has been minimized.

Show comment
Hide comment
@mgsloan
Collaborator

mgsloan commented Jun 6, 2016

@mgsloan mgsloan added this to the Support milestone Jun 6, 2016

@edyu

This comment has been minimized.

Show comment
Hide comment
@edyu

edyu Jun 6, 2016

No,they are not. They are meant to be used when compiling my own package not for being part of the cabal dependencies in build-depends.

edyu commented Jun 6, 2016

No,they are not. They are meant to be used when compiling my own package not for being part of the cabal dependencies in build-depends.

@edyu

This comment has been minimized.

Show comment
Hide comment
@edyu

edyu Jun 6, 2016

Some new hooks may need to be exposed in order for build dependencies to be customized.

edyu commented Jun 6, 2016

Some new hooks may need to be exposed in order for build dependencies to be customized.

@mgsloan

This comment has been minimized.

Show comment
Hide comment
@mgsloan

mgsloan Jun 6, 2016

Collaborator

These options go in your stack build configuration.

Collaborator

mgsloan commented Jun 6, 2016

These options go in your stack build configuration.

@edyu

This comment has been minimized.

Show comment
Hide comment
@edyu

edyu Jun 6, 2016

I have them in my stack build configuration. They are not enough. Also
there is a bug in parsing the cabal file for extra-include-dirs in that
it's not recognized.

Even if I add them to the yaml file directly, I'm still missing a way to
pass in --configure-option.
On Jun 6, 2016 2:21 PM, "Michael Sloan" notifications@github.com wrote:

These options go in your stack build configuration.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2237 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAD6rSRk6z0WOSyU52qW7TFU1w34muG2ks5qJI9YgaJpZM4IuDx3
.

edyu commented Jun 6, 2016

I have them in my stack build configuration. They are not enough. Also
there is a bug in parsing the cabal file for extra-include-dirs in that
it's not recognized.

Even if I add them to the yaml file directly, I'm still missing a way to
pass in --configure-option.
On Jun 6, 2016 2:21 PM, "Michael Sloan" notifications@github.com wrote:

These options go in your stack build configuration.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2237 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAD6rSRk6z0WOSyU52qW7TFU1w34muG2ks5qJI9YgaJpZM4IuDx3
.

@mgsloan

This comment has been minimized.

Show comment
Hide comment
@mgsloan

mgsloan Jun 6, 2016

Collaborator

Yeah, that's tracked by #1438 which I've bumped to P1

Collaborator

mgsloan commented Jun 6, 2016

Yeah, that's tracked by #1438 which I've bumped to P1

@mgsloan mgsloan closed this Jun 6, 2016

@aymanosman

This comment has been minimized.

Show comment
Hide comment
@aymanosman

aymanosman Apr 3, 2017

@edyu See this stackoverflow answer.

Say your are on OSX

$ brew install readline
[...]
For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

Now you know where the library got installed you can set some environmental variables that ./configure will pick up

LDFLAGS=-L/usr/local/opt/readline/lib \
CFLAGS=-I/usr/local/opt/readline/include \
stack install readline --extra-include-dirs=/usr/local/opt/readline/include --extra-lib-dirs=/usr/local/opt/readline/lib

aymanosman commented Apr 3, 2017

@edyu See this stackoverflow answer.

Say your are on OSX

$ brew install readline
[...]
For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

Now you know where the library got installed you can set some environmental variables that ./configure will pick up

LDFLAGS=-L/usr/local/opt/readline/lib \
CFLAGS=-I/usr/local/opt/readline/include \
stack install readline --extra-include-dirs=/usr/local/opt/readline/include --extra-lib-dirs=/usr/local/opt/readline/lib
@edyu

This comment has been minimized.

Show comment
Hide comment
@edyu

edyu Apr 21, 2017

@aymanosman that actually works! thank you.
Back on this issue: I still don't think it was properly fixed as technically those should be specified somehow in a config file instead of specifying in the command line.

edyu commented Apr 21, 2017

@aymanosman that actually works! thank you.
Back on this issue: I still don't think it was properly fixed as technically those should be specified somehow in a config file instead of specifying in the command line.

@brendanzab

This comment has been minimized.

Show comment
Hide comment
@brendanzab

brendanzab Dec 17, 2017

So I've put the following in my ~/.stack/config.yaml:

extra-include-dirs:
- /usr/local/opt/readline/include
extra-lib-dirs:
- /usr/local/opt/readline/lib

Alas readline still won't build. Do I need to put the environment variables somewhere? If so, how do I scope that to the build of readline specifically without going via the command line?

brendanzab commented Dec 17, 2017

So I've put the following in my ~/.stack/config.yaml:

extra-include-dirs:
- /usr/local/opt/readline/include
extra-lib-dirs:
- /usr/local/opt/readline/lib

Alas readline still won't build. Do I need to put the environment variables somewhere? If so, how do I scope that to the build of readline specifically without going via the command line?

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