anse1 / sqlsmith

A random SQL query generator
GNU General Public License v3.0
754 stars 128 forks source link

Compilation failure on Ubuntu 18.04 #21

Closed michaelmior closed 6 years ago

michaelmior commented 6 years ago

I get the following issue when running configure on Ubuntu 18.04. Any assistance appreciated :)

$ autoreconf -i
configure.ac:4: installing './install-sh'
configure.ac:4: installing './missing'
Makefile.am: installing './depcomp'
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
./configure: line 3192: syntax error near unexpected token `noext,mandatory'
./configure: line 3192: `AX_CXX_COMPILE_STDCXX_11(noext,mandatory)'
michaelmior commented 6 years ago

I was able to fix configure by adding ax_boost_base.m4, ax_boost_regex.m4 ,ax_cxx_compile_stdcxx_11.m4, and ax_cxx_compile_stdcxx.m4 to the m4 directory and adding ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 to Makefile.am. Then when running make I get the following:

make  all-am
make[1]: Entering directory '/home/mmior/apps/sqlsmith'
g++ -std=c++11  -g -O2 -L/usr/lib/x86_64-linux-gnu   -o sqlsmith relmodel.o schema.o postgres.o  sqlite.o random.o prod.o expr.o grammar.o log.o dump.o impedance.o sqlsmith.o -lpqxx  -lboost_regex  -lsqlite3 
/usr/bin/x86_64-linux-gnu-ld: postgres.o: undefined reference to symbol 'PQexec'
//usr/lib/x86_64-linux-gnu/libpq.so.5: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:429: recipe for target 'sqlsmith' failed
make[1]: *** [sqlsmith] Error 1
make[1]: Leaving directory '/home/mmior/apps/sqlsmith'
Makefile:331: recipe for target 'all' failed
make: *** [all] Error 2
df7cb commented 6 years ago

Fwiw, the Debian package Build-Depends on autoconf-archive:

Build-Depends: autoconf, autoconf-archive, debhelper (>= 9), libboost-regex-dev, libpq-dev, libpqxx-dev 
michaelmior commented 6 years ago

Thanks! Installing autoconf-archive did solve the majority of my problems. Now I have the following:

checking for libpq-fe.h... yes
checking for the PostgreSQL library linking is working... configure: error: in `/home/mmior/apps/sqlsmith':
configure: error: could not find libpq-fe.h header
See `config.log' for more details

Looking in config.log shows

configure:4723: checking for the PostgreSQL library linking is working             
configure:4749: g++ -o conftest -g -O2  -I/usr/include/postgresql  -L/usr/lib/x86_64-linux-gnu conftest.cpp  -lpq >&5 
conftest.cpp: In function 'int main()':                                            
conftest.cpp:30:21: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
       char conninfo="dbname = postgres";                                          
                     ^~~~~~~~~~~~~~~~~~~                                           
conftest.cpp:32:34: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
       conn = PQconnectdb(conninfo);                                               
                                  ^                                                
In file included from conftest.cpp:24:0:                                           
/usr/include/postgresql/libpq-fe.h:261:16: note:   initializing argument 1 of 'PGconn* PQconnectdb(const char*)'
 extern PGconn *PQconnectdb(const char *conninfo);                                 
                ^~~~~~~~~~~
maahl commented 6 years ago

This error is related to this: https://github.com/anse1/sqlsmith/issues/18#issuecomment-378157629

As a temporary workaround, I manually edited the configure script so that this line: char conninfo="dbname = postgres"; reads like this instead: char* conninfo="dbname = postgres";

michaelmior commented 6 years ago

@maahl Yeah, that does the trick :) Thanks for the pointer!