1. 19 10月, 2018 1 次提交
    • T
      Still further rethinking of build changes for macOS Mojave. · 0749acca
      Tom Lane 提交于
      To avoid the sorts of problems complained of by Jakob Egger, it'd be
      best if configure didn't emit any references to the sysroot path at all.
      In the case of PL/Tcl, we can do that just by keeping our hands off the
      TCL_INCLUDE_SPEC string altogether.  In the case of PL/Perl, we need to
      substitute -iwithsysroot for -I in the compile commands, which is easily
      handled if we change to using a configure output variable that includes
      the switch not only the directory name.  Since PL/Tcl and PL/Python
      already do it like that, this seems like good consistency cleanup anyway.
      
      Hence, this replaces the advice given to Perl-related extensions in commit
      5e221713; instead of writing "-I$(perl_archlibexp)/CORE", they should
      just write "$(perl_includespec)".  (The old way continues to work, but not
      on recent macOS.)
      
      It's still the case that configure needs to be aware of the sysroot
      path internally, but that's cleaner than what we had before.
      
      As before, back-patch to all supported versions.
      
      Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
      0749acca
  2. 17 10月, 2018 1 次提交
    • T
      Back off using -isysroot on Darwin. · 486e6f8d
      Tom Lane 提交于
      Rethink the solution applied in commit 5e221713 to get PL/Tcl to
      build on macOS Mojave.  I feared that adding -isysroot globally might
      have undesirable consequences, and sure enough Jakob Egger reported
      one: it complicates building extensions with a different Xcode version
      than was used for the core server.  (I find that a risky proposition
      in general, but apparently it works most of the time, so we shouldn't
      break it if we don't have to.)
      
      We'd already adopted the solution for PL/Perl of inserting the sysroot
      path directly into the -I switches used to find Perl's headers, and we
      can do the same thing for PL/Tcl by changing the -iwithsysroot switch
      that Apple's tclConfig.sh reports.  This restricts the risks to PL/Perl
      and PL/Tcl themselves and directly-dependent extensions, which is a lot
      more pleasing in general than a global -isysroot switch.
      
      Along the way, tighten the test to see if we need to inject the sysroot
      path into $perl_includedir, as I'd speculated about upthread but not
      gotten round to doing.
      
      As before, back-patch to all supported versions.
      
      Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
      486e6f8d
  3. 01 10月, 2018 1 次提交
    • T
      Fix detection of the result type of strerror_r(). · e5baf8c2
      Tom Lane 提交于
      The method we've traditionally used, of redeclaring strerror_r() to
      see if the compiler complains of inconsistent declarations, turns out
      not to work reliably because some compilers only report a warning,
      not an error.  Amazingly, this has gone undetected for years, even
      though it certainly breaks our detection of whether strerror_r
      succeeded.
      
      Let's instead test whether the compiler will take the result of
      strerror_r() as a switch() argument.  It's possible this won't
      work universally either, but it's the best idea I could come up with
      on the spur of the moment.
      
      Back-patch of commit 751f532b.  Buildfarm results indicate that only
      icc-on-Linux actually has an issue here; perhaps the lack of field
      reports indicates that people don't build PG for production that way.
      
      Discussion: https://postgr.es/m/10877.1537993279@sss.pgh.pa.us
      e5baf8c2
  4. 26 9月, 2018 1 次提交
    • T
      Make some fixes to allow building Postgres on macOS 10.14 ("Mojave"). · a5361b59
      Tom Lane 提交于
      Apple's latest rearrangements of the system-supplied headers have broken
      building of PL/Perl and PL/Tcl.  The only practical way to fix PL/Tcl is to
      start using the "-isysroot" compiler flag to point to SDK-supplied headers,
      as Apple expects.  We must also start distinguishing where to find Perl's
      headers from where to find its shared library; but that seems like good
      cleanup anyway.
      
      Extensions that formerly did something like -I$(perl_archlibexp)/CORE
      should now do -I$(perl_includedir)/CORE instead.  perl_archlibexp
      is still the place to look for libperl.so, though.
      
      If for some reason you don't like the default -isysroot setting, you can
      override that by setting PG_SYSROOT in configure's arguments.  I don't
      currently think people would need to do so, unless maybe for cross-version
      build purposes.
      
      In addition, teach configure where to find tclConfig.sh.  Our traditional
      method of searching $auto_path hasn't worked for the last couple of macOS
      releases, and it now seems clear that Apple's not going to change that.
      The workaround of manually specifying --with-tclconfig was annoying
      already, but Mojave's made it a lot more so because the sysroot path now
      has to be included as well.  Let's just wire the knowledge into configure
      instead.  To avoid breaking builds against non-default Tcl installations
      (e.g. MacPorts) wherein the $auto_path method probably still works,
      arrange to try the additional case only after all else has failed.
      
      Back-patch to all supported versions, since at least the buildfarm
      cares about that.  The changes are set up to not do anything on macOS
      releases that are old enough to not have functional sysroot trees.
      a5361b59
  5. 21 9月, 2018 1 次提交
    • A
      Error out for clang on x86-32 without SSE2 support, no -fexcess-precision. · 29196e13
      Andres Freund 提交于
      As clang currently doesn't support -fexcess-precision=standard,
      compiling x86-32 code with SSE2 disabled, can lead to problems with
      floating point overflow checks and the like.
      
      This issue was noticed because clang, on at least some BSDs, defaults
      to i386 compatibility, whereas it defaults to pentium4 on Linux.  Our
      forced usage of __builtin_isinf() lead to some overflow checks not
      triggering when compiling for i386, e.g. when the result of the
      calculation didn't overflow in 80bit registers, but did so in 64bit.
      
      While we could just fall back to a non-builtin isinf, it seems likely
      that the use of 80bit registers leads to other problems (which is why
      we force the flag for GCC already).  Therefore error out when
      detecting clang in that situation.
      
      Reported-By: Victor Wagner
      Analyzed-By: Andrew Gierth and Andres Freund
      Author: Andres Freund
      Discussion: https://postgr.es/m/20180905005130.ewk4xcs5dgyzcy45@alap3.anarazel.de
      Backpatch: 9.3-, all supported versions are affected
      29196e13
  6. 07 8月, 2018 1 次提交
  7. 17 6月, 2018 1 次提交
  8. 20 5月, 2018 1 次提交
  9. 19 5月, 2018 1 次提交
    • T
      Arrange to supply declarations for strtoll/strtoull if needed. · 023aa76e
      Tom Lane 提交于
      Buildfarm member dromedary is still unhappy about the recently-added
      ecpg "long long" tests.  The reason turns out to be that it includes
      "-ansi" in its CFLAGS, and in their infinite wisdom Apple have decided
      to hide the declarations of strtoll/strtoull in C89-compliant builds.
      (I find it pretty curious that they hide those function declarations
      when you can nonetheless declare a "long long" variable, but anyway
      that is their behavior, both on dromedary's obsolete macOS version and
      the newest and shiniest.)  As a result, gcc assumes these functions
      return "int", leading naturally to wrong results.
      
      (Looking at dromedary's past build results, it's evident that this
      problem also breaks pg_strtouint64() on 32-bit platforms; but we
      evidently have no regression tests that exercise that function with
      values above 32 bits.)
      
      To fix, supply declarations for these functions when the platform
      provides the functions but not the declarations, using the same type
      of mechanism as we use for some other similar cases.
      
      Discussion: https://postgr.es/m/151935568942.1461.14623890240535309745@wrigleys.postgresql.org
      023aa76e
  10. 08 5月, 2018 1 次提交
  11. 27 2月, 2018 1 次提交
  12. 06 2月, 2018 1 次提交
  13. 24 11月, 2017 1 次提交
  14. 10 11月, 2017 1 次提交
  15. 09 11月, 2017 1 次提交
  16. 07 11月, 2017 1 次提交
  17. 26 9月, 2017 1 次提交
    • T
      Avoid SIGBUS on Linux when a DSM memory request overruns tmpfs. · 3a07a6f3
      Tom Lane 提交于
      On Linux, shared memory segments created with shm_open() are backed by
      swap files created in tmpfs.  If the swap file needs to be extended,
      but there's no tmpfs space left, you get a very unfriendly SIGBUS trap.
      To avoid this, force allocation of the full request size when we create
      the segment.  This adds a few cycles, but none that we wouldn't expend
      later anyway, assuming the request isn't hugely bigger than the actual
      need.
      
      Make this code #ifdef __linux__, because (a) there's not currently a
      reason to think the same problem exists on other platforms, and (b)
      applying posix_fallocate() to an FD created by shm_open() isn't very
      portable anyway.
      
      Back-patch to 9.4 where the DSM code came in.
      
      Thomas Munro, per a bug report from Amul Sul
      
      Discussion: https://postgr.es/m/1002664500.12301802.1471008223422.JavaMail.yahoo@mail.yahoo.com
      3a07a6f3
  18. 02 9月, 2017 1 次提交
    • T
      Make [U]INT64CONST safe for use in #if conditions. · 53863ebe
      Tom Lane 提交于
      Instead of using a cast to force the constant to be the right width,
      assume we can plaster on an L, UL, LL, or ULL suffix as appropriate.
      The old approach to this is very hoary, dating from before we were
      willing to require compilers to have working int64 types.
      
      This fix makes the PG_INT64_MIN, PG_INT64_MAX, and PG_UINT64_MAX
      constants safe to use in preprocessor conditions, where a cast
      doesn't work.  Other symbolic constants that might be defined using
      [U]INT64CONST are likewise safer than before.
      
      Also fix the SIZE_MAX macro to be similarly safe, if we are forced
      to provide a definition for that.  The test added in commit 2e70d6b5
      happens to do what we want even with the hack "(size_t) -1" definition,
      but we could easily get burnt on other tests in future.
      
      Back-patch to all supported branches, like the previous commits.
      
      Discussion: https://postgr.es/m/15883.1504278595@sss.pgh.pa.us
      53863ebe
  19. 29 8月, 2017 1 次提交
  20. 14 8月, 2017 1 次提交
    • T
      Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant. · 01de7ea8
      Tom Lane 提交于
      Commit 3c163a7f's original choice to ignore all #define symbols whose
      names begin with underscore turns out to be too simplistic.  On Windows,
      some Perl installations are built with -D_USE_32BIT_TIME_T, and we must
      absorb that or we get the wrong result for sizeof(PerlInterpreter).
      
      This effectively re-reverts commit ef58b87d, which injected that symbol
      in a hacky way, making it apply to all of Postgres not just PL/Perl.
      More significantly, it did so on *all* 32-bit Windows builds, even when
      the Perl build to be used did not select this option; so that it fails
      to work properly with some newer Perl builds.
      
      By making this change, we would be introducing an ABI break in 32-bit
      Windows builds; but fortunately we have not used type time_t in any
      exported Postgres APIs in a long time.  So it should be OK, both for
      PL/Perl itself and for third-party extensions, if an extension library
      is built with a different _USE_32BIT_TIME_T setting than the core code.
      
      Patch by me, based on research by Ashutosh Sharma and Robert Haas.
      Back-patch to all supported branches, as commit 3c163a7f was.
      
      Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
      01de7ea8
  21. 08 8月, 2017 1 次提交
  22. 01 8月, 2017 1 次提交
  23. 09 5月, 2017 1 次提交
  24. 16 4月, 2017 1 次提交
  25. 07 2月, 2017 1 次提交
  26. 06 2月, 2017 1 次提交
  27. 25 10月, 2016 1 次提交
  28. 09 8月, 2016 1 次提交
  29. 10 5月, 2016 1 次提交
  30. 02 5月, 2016 1 次提交
    • T
      Fix configure's incorrect version tests for flex and perl. · 1ba87450
      Tom Lane 提交于
      awk's equality-comparison operator is "==" not "=".  We got this right
      in many places, but not in configure's checks for supported version
      numbers of flex and perl.  It hadn't been noticed because unsupported
      versions are so old as to be basically extinct in the wild, and because
      the only consequence is whether or not a WARNING flies by during
      configure.
      
      Daniel Gustafsson noted the problem with respect to the test for flex,
      I found the other by reviewing other awk calls.
      1ba87450
  31. 29 3月, 2016 1 次提交
  32. 16 3月, 2016 1 次提交
    • T
      Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>. · 00fd4349
      Tom Lane 提交于
      Previously, we included <xlocale.h> only if necessary to get the definition
      of type locale_t.  According to notes in PGAC_TYPE_LOCALE_T, this is
      important because on some versions of glibc that file supplies an
      incompatible declaration of locale_t.  (This info may be obsolete, because
      on my RHEL6 box that seems to be the *only* definition of locale_t; but
      there may still be glibc's in the wild for which it's a live concern.)
      
      It turns out though that on FreeBSD and maybe other BSDen, you can get
      locale_t from stdlib.h or locale.h but mbstowcs_l() and friends only from
      <xlocale.h>.  This was leaving us compiling calls to mbstowcs_l() and
      friends with no visible prototype, which causes a warning and could
      possibly cause actual trouble, since it's not declared to return int.
      
      Hence, adjust the configure checks so that we'll include <xlocale.h>
      either if it's necessary to get type locale_t or if it's necessary to
      get a declaration of mbstowcs_l().
      
      Report and patch by Aleksander Alekseev, somewhat whacked around by me.
      Back-patch to all supported branches, since we have been using
      mbstowcs_l() since 9.1.
      00fd4349
  33. 09 2月, 2016 1 次提交
  34. 17 12月, 2015 1 次提交
    • T
      Cope with Readline's failure to track SIGWINCH events outside of input. · e168dfef
      Tom Lane 提交于
      It emerges that libreadline doesn't notice terminal window size change
      events unless they occur while collecting input.  This is easy to stumble
      over if you resize the window while using a pager to look at query output,
      but it can be demonstrated without any pager involvement.  The symptom is
      that queries exceeding one line are misdisplayed during subsequent input
      cycles, because libreadline has the wrong idea of the screen dimensions.
      
      The safest, simplest way to fix this is to call rl_reset_screen_size()
      just before calling readline().  That causes an extra ioctl(TIOCGWINSZ)
      for every command; but since it only happens when reading from a tty, the
      performance impact should be negligible.  A more valid objection is that
      this still leaves a tiny window during entry to readline() wherein delivery
      of SIGWINCH will be missed; but the practical consequences of that are
      probably negligible.  In any case, there doesn't seem to be any good way to
      avoid the race, since readline exposes no functions that seem safe to call
      from a generic signal handler --- rl_reset_screen_size() certainly isn't.
      
      It turns out that we also need an explicit rl_initialize() call, else
      rl_reset_screen_size() dumps core when called before the first readline()
      call.
      
      rl_reset_screen_size() is not present in old versions of libreadline,
      so we need a configure test for that.  (rl_initialize() is present at
      least back to readline 4.0, so we won't bother with a test for it.)
      We would need a configure test anyway since libedit's emulation of
      libreadline doesn't currently include such a function.  Fortunately,
      libedit seems not to have any corresponding bug.
      
      Merlin Moncure, adjusted a bit by me
      e168dfef
  35. 19 11月, 2015 1 次提交
    • T
      Accept flex > 2.5.x in configure. · d5bb7c6f
      Tom Lane 提交于
      Per buildfarm member anchovy, 2.6.0 exists in the wild now.
      Hopefully it works with Postgres; if not, we'll have to do something
      about that, but in any case claiming it's "too old" is pretty silly.
      d5bb7c6f
  36. 06 10月, 2015 1 次提交
  37. 17 7月, 2015 1 次提交
    • N
      AIX: Test the -qlonglong option before use. · f3f037e1
      Noah Misch 提交于
      xlc provides "long long" unconditionally at C99-compatible language
      levels, and this option provokes a warning.  The warning interferes with
      "configure" tests that fail in response to any warning.  Notably, before
      commit 85a2a890, it interfered with the
      test for -qnoansialias.  Back-patch to 9.0 (all supported versions).
      f3f037e1
  38. 06 7月, 2015 1 次提交
    • T
      Make numeric form of PG version number readily available in Makefiles. · 60c38e62
      Tom Lane 提交于
      Expose PG_VERSION_NUM (e.g., "90600") as a Make variable; but for
      consistency with the other Make variables holding similar info,
      call the variable just VERSION_NUM not PG_VERSION_NUM.
      
      There was some discussion of making this value available as a pg_config
      value as well.  However, that would entail substantially more work than
      this two-line patch.  Given that there was not exactly universal consensus
      that we need this at all, let's just do a minimal amount of work for now.
      
      Back-patch of commit a5d489cc, so that this
      variable is actually useful for its intended purpose sometime before 2020.
      
      Michael Paquier, reviewed by Pavel Stehule
      60c38e62
  39. 01 7月, 2015 1 次提交
  40. 10 6月, 2015 1 次提交