jcrodriguez-dis / vpl-jail-system

Execution/jail server for VPL
GNU General Public License v3.0
23 stars 22 forks source link

Error compiling vpl-jail-server: 'nullptr' was not declared in this scope #80

Open olberger opened 3 months ago

olberger commented 3 months ago

Hi.

A colleague of mine tried to install an update (version 4.0.3) and got this trace.

Any hints on what could be wrong there (compiler / libs ?) ?

Thanks in advance

# ./install-vpl-sh update
Running with parameters: update
Using DNF package manager
Upgrading installed software
Using systemd service manager
Installation log file => /var/log/vpl_installation.log
Preparing daemon compilation
Compiling daemon (vpl-jail-server)
In file included from util.h:30:0,
                 from socket.h:21,
                 from httpServer.h:12,
                 from xml.h:17,
                 from rpc.h:10,
                 from xmlrpc.h:10,
                 from jail.h:9,
                 from vpl-jail-server.h:20,
                 from main.cpp:8:
log.h:57:7: attention : identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
       time_t currentTime = time(nullptr);
       ^
log.h: In static member function ‘static void Logger::log(int, const char*, ...)’:
log.h:57:33: erreur: ‘nullptr’ was not declared in this scope
       time_t currentTime = time(nullptr);
                                 ^
In file included from socket.h:21:0,
                 from httpServer.h:12,
                 from xml.h:17,
                 from rpc.h:10,
                 from xmlrpc.h:10,
                 from jail.h:9,
                 from vpl-jail-server.h:20,
                 from main.cpp:8:
util.h: In static member function ‘static std::string Util::URLdecode(const string&)’:
util.h:699:36: erreur: ‘strtol’ is not a member of ‘std’
     char value = static_cast<char>(std::strtol(hex.c_str(), nullptr, 16));
                                    ^
util.h:699:36: note: suggested alternative:
In file included from xml.h:9:0,
                 from rpc.h:10,
                 from xmlrpc.h:10,
                 from jail.h:9,
                 from vpl-jail-server.h:20,
                 from main.cpp:8:
/usr/include/stdlib.h:183:17: note:   ‘strtol’
 extern long int strtol (const char *__restrict __nptr,
                 ^
In file included from socket.h:21:0,
                 from httpServer.h:12,
                 from xml.h:17,
                 from rpc.h:10,
                 from xmlrpc.h:10,
                 from jail.h:9,
                 from vpl-jail-server.h:20,
                 from main.cpp:8:
util.h:699:61: erreur: ‘nullptr’ was not declared in this scope
     char value = static_cast<char>(std::strtol(hex.c_str(), nullptr, 16));
                                                             ^
make[2]: *** [main.o] Erreur 1
make[1]: *** [all-recursive] Erreur 1
make: *** [all] Erreur 2
Updating installation => /etc/vpl
Error compiling vpl-jail-server. See logs for more details
jcrodriguez-dis commented 3 months ago

Dear @olberger,

To replicate the problem, we need to know the C++ compiler version you are using. Without that information, it is speculative to diagnose the issue and provide a solution.

At first glance, it seems that a recent update has introduced changes related to the detection of C++ compiler capabilities, which may not be working well with your current compiler. Specifically, the changes conditionally set CXXFLAGS += -std=c++11 based on whether the C++ compiler supports C++17.

To revert the last update, please modify the src/Makefile.am as follows:

  1. Go to line 21.
  2. Copy the contents of line 24 to line 21.
  3. Try to install again.

This should help bypass the issue temporarily. If the problem persists, please provide the C++ compiler version, and we will investigate further.

Best regards,
Juan Carlos

olberger commented 3 months ago

Hi.

To revert the last update, please modify the src/Makefile.am as follows:

1. Go to line 21.

2. Copy the contents of line 24 to line 21.

3. Try to install again.

This should help bypass the issue temporarily. If the problem persists, please provide the C++ compiler version, and we will investigate further.

Best regards, Juan Carlos

Thanks. I haven't had more details about which compiler we use, but my colleague confirmed that this workaround solved the issue. Thanks.

I'll try and report more details.

All the best.

olberger commented 3 months ago

FWIW, it seems we use:

# g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

If I'm not mistaken this may help identify the details