Skip to content
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

Installation Problem on macOS (pkg-config) #206

Open
benkb opened this issue Jun 7, 2019 · 8 comments
Open

Installation Problem on macOS (pkg-config) #206

benkb opened this issue Jun 7, 2019 · 8 comments
Milestone

Comments

@benkb
Copy link

benkb commented Jun 7, 2019

hi

I have janet installed, but it cannot find the Janet.pc file
----- error from ./configure -----
using pkg-config to find janet headers.
Package janet was not found in the pkg-config search path.
Perhaps you should add the directory containing `janet.pc'
to the PKG_CONFIG_PATH environment variable
No package 'janet' found

@andrewchambers
Copy link
Owner

andrewchambers commented Jun 7, 2019

What version of janet are you using? It is also possible to specify the path to janet headers with ./configure --with-janet-cflags "-I/some/path/to/your/headers"

Note, I haven't tried janet shell on macOS yet, it might work, but I haven't had the chance to test yet, official support probably has to wait until 0.1 release.

@benkb
Copy link
Author

benkb commented Jun 7, 2019

janet -v
1.0.0-dev-64a80c5


set -x PKG_CONFIG_PATH /usr/local/lib/pkgconfig


./configure
using pkg-config to find janet headers.
using pkg-config to find readline.
writing config.inc
configured with:
PREFIX="/usr"
CC="cc"
CFLAGS="-Wall -Wfatal-errors -O2"
LDFLAGS=""
WITH_MANUAL_JANET="n"
JANET_HEADER_CFLAGS="-I/usr/local/include/janet "
WITH_PKGCONFIG_READLINE="y"
WITH_PKGCONFIG_LIBEDIT="n"
WITH_READNOISE="n"
READLINE_CFLAGS="-I/usr/local/Cellar/readline/8.0.0_1/include/readline "
READLINE_LDFLAGS="-L/usr/local/Cellar/readline/8.0.0_1/lib -lreadline "

configure SUCCESS


make
./support/do -c
do all
do src/shlib.so
do src/shlib/shlib.o
cc -fPIC -I/usr/local/include/janet -I/usr/local/Cellar/readline/8.0.0_1/include/readline -Wall -Wfatal-errors -O2 -c -o src/shlib/shlib.o.redo.tmp src/shlib/shlib.c
In file included from src/shlib/shlib.c:14:
/usr/local/Cellar/readline/8.0.0_1/include/readline/readline.h:35:12: fatal error:
'readline/rlstdc.h' file not found
# include <readline/rlstdc.h>

1 error generated.
do: src/shlib/shlib.o: got exit code 1
do: src/shlib.so: got exit code 1
do: all: got exit code 1
make: *** [all] Error 1

@andrewchambers
Copy link
Owner

Interesting, there must be something different about readline on macos. I don't ever reference readline/rlstdc.h directly in my code, so it seems more like macOS doing something strange like not giving you the right flags from pkg-config. You can try looking for those files yourself and manually editing config.inc

@benkb
Copy link
Author

benkb commented Jun 7, 2019

which config.inc do you mean?

@andrewchambers
Copy link
Owner

After you run ./configure the configuration script writes a file called config.inc in the janetsh directory, that file has some build parameters.

@benkb
Copy link
Author

benkb commented Jun 7, 2019

when I change the particular line in my config.inf from


PREFIX="/usr"
CC="cc"
CFLAGS="-Wall -Wfatal-errors -O2"
LDFLAGS=""
WITH_MANUAL_JANET="n"
JANET_HEADER_CFLAGS="-I/usr/local/include/janet "
WITH_PKGCONFIG_READLINE="y"
WITH_PKGCONFIG_LIBEDIT="n"
WITH_READNOISE="n"
READLINE_CFLAGS="-I/usr/local/Cellar/readline/8.0.0_1/include/readline "
READLINE_LDFLAGS="-L/usr/local/Cellar/readline/8.0.0_1/lib -lreadline "


to

READLINE_CFLAGS="-I/usr/local/Cellar/readline/8.0.0_1/include"

make fails with


make
./support/do -c
do all
do src/shlib.so
do src/shlib/shlib.o
cc -fPIC -I/usr/local/include/janet -I/usr/local/Cellar/readline/8.0.0_1/include -Wall -Wfatal-errors -O2 -c -o src/shlib/shlib.o.redo.tmp src/shlib/shlib.c
src/shlib/shlib.c:14:10: fatal error: 'readline.h' file not found

@kastaren
Copy link

kastaren commented Jun 8, 2019

The reason it didn't work in your first try is the following passage in readline.h:

#if defined (READLINE_LIBRARY)
#  include "rlstdc.h"
#  include "rltypedefs.h"
#  include "keymaps.h"
#  include "tilde.h"
#else
#  include <readline/rlstdc.h>
#  include <readline/rltypedefs.h>
#  include <readline/keymaps.h>
#  include <readline/tilde.h>
#endif

READLINE_LIBRARY is not defined here so we will look for the rest of the headers in the wrong place. If we try to solve this by pointing at /usr/local/Cellar/readline/8.0.0_1/include we will not find readline.h.

Adding "-DREADLINE_LIBRARY" to READLINE_CFLAGS fixes this, though I have no idea if this is correct and if we get any side effects.

In configure:

elif test "$WITH_PKGCONFIG_READLINE" = "y"
then
  eecho "using pkg-config to find readline."
  READLINE_CFLAGS="$(pkg-config --cflags readline) -DREADLINE_LIBRARY"
  READLINE_LDFLAGS="$(pkg-config --libs  readline)"

But I am still stuck at the next one:

Undefined symbols for architecture x86_64:
  "_janet_abstract", referenced from:
      _tcgetattr_ in shlib.o
  "_janet_arity", referenced from:
      _exec in shlib.o
  "_janet_array", referenced from:
      _glob_ in shlib.o

... and so on for probably all the janet stuff in shlib

Everything seems fine with Janet otherwise as far as i can see, my version is currently 1.0.0-dev-b082c81.

@andrewchambers
Copy link
Owner

Hmm, seems we need to do something mac specific when linking.

@andrewchambers andrewchambers added this to the 0.1 release milestone Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants