phusion / passenger

A fast and robust web server and application server for Ruby, Python and Node.js
https://www.phusionpassenger.com/
MIT License
5k stars 547 forks source link

4.0.19: ext/common/Utils/StrIntUtils.cpp: The function "round" must have a prototype #1062

Closed FooBarWidget closed 10 years ago

FooBarWidget commented 10 years ago

From mark@ibiblio.org on October 08, 2013 02:54:47

What steps will reproduce the problem? 1. Solaris 10 SPARC using 12.3 Studio compiler and Apache stdcxx 4.2.1 What is the expected output? What do you see instead? CC -xtarget=ultra -m64 -xcode=pic32 -Iext -Iext/common -Iext/libev -KPIC -DSOLARIS2=10 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -I/usr/local/include/apr-1 -I/usr/local/include/apr-1 -I/usr/local/include/ -I/usr/local/include -I/usr/local/apache.httpd.2.4.3/include -D_REENTRANT -I/usr/local/include -D_XOPEN_SOURCE=500 -D_XPG4_2 -DEXTENSIONS -DSOLARIS -D_FILE_OFFSET_BITS=64 -DBOOST_HAS_STDINT_H -DHAS_ALLOCA_H -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -KPIC -I/usr/local/include -mt -library=no%Cstd -L/usr/local/lib -lstdcxx4 -R/usr/local/lib -o buildout/apache2/module_libpassenger_common/Utils/StrIntUtils.o -c ext/common/Utils/StrIntUtils.cpp "ext/common/Exceptions.h", line 70: Warning: briefMessage hides Passenger::SystemException::briefMessage. "ext/common/Exceptions.h", line 227: Warning: errorKind hides Passenger::SpawnException::errorKind. "ext/common/Exceptions.h", line 236: Warning: errorKind hides Passenger::SpawnException::errorKind. "ext/common/Exceptions.h", line 279: Warning: annotations hides Passenger::SpawnException::annotations. "ext/common/StaticString.h", line 136: Warning: len hides Passenger::StaticString::len. "ext/common/Utils/StrIntUtils.cpp", line 495: Warning (Anachronism): Undefined character escape sequence "\e". "ext/common/Utils/StrIntUtils.cpp", line 515: Error: The function "round" must have a prototype. 1 Error(s) and 6 Warning(s) detected. rake aborted! What version of Phusion Passenger are you using? Which version of Rails? On what operating system? Passenger 4.0.19 Rails 4.0.0 Solaris 10 SPARC Sun Studio C/C++ 12.3 Please provide any additional information below. This is the same older error seen here : https://code.google.com/p/phusion-passenger/issues/detail?id=683 The passenger code is essentially assuming GCC/G++ all through it's config files and source code.

The Studio compiler is much stricter to the C++ standard than g++. It also doesn't support the C++11 routines which g++ includes via math.h. So programs with non portable rint() and round() routines etc bomb out.

I've used a round/rint replacement from postgres's src/port/rint.c. This removes the C++11 call and replaces it with standard routines.

--- ext/common/Utils/StrIntUtils.cpp.orig Tue Oct 8 11:31:26 2013 +++ ext/common/Utils/StrIntUtils.cpp Tue Oct 8 11:43:21 2013 @@ -512,7 +512,10 @@ string escapeHTML(const StaticString &input) { string result;

More background can be found here: http://journal.r-project.org/archive/2011-2/RJournal_2011-2_Plummer.pdf

Original issue: http://code.google.com/p/phusion-passenger/issues/detail?id=963

FooBarWidget commented 10 years ago

From honglilai on October 08, 2013 01:56:46

What do you mean by "non-portable round routines"? According to the man page, round() conforms to ISO/IEC 9899:1999(E). Or maybe round() isn't part of the C++ standard that Sun Studio implements?

In this case we don't really care which way we round to, so I've changed round() to ceil().

Status: Fixed
Labels: Milestone-4.0.20

FooBarWidget commented 10 years ago

From honglilai on October 08, 2013 01:58:06

Ah I see the answer is in the PDF you linked to. "Table 1 shows some C functions that were introduced with the C99 standard and are not supported by C++98."

FooBarWidget commented 10 years ago

From mark@ibiblio.org on October 08, 2013 17:28:03

Confirmed fixed.