configure: error: Couldn't find liblogger/logger.h(也许我为此忘记了一些以前的AC指令).道德:那里的日志文件是有原因的...:-S I have implemented a logging library in C (which I've named liblogger), and used Autotools to compile and install it. As far as I can see, the installation is correctly done, since the headers and the library itself (which I currently bundle into a static library) are installed into the appropriate directories (/usr/local/include/liblogger/ for the headers and /usr/local/lib for the .a).Now I am trying to link another tool with that library (compiled and built also using Autotools). To check for the logging library presence, I have followed what is said here to create the configure.ac file. But the resulting configure script says:even though the named files DO exist.The part of the configure.ac file where I check for the header and the library is as follows:LIBLOGGER=/usr/local/libHEADERLOGGER=/usr/local/include/libloggerAC_CHECK_HEADER([${HEADERLOGGER}/logger.h], [AC_DEFINE([HAVE_LOGGER_H], [1], [found logger.h]) CFLAGS="$CFLAGS -I${HEADERLOGGER}"])AC_CHECK_LIB([${LIBLOGGER}/liblogger.a], log_init, [found liblogger.a], [], [])AC_SUBST(LIBLOGGER)Actually, if I try with:AC_CHECK_FILE( [${HEADERLOGGER}/logger.h], [AC_MSG_NOTICE([Found logger.h])], [AC_MSG_NOTICE([Didn't find logger.h])] )it does find the file.Thanks. 解决方案 The problem was not on the tool's configure.ac, but in the original logger library. When inspecting the config.log file generated when running the configure script, there was a line saying:/usr/local/include/liblogger/logger.h:22:19: fatal error: types.h: No such file or directorySo I actually had to reorganize some dependencies in the logger library.In fact, setting HEADERLOGGER to liblogger doesn't solve the problem, since (I don't know why), "/urs/local/include/liblogger" is not being searched for, returningconfigure: error: Couldn't find liblogger/logger.h(Perhaps I'm forgetting some previous AC instruction for that).The moral: the log files are there for a reason... :-S 这篇关于configure.ac:库和头文件不可用并且不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-29 20:09