Thread: compilation with libeditpreferred is broken
When I try compile postgresql with --libeditpreferred option, compilation fails when readline is also installed on the system. You can see error report on: http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=dot_moth&dt=2009-08-06%2012:46:04 The main problem is in src/bin/psql/input.h where is following ifdef magic: #define USE_READLINE 1 #if defined(HAVE_READLINE_READLINE_H) #include <readline/readline.h> #elif defined(HAVE_EDITLINE_READLINE_H) #include <editline/readline.h> #elif defined(HAVE_READLINE_H) #include <readline.h> #endif #if defined(HAVE_READLINE_HISTORY_H) #include <readline/history.h> #elif defined(HAVE_EDITLINE_HISTORY_H) #include <editline/history.h> #elif defined(HAVE_HISTORY_H) #include <history.h> #endif The problem is that libedit does not distribute editline/history.h and configure detects that there is readline/history.h and sets HAVE_READLINE_HISTORY_H macro. Finally input.h includes editline/readline.h and readline/history.h which causes symbol conflicts. It seems to me that editline never distributed history.h file and HAVE_EDITLINE_HISTORY_H is nonsense. But I'm not sure. I attached suggested fix, but it needs also some work in ./configure - depends if libedit/history.h existed. Anyone knows a history? I need to backported this fix for branches 8.2 - 8.4, because OpenSolaris PostgreSQL binaries build is broken now. Zdenek
Attachment
Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes: > It seems to me that editline never distributed history.h file and > HAVE_EDITLINE_HISTORY_H is nonsense. But I'm not sure. I wouldn't count on that, in part because there are so many versions of editline. On an OS X machine I see $ ls -l /usr/include/*line* /usr/include/editline: total 16 -rw-r--r-- 1 root wheel 6882 Feb 19 2008 readline.h /usr/include/readline: total 16 lrwxr-xr-x 1 root wheel 22 Jul 23 11:31 history.h@ -> ../editline/readline.h lrwxr-xr-x 1 root wheel 22 Jul 23 11:31 readline.h@ -> ../editline/readline.h regards, tom lane
Dne 7.08.09 00:13, Tom Lane napsal(a): > Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes: >> It seems to me that editline never distributed history.h file and >> HAVE_EDITLINE_HISTORY_H is nonsense. But I'm not sure. > > I wouldn't count on that, in part because there are so many versions of > editline. On an OS X machine I see > > $ ls -l /usr/include/*line* > /usr/include/editline: > total 16 > -rw-r--r-- 1 root wheel 6882 Feb 19 2008 readline.h > > /usr/include/readline: > total 16 > lrwxr-xr-x 1 root wheel 22 Jul 23 11:31 history.h@ -> ../editline/readline.h > lrwxr-xr-x 1 root wheel 22 Jul 23 11:31 readline.h@ -> ../editline/readline.h It is only hack for application which wants to have readline and they don't detects libedit. Finally it is like: #include <editline/readline.h> #include <editline/readline.h> I little bit searching on Internet and it seems that when edit/history.h exists it is link to editline/readline.h. (See e.g. http://sysinf0.klabs.be/usr/include/editline/history.h?dist=;arch= ) This link is created by packager, because when you compiling libedit, make install does not create it. By my opinion HAVE_EDITLINE_HISTORY_H is overhead, but we can keep it. Zdenek
I attached conservative version of patch which only reorder #define to avoid cross including half from readline and half from editline. Zdenek Tom Lane píše v čt 06. 08. 2009 v 18:13 -0400: > Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes: > > It seems to me that editline never distributed history.h file and > > HAVE_EDITLINE_HISTORY_H is nonsense. But I'm not sure. > > I wouldn't count on that, in part because there are so many versions of > editline. On an OS X machine I see > > $ ls -l /usr/include/*line* > /usr/include/editline: > total 16 > -rw-r--r-- 1 root wheel 6882 Feb 19 2008 readline.h > > /usr/include/readline: > total 16 > lrwxr-xr-x 1 root wheel 22 Jul 23 11:31 history.h@ -> ../editline/readline.h > lrwxr-xr-x 1 root wheel 22 Jul 23 11:31 readline.h@ -> ../editline/readline.h > > regards, tom lane
Attachment
Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes: > I attached conservative version of patch which only reorder #define to > avoid cross including half from readline and half from editline. Applied, thanks. regards, tom lane