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

fatal error: readline.h: No such file or directory #311

Closed
ludovicaelbrecht opened this issue Jun 28, 2022 · 2 comments
Closed

fatal error: readline.h: No such file or directory #311

ludovicaelbrecht opened this issue Jun 28, 2022 · 2 comments

Comments

@ludovicaelbrecht
Copy link

Hi,

Every x months I do a git pull and rebuild aft on my Fedora 36. The steps I execute are "cmake .. && make clean && make". When I try this now, I get this error message:

/u/s/l/a/build (master)> make [ 32%] Built target mtp-ng-static [ 33%] Building CXX object cli/CMakeFiles/aft-mtp-cli.dir/CommandLine.cpp.o /usr/src/local-builds/android-file-transfer-linux/cli/CommandLine.cpp:26:10: fatal error: readline.h: No such file or directory 26 | #include <readline.h> | ^~~~~~~~~~~~ compilation terminated. make[2]: *** [cli/CMakeFiles/aft-mtp-cli.dir/build.make:146: cli/CMakeFiles/aft-mtp-cli.dir/CommandLine.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:189: cli/CMakeFiles/aft-mtp-cli.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

Yet, /usr/include/readline/readline.h is present on my system.

I modified android-file-transfer-linux/cli/CommandLine.cpp line 26 fom this:
#include <readline.h>
to this:
#include <readline/readline.h>

The build then fails like this:

Consolidate compiler generated dependencies of target mtp-ng-static [ 32%] Built target mtp-ng-static Consolidate compiler generated dependencies of target aft-mtp-cli [ 33%] Building CXX object cli/CMakeFiles/aft-mtp-cli.dir/CommandLine.cpp.o /usr/src/local-builds/android-file-transfer-linux/cli/CommandLine.cpp: In constructor ‘cli::CommandLine::CommandLine()’: /usr/src/local-builds/android-file-transfer-linux/cli/CommandLine.cpp:45:25: error: ‘read_history’ was not declared in this scope; did you mean ‘rl_clear_history’? 45 | read_history(_historyPath.c_str()); | ^~~~~~~~~~~~ | rl_clear_history /usr/src/local-builds/android-file-transfer-linux/cli/CommandLine.cpp: In destructor ‘cli::CommandLine::~CommandLine()’: /usr/src/local-builds/android-file-transfer-linux/cli/CommandLine.cpp:51:17: error: ‘write_history’ was not declared in this scope 51 | write_history(_historyPath.c_str()); | ^~~~~~~~~~~~~ /usr/src/local-builds/android-file-transfer-linux/cli/CommandLine.cpp: In member function ‘bool cli::CommandLine::ReadLine(const std::string&, std::string&)’: /usr/src/local-builds/android-file-transfer-linux/cli/CommandLine.cpp:84:17: error: ‘add_history’ was not declared in this scope 84 | add_history(input.c_str()); | ^~~~~~~~~~~ make[2]: *** [cli/CMakeFiles/aft-mtp-cli.dir/build.make:146: cli/CMakeFiles/aft-mtp-cli.dir/CommandLine.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:189: cli/CMakeFiles/aft-mtp-cli.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

So I modified CommandLine.cpp to include readline.h and history.h differently, like this:
#include <readline/readline.h> #include <readline/history.h>

... then it does compile successfully.

I see CommandLine.cpp has been modified recently to support libedit as an alternative to readline, this change caused the issue on my system.

If there's something I can try out, let me know.

Ludovic

@whoozle
Copy link
Owner

whoozle commented Jun 29, 2022

try rm CMakeCache.txt before cmake ...

@ludovicaelbrecht
Copy link
Author

Thanks, that fixed it. I thought "cmake .." regenerated all necessary parts, sorry about that. Closing the report.

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