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.
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