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

macOS build error (readline) #1

Closed
irudoy opened this issue Jan 1, 2018 · 3 comments
Closed

macOS build error (readline) #1

irudoy opened this issue Jan 1, 2018 · 3 comments

Comments

@irudoy
Copy link

irudoy commented Jan 1, 2018

MacOS 10.13.2

[ 63%] Building CXX object CMakeFiles/tg_cli.dir/td/telegram/cli.cpp.o
/.../td/td/telegram/cli.cpp:99:3: error: use of undeclared identifier 'rl_replace_line'
  rl_replace_line("", 0);
  ^
/.../td/td/telegram/cli.cpp:105:3: error: use of undeclared identifier 'rl_replace_line'
  rl_replace_line(saved_line.c_str(), 0);
  ^
/.../td/td/telegram/cli.cpp:586:5: error: use of undeclared identifier 'rl_free'
    rl_free(line);
    ^
$ brew info readline

readline: stable 7.0.3 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/7.0.3_1 (46 files, 1.5MB)
  Poured from bottle on 2017-03-14 at 11:47:40
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only..

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
@irudoy
Copy link
Author

irudoy commented Jan 1, 2018

$ brew link --force readline doesn't help

@levlam
Copy link
Contributor

levlam commented Jan 1, 2018

Could you check that CMake has found GNU Readline installed via brew and not a libedit readline-like interface shipped by default in Mac OS?
If GNU Readline was installed after first cmake run, then CMakeCache should be purged in order to find the correct library.

@irudoy
Copy link
Author

irudoy commented Jan 1, 2018

The solution:

brew link --force readline
rm -rf build && mkdir build && cd build
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ ..
cmake --build .
cmake --build . --target install
brew unlink readline

Perhaps it's worth adding this to the readme

@irudoy irudoy closed this as completed Jan 1, 2018
blacksailer added a commit to blacksailer/td that referenced this issue Jan 24, 2018
blacksailer added a commit to blacksailer/td that referenced this issue Jan 30, 2018
cavallium referenced this issue in tdlight-team/tdlight Aug 7, 2020
cavallium referenced this issue in tdlight-team/tdlight Aug 7, 2020
@lucian-ma lucian-ma mentioned this issue Mar 8, 2021
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

2 participants