pgadmin-org / pgagent

pgAgent - A job scheduler for PostgreSQL
https://www.pgadmin.org/
Other
97 stars 41 forks source link

4.2.2 build error on RHEL 7 #28

Closed devrimgunduz closed 1 year ago

devrimgunduz commented 1 year ago

Hi,

4.2.2 fails to build on RHEL 7. Can you please check? Thanks!

[ 22%] Building CXX object CMakeFiles/pgagent.dir/connection.cpp.o
/usr/lib64/ccache/c++  -DPGAGENT_VERSION=\"4.2.2\" -DPGAGENT_VERSION_MAJOR=4 -I/usr/pgsql-15/include -I/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2 -I/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fPIC -pie -pthread   -o CMakeFiles/pgagent.dir/connection.cpp.o -c /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:372:2: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]
  if (m_result != nullptr)
  ^
In file included from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/pgAgent.h:36:0,
                 from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:12:
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h: In constructor 'DBconn::DBconn(const string&)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:113:19: warning: 'DBconn::m_inUse' will be initialized after [-Wreorder]
  bool             m_inUse;
                   ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:109:19: warning:   'DBconn* DBconn::m_next' [-Wreorder]
  DBconn          *m_next;
                   ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:22:1: warning:   when initialized here [-Wreorder]
 DBconn::DBconn(const std::string &connectString)
 ^
In file included from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/pgAgent.h:36:0,
                 from /var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:12:
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:110:19: warning: 'DBconn::m_prev' will be initialized after [-Wreorder]
  DBconn          *m_prev;
                   ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/include/connection.h:98:7: warning:   'int DBconn::m_minorVersion' [-Wreorder]
  int  m_minorVersion,
       ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:22:1: warning:   when initialized here [-Wreorder]
 DBconn::DBconn(const std::string &connectString)
 ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp: In member function 'std::string DBconn::ExecuteScalar(const string&)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:328:6: warning: variable 'rows' set but not used [-Wunused-but-set-variable]
  int rows = -1;
      ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp: In constructor 'DBresult::DBresult(DBconn*, const string&)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:372:18: error: 'nullptr' was not declared in this scope
  if (m_result != nullptr)
                  ^
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp: In static member function 'static const string CONNinfo::Parse(const string&, std::string*, std::string*, bool)':
/var/lib/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2/connection.cpp:436:30: error: 'nullptr' was not declared in this scope
  char              *errmsg = nullptr;
                              ^
make[3]: *** [CMakeFiles/pgagent.dir/connection.cpp.o] Error 1
make[3]: Leaving directory `/home/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2'
make[2]: *** [CMakeFiles/pgagent.dir/all] Error 2
make[2]: Leaving directory `/home/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/pgsql/rpm15/BUILD/pgagent-pgagent-4.2.2'
error: Bad exit status from /var/tmp/rpm-tmp.aZ1q0W (%install)
akshay-joshi commented 1 year ago

Hi @devrimgunduz

I have tried to build pgAgent on CentOS 7 with GCC version 4.8.5, CMake 3.25.0 (Compile from Source Code), Boost 1.53.0 (Compile from Source Code), PG-14, and it's built/compiles fine without the above-mentioned issue.

akshay-joshi commented 1 year ago

@devrimgunduz Following options/solutions I found on google:

  1. nullptr is a C++11 keyword. On GCC 4.8, you need to switch on C++11 support with -std=c++11
  2. CXX Status, the null pointer constant is a part of GCC 4.6+. You'll have to find a way around using the nullptr constant or update the GCC version(recommended)
srinuperabattula commented 1 year ago

Yes, I also tried building with -std=c++11 and build was successful.

akshay-joshi commented 1 year ago

Thanks, @srinuperabattula, I am closing this issue.