Hello everybody,
When compiling Inkscape with gcc 3.3 (on OS X but that should not be much of an OS X specific problem) we encounter many errors (Ex: isnan and isnormal not declared, -Wno-pointer-sign option not recognized and some other issues with the inclusion of math.h in some files and of cmath.h in others). All these are quite too technical for me to solve but from my initial research they appear to be somehow related to a compiler version problem. The bottom line is: Does the development team want Inkscape to require gcc >=4 (in which case we'll just upgrade gcc) or do you want to stay backward compatible (in which case I'll report all problems as bugs or on the list)?
Thanks in advance.
JiHO --- http://jo.irisson.free.fr/
jiho wrote:
Hello everybody,
When compiling Inkscape with gcc 3.3 (on OS X but that should not be much of an OS X specific problem) we encounter many errors (Ex: isnan and isnormal not declared, -Wno-pointer-sign option not recognized and some other issues with the inclusion of math.h in some files and of cmath.h in others). All these are quite too technical for me to solve but from my initial research they appear to be somehow related to a compiler version problem. The bottom line is: Does the development team want Inkscape to require gcc >=4 (in which case we'll just upgrade gcc) or do you want to stay backward compatible (in which case I'll report all problems as bugs or on the list)?
Thanks in advance.
isinf.h, isnan.h and isfinite.h seem to give us more problems when it comes to cross-platform stuff than any other. Should we merge them into a single .h, like inkmath.h ?
Also, to keep it organized, maybe we should have a namespace- or class-scoped set of names that we use, rather than use the same names as the lib calls?
Also, you can check for the value of __GNUC__, which would be 3 or 4.
I think on OSX, you get __APPLE__. Mingw is __WIN32__ and __MINGW32__. Looks like on Linux, you get linux and __linux__ (probably better).
bob
To find out your predefined macros, make an empty file, like test.h, then do:
gcc -dM -E test.h
========================================== On Linux, I get:
#define __DBL_MIN_EXP__ (-1021) #define __FLT_MIN__ 1.17549435e-38F #define __CHAR_BIT__ 8 #define __WCHAR_MAX__ 2147483647 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __FLT_EVAL_METHOD__ 2 #define __DBL_MIN_10_EXP__ (-307) #define __FINITE_MATH_ONLY__ 0 #define __GNUC_PATCHLEVEL__ 2 #define __SHRT_MAX__ 32767 #define __LDBL_MAX__ 1.18973149535723176502e+4932L #define __UINTMAX_TYPE__ long long unsigned int #define __linux 1 #define __unix 1 #define __LDBL_MAX_EXP__ 16384 #define __linux__ 1 #define __SCHAR_MAX__ 127 #define __USER_LABEL_PREFIX__ #define __STDC_HOSTED__ 1 #define __LDBL_HAS_INFINITY__ 1 #define __DBL_DIG__ 15 #define __FLT_EPSILON__ 1.19209290e-7F #define __LDBL_MIN__ 3.36210314311209350626e-4932L #define __unix__ 1 #define __DECIMAL_DIG__ 21 #define __gnu_linux__ 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define __GNUC__ 4 #define __DBL_MAX__ 1.7976931348623157e+308 #define __DBL_HAS_INFINITY__ 1 #define __DBL_MAX_EXP__ 1024 #define __LONG_LONG_MAX__ 9223372036854775807LL #define __GXX_ABI_VERSION 1002 #define __FLT_MIN_EXP__ (-125) #define __DBL_MIN__ 2.2250738585072014e-308 #define __DBL_HAS_QUIET_NAN__ 1 #define __tune_i386__ 1 #define __REGISTER_PREFIX__ #define __NO_INLINE__ 1 #define __i386 1 #define __FLT_MANT_DIG__ 24 #define __VERSION__ "4.0.2 20051125 (Red Hat 4.0.2-8)" #define i386 1 #define unix 1 #define __i386__ 1 #define __SIZE_TYPE__ unsigned int #define __ELF__ 1 #define __FLT_RADIX__ 2 #define __LDBL_EPSILON__ 1.08420217248550443401e-19L #define __GNUC_RH_RELEASE__ 8 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MAX_10_EXP__ 38 #define __LONG_MAX__ 2147483647L #define __FLT_HAS_INFINITY__ 1 #define linux 1 #define __LDBL_MANT_DIG__ 64 #define __WCHAR_TYPE__ long int #define __FLT_DIG__ 6 #define __INT_MAX__ 2147483647 #define __FLT_MAX_EXP__ 128 #define __DBL_MANT_DIG__ 53 #define __WINT_TYPE__ unsigned int #define __LDBL_MIN_EXP__ (-16381) #define __LDBL_MAX_10_EXP__ 4932 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define __INTMAX_MAX__ 9223372036854775807LL #define __FLT_DENORM_MIN__ 1.40129846e-45F #define __FLT_MAX__ 3.40282347e+38F #define __FLT_MIN_10_EXP__ (-37) #define __INTMAX_TYPE__ long long int #define __GNUC_MINOR__ 0 #define __DBL_MAX_10_EXP__ 308 #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L #define __PTRDIFF_TYPE__ int #define __LDBL_MIN_10_EXP__ (-4931) #define __LDBL_DIG__ 18
========================================== On Mingw/Win32, I get:
#define __DBL_MIN_EXP__ (-1021) #define _IOSTRG 0x0040 #define _GLIBCXX_SJLJ_EXCEPTIONS 1 #define __FLT_MIN__ 1.17549435e-38F #define _T_WCHAR_ #define _GLIBCXX_HAVE_COPYSIGNF 1 #define _GLIBCXX_HAVE_COPYSIGNL 1 #define __CHAR_BIT__ 8 #define __MINGW32_VERSION 3.11 #define _GLIBCXX_HAVE_LOCALE_H 1 #define _FILE_DEFINED #define __MINGW_IMPORT extern __attribute__ ((__dllimport__)) #define stderr (&_iob[STDERR_FILENO]) #define __WCHAR_MAX__ 65535U #define _GLIBCXX_USE_LONG_LONG 1 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define _IOFBF 0x0000 #define _GLIBCXX_HAVE_COSHF 1 #define __FLT_EVAL_METHOD__ 2 #define _GLIBCXX_HAVE_FMODF 1 #define _GLIBCXX_HAVE_SYS_STAT_H 1 #define _WINT_T #define _GLIBCXX_PACKAGE_NAME "package-unused" #define __VALIST __gnuc_va_list #define _OFF64_T_ #define __MINGW_ATTRIB_CONST __attribute__ ((__const__)) #define __DBL_MIN_10_EXP__ (-307) #define __FINITE_MATH_ONLY__ 0 #define _GLIBCXX_USE_WCHAR_T 1 #define __STDDEF_H__ #define __GNUC_PATCHLEVEL__ 1 #define __size_t #define _GLIBCXX_HAVE_FREXPF 1 #define _GLIBCXX_HAVE_FREXPL 1 #define _stdcall __attribute__((__stdcall__)) #define _WCHAR_T_DEFINED #define _MODE_T_ #define _GLIBCXX_HAVE_COSHL 1 #define __SHRT_MAX__ 32767 #define __LDBL_MAX__ 1.18973149535723176502e+4932L #define _GLIBCXX_USE_C99_COMPLEX 1 #define _GLIBCXX_CPU_DEFINES 1 #define _GLIBCXX_HAVE_LIBM 1 #define _GLIBCXX_HAVE___SIGNBIT 1 #define _GLIBCXX_SIZE_T_IS_UINT 1 #define _GLIBCXX_HAVE_MODF 1 #define __UINTMAX_TYPE__ long long unsigned int #define _GLIBCXX_OS_DEFINES #define _GLIBCXX_HAVE_SYS_TIME_H 1 #define __SIZE_T #define __LDBL_MAX_EXP__ 16384 #define _GLIBCXX_HAVE_STRTOLD 1 #define _GLIBCXX_HAVE___BUILTIN_SIN 1 #define _SIZE_T_DEFINED_ #define __SCHAR_MAX__ 127 #define _CXXCONFIG 1 #define __INT_WCHAR_T_H #define _TIME_T_DEFINED #define _GLIBCXX_HAVE_ATAN2L 1 #define _GLIBCXX_HAVE___BUILTIN_ABS 1 #define __USER_LABEL_PREFIX__ _ #define _GLIBCXX_HAVE_TANL 1 #define __STDC_HOSTED__ 1 #define __LDBL_HAS_INFINITY__ 1 #define _STDIO_H_ #define _WSTDIO_DEFINED #define _BSD_SIZE_T_DEFINED_ #define __DBL_DIG__ 15 #define __FLT_EPSILON__ 1.19209290e-7F #define __GXX_WEAK__ 1 #define __tune_i686__ 1 #define TMP_MAX 32767 #define __LDBL_MIN__ 3.36210314311209350626e-4932L #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__)) #define _GLIBCXX_HAVE_FMODL 1 #define _ANSI_STDDEF_H #define _WCHAR_T_ #define _STDDEF_H #define _IONBF 0x0004 #define _GLIBCXX_HAVE_MODFF 1 #define _GLIBCXX_HAVE_MODFL 1 #define __DECIMAL_DIG__ 21 #define _GLIBCXX_HAVE___BUILTIN_FABSF 1 #define _GLIBCXX_HAVE___BUILTIN_FABSL 1 #define _GLIBCXX_HAVE_HYPOTF 1 #define _GLIBCXX_HAVE_HYPOTL 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define _GLIBCXX_HAVE_FABSF 1 #define _GLIBCXX_HAVE_FABSL 1 #define _GLIBCXX_HAVE_POWF 1 #define _GLIBCXX_HAVE_POWL 1 #define L_tmpnam (16) #define ___int_wchar_t_h #define _T_PTRDIFF #define __GNUC__ 4 #define _cdecl __attribute__((__cdecl__)) #define offsetof(TYPE,MEMBER) __builtin_offsetof (TYPE, MEMBER) #define SEEK_CUR (1) #define _GLIBCXX_HAVE___BUILTIN_COSF 1 #define __MINGW32_MINOR_VERSION 11 #define STDERR_FILENO 2 #define _GLIBCXX_HAVE_WCHAR_H 1 #define _GLIBCXX_HAVE_S_ISREG 1 #define _FUNCTION_H 1 #define __DBL_MAX__ 1.7976931348623157e+308 #define __WINNT 1 #define __DBL_HAS_INFINITY__ 1 #define __WINNT__ 1 #define stdin (&_iob[STDIN_FILENO]) #define _GLIBCXX_HAVE_COSF 1 #define __CRT_INLINE inline #define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused" #define _SIZE_T_DEFINED #define _WCHAR_T_DEFINED_ #define _fastcall __attribute__((__fastcall__)) #define _GLIBCXX_PTRDIFF_T_IS_INT 1 #define _DEV_T_ #define __cplusplus 1 #define __USING_SJLJ_EXCEPTIONS__ 1 #define __DEPRECATED 1 #define _TYPES_H_ #define __DBL_MAX_EXP__ 1024 #define __WIN32__ 1 #define _GLIBCXX_HAVE_ATAN2F 1 #define __GNUG__ 4 #define _T_WCHAR #define __LONG_LONG_MAX__ 9223372036854775807LL #define __GLIBCXX__ 20060524 #define _WCHAR_T #define _GLIBCXX_HAVE___BUILTIN_COSL 1 #define _GCC_WCHAR_T #define _TIME64_T_DEFINED #define _PTRDIFF_T #define _GLIBCXX_HOSTED 1 #define __GXX_ABI_VERSION 1002 #define _GLIBCXX_HAVE___BUILTIN_SQRTF 1 #define __FLT_MIN_EXP__ (-125) #define _GLIBCXX_HAVE___BUILTIN_SQRTL 1 #define __PTRDIFF_T #define _BSD_SIZE_T_ #define _GLIBCXX_HAVE_SINHF 1 #define _GLIBCXX_HAVE_SINHL 1 #define _GLIBCXX_HAVE_SQRTF 1 #define _GLIBCXX_HAVE_SQRTL 1 #define fileno(__F) ((__F)->_file) #define __DBL_MIN__ 2.2250738585072014e-308 #define _SSIZE_T_ #define __FLT_MIN_10_EXP__ (-37) #define __DBL_HAS_QUIET_NAN__ 1 #define _FPOS64_T_ #define _GLIBCXX_HAVE___BUILTIN_SINF 1 #define _GLIBCXX_HAVE___BUILTIN_SINL 1 #define _P_tmpdir "\" #define _GLIBCXX_HAVE_STRINGS_H 1 #define __small char #define __REGISTER_PREFIX__ #define _IOMYBUF 0x0008 #define __cdecl __attribute__((__cdecl__)) #define __NO_INLINE__ 1 #define __i386 1 #define __FLT_MANT_DIG__ 24 #define _GLIBCXX_HAVE_COMPLEX_H 1 #define __VERSION__ "4.1.1" #define _GLIBCXX_HAVE_INT64_T 1 #define _PTRDIFF_T_ #define _GLIBCXX_HAVE_TANHF 1 #define _GLIBCXX_HAVE_TANHL 1 #define _WIN32 1 #define _IOREAD 1 #define _GLIBCXX_HAVE_GETPAGESIZE 1 #define _GLIBCXX_PACKAGE_BUGREPORT "" #define __int16 short #define _GLIBCXX_HAVE_ATANF 1 #define _T_PTRDIFF_ #define __int32 long #define _GLIBCXX_CSTDDEF 1 #define _GLIBCXX_HAVE_HYPOT 1 #define _X86_ 1 #define _SYS_SIZE_T_H #define __int64 long long #define _CRTIMP #define __SIZE_T__ #define __MSVCRT_VERSION__ 0x0600 #define i386 1 #define _GLIBCXX_WEAK_DEFINITION #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg))) #define _GLIBCXX_USE_C99_MATH 1 #define _GLIBCXX_HAVE_GTHR_DEFAULT 1 #define STDC_HEADERS 1 #define _GLIBCXX_HAVE___BUILTIN_FABS 1 #define _GLIBCXX_HAVE_STRING_H 1 #define __i386__ 1 #define __UNUSED_PARAM(x) #define __SIZE_TYPE__ unsigned int #define _SIZE_T_DECLARED #define _IORW 0x0080 #define _GLIBCXX_HAVE_MBSTATE_T 1 #define __FLT_RADIX__ 2 #define __LDBL_EPSILON__ 1.08420217248550443401e-19L #define _fileno(__F) ((__F)->_file) #define _GLIBCXX_EXTERN_TEMPLATE 1 #define SEEK_SET (0) #define NOMINMAX 1 #define _OFF_T_ #define _GLIBCXX_HAVE_COSL 1 #define __hyper long long #define __LDBL_DIG__ 18 #define _SIZE_T_ #define _WCHAR_T_H #define __MSVCRT__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MAX_10_EXP__ 38 #define _GLIBCXX_HAVE_FLOORF 1 #define _GLIBCXX_HAVE_FLOORL 1 #define __LONG_MAX__ 2147483647L #define _GLIBCXX_HAVE___BUILTIN_SQRT 1 #define __WCHAR_T__ #define __FLT_HAS_INFINITY__ 1 #define _BSD_PTRDIFF_T_ #define _GLIBCXX_HAVE___SIGNBITF 1 #define _GLIBCXX_HAVE___SIGNBITL 1 #define NULL __null #define _INO_T_ #define _GLIBCXX_HAVE_SINF 1 #define _GLIBCXX_HAVE_SINL 1 #define _GLIBCXX_HAVE_VSWSCANF 1 #define _GLIBCXX_HAVE_ISNAN 1 #define _GLIBCXX_HAVE_WCTYPE_H 1 #define _IOLBF 0x0040 #define _GLIBCXX_HAVE_LDEXPF 1 #define __stdcall __attribute__((__stdcall__)) #define _GLIBCXX_HAVE___BUILTIN_LABS 1 #define __EXCEPTIONS 1 #define __GXX_MERGED_TYPEINFO_NAMES 0 #define __LDBL_MANT_DIG__ 64 #define _GLIBCXX_HAVE_INTTYPES_H 1 #define __GNUC_VA_LIST #define FILENAME_MAX (260) #define __WCHAR_TYPE__ short unsigned int #define _GLIBCXX_PACKAGE_TARNAME "libstdc++" #define _GLIBCXX_USE_C99 1 #define __MINGW_H #define _GLIBCXX_HAVE_WCSTOF 1 #define BUFSIZ 512 #define __FLT_DIG__ 6 #define _WCHAR_T_DECLARED #define _GLIBCXX_HAVE_STRTOF 1 #define STDIN_FILENO 0 #define _GLIBCXX_HAVE_MEMORY_H 1 #define __INT_MAX__ 2147483647 #define WIN32 1 #define _T_SIZE_ #define __MINGW32__ 1 #define __FLT_MAX_EXP__ 128 #define _GLIBCXX_HAVE_STDINT_H 1 #define __DBL_MANT_DIG__ 53 #define ___int_size_t_h #define _IOWRT 2 #define __WINT_TYPE__ short unsigned int #define STDOUT_FILENO 1 #define _PID_T_ #define __LDBL_MIN_EXP__ (-16381) #define _GLIBCXX_HAVE_LOGF 1 #define _GLIBCXX_HAVE_LOGL 1 #define _GLIBCXX_HAVE_EXPF 1 #define _GLIBCXX_HAVE_EXPL 1 #define _GLIBCXX_HAVE___BUILTIN_COS 1 #define stdout (&_iob[STDOUT_FILENO]) #define EOF (-1) #define __WIN32 1 #define _GLIBCXX_HAVE_LOG10F 1 #define _GLIBCXX_HAVE_LOG10L 1 #define _wP_tmpdir L"\" #define __WCHAR_UNSIGNED__ 1 #define __LDBL_MAX_10_EXP__ 4932 #define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define __GTHREAD_HIDE_WIN32API 1 #define _SIZET_ #define _SIGSET_T_ #define _GLIBCXX_HAVE_CEILF 1 #define _GLIBCXX_HAVE_CEILL 1 #define __wchar_t__ #define SEEK_END (2) #define __tune_pentiumpro__ 1 #define __MINGW32_MAJOR_VERSION 3 #define _STDDEF_H_ #define _GLIBCXX_HAVE_FPCLASS 1 #define __fastcall __attribute__((__fastcall__)) #define __MINGW_GNUC_PREREQ(major,minor) (__GNUC__ > (major) || (__GNUC__ == (ma jor) && __GNUC_MINOR__ >= (minor))) #define _GLIBCXX_HAVE_TANF 1 #define _IOEOF 0x0010 #define _GLIBCXX_HAVE_STDLIB_H 1 #define P_tmpdir _P_tmpdir #define _GLIBCXX_FUNCTIONAL 1 #define _IOERR 0x0020 #define _SIZE_T #define _GLIBCXX_FAST_MATH 0 #define FOPEN_MAX (20) #define _GLIBCXX_HAVE_LDEXPL 1 #define _GCC_SIZE_T #define __INTMAX_MAX__ 9223372036854775807LL #define __size_t__ #define WINNT 1 #define __FLT_DENORM_MIN__ 1.40129846e-45F #define _GLIBCXX_HAVE_FINITE 1 #define _GLIBCXX_HAVE_FLOAT_H 1 #define _GLIBCXX_HAVE_ATANL 1 #define __FLT_MAX__ 3.40282347e+38F #define _GLIBCXX_HAVE_VFWSCANF 1 #define __int8 char #define _GLIBCXX_HAVE_SYS_TYPES_H 1 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__)) #define __INTMAX_TYPE__ long long int #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__)) #define _T_SIZE #define _GLIBCXX_HAVE_ACOSF 1 #define _GLIBCXX_HAVE_ACOSL 1 #define _GLIBCXX_HAVE_COPYSIGN 1 #define __GNUC_MINOR__ 1 #define __DECLSPEC_SUPPORTED #define __DBL_MAX_10_EXP__ 308 #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L #define _GLIBCXX_STD std #define __STDC__ 1 #define _GLIBCXX_HAVE_VWSCANF 1 #define __PTRDIFF_TYPE__ int #define __LDBL_MIN_10_EXP__ (-4931) #define _GLIBCXX_HAVE_ASINF 1 #define _GLIBCXX_HAVE_ASINL 1 #define _GCC_PTRDIFF_T #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__)) #define ___int_ptrdiff_t_h #define _GLIBCXX_HAVE_UNISTD_H 1 #define __N(msgid) (msgid) #define __WCHAR_T #define __declspec(x) __attribute__((x)) #define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
On Sat, 17 Mar 2007 07:13:35 -0500 Bob Jamison <rwjj@...127...> wrote:
first, sorry for the late reply,
isinf.h, isnan.h and isfinite.h seem to give us more problems when it comes to cross-platform stuff than any other. Should we merge them into a single .h, like inkmath.h ?
Having had those troubles on gcc-3.2/solaris 8 i'd highly appreciate this suggestion.
Also, to keep it organized, maybe we should have a namespace- or class-scoped set of names that we use, rather than use the same names as the lib calls?
From a C++ point of view this surely is the cleaner solution.
OTOH someone might ask whether it was sufficient and harmless enough to just provide - where needed - the missing calls with their (std::) names and not to bother the main inkscape feature developer (who had to use something like Inkscape::Math::isnan() instead of isnan() otherwise) with those issues.
So I'd like to ask which solution should be preferred:
a) no separate namespace, same names
#if SOME_SPECIFIC_PLATFORM_AND_GCC_VERSION #define isnan(x) __isnan(x) #endif
--> usage example:
a=isnan(b);
b) separate namespace, same function names
namespace Inkscape { namespace Math { inline int isnan(double x) #if SOME_SPECIFIC_PLATFORM_AND_GCC_VERSION { return __isnan(x); } #else { return std::isnan(x); } #endif
} }
--> usage examples: a = Inkscape::Math::isnan(b);
or: namespace IM=Inkscape::Math; a = IM::isnan(b);
--> disatvantage:
using Inkscape::Math::isnan
... will not work on platforms which have std::isnan defined.
c) separate namespace, new function names
namespace Inkscape { namespace Math { inline int IsNan(double x) #if SOME_SPECIFIC_PLATFORM_AND_GCC_VERSION { return __isnan(x); } #else { return std::isnan(x); } #endif
} }
--> advantage:
using Inkscape::Math::IsNan ... will work.
Personally, I'd prefer c).
Markus Schwarzenberg
There was a wrong quote in my previous mail:
On Tue, 27 Mar 2007 09:34:41 +0200 Markus Schwarzenberg <Markus.Schwarzenberg@...1674...> wrote:
On Sat, 17 Mar 2007 07:13:35 -0500 Bob Jamison <rwjj@...127...> wrote:
...
Also, to keep it organized, maybe we should have a namespace- or class-scoped set of names that we use, rather than use the same names as the lib calls?
From a C++ point of view this surely is the cleaner solution.
OTOH someone might ask whether it was sufficient and harmless enough to just provide - where needed - the missing calls with their (std::) names and not to bother the main inkscape feature developer (who had to use something like Inkscape::Math::isnan()
...
Markus
On Sat, Mar 17, 2007 at 10:16:05AM +0100, jiho wrote:
to a compiler version problem. The bottom line is: Does the development team want Inkscape to require gcc >=4 (in which case we'll just upgrade gcc) or do you want to stay backward compatible (in which case I'll report all problems as bugs or on the list)?
We need to stay compatible with gcc 3.x for the time being. So report problems as bugs.
Bryce
participants (4)
-
Bob Jamison
-
Bryce Harrington
-
jiho
-
Markus Schwarzenberg