Thread: pthread option of msvc build.

pthread option of msvc build.

From
"Hiroshi Saito"
Date:
Hi Magnus-san.

I am trying simple construction by operating config.pl.
It has changed wonderfully now. however, I do not use ecpg,
and see the simplest construction. At that time, even pthread
might not be needed. It was simple.

Please consider this.

P.S)
I can't catch up with your quick work. However, I will try the debugging
execution with VS2005 by the arrangement option. tools/msvc will
surely facilitate debugging.!
Thanks.

Regards,
Hiroshi Saito



Attachment

Re: pthread option of msvc build.

From
Magnus Hagander
Date:
Hiroshi Saito wrote:
> Hi Magnus-san.
>
> I am trying simple construction by operating config.pl.
> It has changed wonderfully now. however, I do not use ecpg, and see the
> simplest construction. At that time, even pthread might not be needed.
> It was simple.

Good point, but the patch doesn't work. Simply removing the check
doesn't work, it will cause warnings and errors all over when doing a
complete build.

Please try the attached patch which actually disables the building of
ecpg if pthreads is not specified.


//Magnus
Index: src\tools\msvc/Project.pm
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Project.pm,v
retrieving revision 1.5
diff -c -r1.5 Project.pm
*** src\tools\msvc/Project.pm    4 Jan 2007 17:58:19 -0000    1.5
--- src\tools\msvc/Project.pm    11 Jan 2007 18:54:19 -0000
***************
*** 367,377 ****
      }
      $libs =~ s/ $//;
      $libs =~ s/__CFGNAME__/$cfgname/g;
      print $f <<EOF;
    <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
      ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
      <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
!
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{solution}->{options}->{pthread};$self->{includes}"

PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
          StringPooling="$p->{strpool}"
          RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
--- 367,379 ----
      }
      $libs =~ s/ $//;
      $libs =~ s/__CFGNAME__/$cfgname/g;
+     my $pth = $self->{solution}->{options}->{pthread};
+     $pth = '' unless $pth;
      print $f <<EOF;
    <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
      ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
      <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
!
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$pth;$self->{includes}"

PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
          StringPooling="$p->{strpool}"
          RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
Index: src\tools\msvc/Solution.pm
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Solution.pm,v
retrieving revision 1.5
diff -c -r1.5 Solution.pm
*** src\tools\msvc/Solution.pm    29 Dec 2006 16:49:02 -0000    1.5
--- src\tools\msvc/Solution.pm    11 Jan 2007 18:52:16 -0000
***************
*** 6,12 ****
  sub new {
      my $junk = shift;
      my $options = shift;
-     die "Pthreads is required.\n" unless $options->{pthread};
      my $self = {
          projects => {},
          options  => $options,
--- 6,11 ----
Index: src\tools\msvc/mkvcbuild.pl
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/mkvcbuild.pl,v
retrieving revision 1.9
diff -c -r1.9 mkvcbuild.pl
*** src\tools\msvc/mkvcbuild.pl    9 Jan 2007 06:00:43 -0000    1.9
--- src\tools\msvc/mkvcbuild.pl    11 Jan 2007 18:52:32 -0000
***************
*** 90,117 ****
  $pgtypes->AddReference($postgres,$libpgport);
  $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');

! my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
! $libecpg->AddDefine('FRONTEND');
! $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
! $libecpg->AddIncludeDir('src\interfaces\libpq');
! $libecpg->AddIncludeDir('src\port');
! $libecpg->AddLibrary('wsock32.lib');
! $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
! $libecpg->AddReference($libpq,$pgtypes);
!
! my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
! $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
! $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
! $libecpgcompat->AddReference($pgtypes,$libecpg);
!
! my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
! $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
! $ecpg->AddIncludeDir('src\interfaces\libpq');
! $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
! $ecpg->AddDefine('MAJOR_VERSION=4');
! $ecpg->AddDefine('MINOR_VERSION=2');
! $ecpg->AddDefine('PATCHLEVEL=1');
! $ecpg->AddReference($libpgport);


  # src/bin
--- 90,122 ----
  $pgtypes->AddReference($postgres,$libpgport);
  $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');

! if ($config->{pthread}) {
!    my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
!    $libecpg->AddDefine('FRONTEND');
!    $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
!    $libecpg->AddIncludeDir('src\interfaces\libpq');
!    $libecpg->AddIncludeDir('src\port');
!    $libecpg->AddLibrary('wsock32.lib');
!    $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
!    $libecpg->AddReference($libpq,$pgtypes);
!
!    my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
!    $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
!    $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
!    $libecpgcompat->AddReference($pgtypes,$libecpg);
!
!    my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
!    $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
!    $ecpg->AddIncludeDir('src\interfaces\libpq');
!    $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
!    $ecpg->AddDefine('MAJOR_VERSION=4');
!    $ecpg->AddDefine('MINOR_VERSION=2');
!    $ecpg->AddDefine('PATCHLEVEL=1');
!    $ecpg->AddReference($libpgport);
! }
! else {
!    print "Not building ecpg due to lack of pthreads.\n";
! }


  # src/bin

Re: pthread option of msvc build.

From
Bruce Momjian
Date:
Is this ready to be applied?

---------------------------------------------------------------------------

Magnus Hagander wrote:
> Hiroshi Saito wrote:
> > Hi Magnus-san.
> >
> > I am trying simple construction by operating config.pl.
> > It has changed wonderfully now. however, I do not use ecpg, and see the
> > simplest construction. At that time, even pthread might not be needed.
> > It was simple.
>
> Good point, but the patch doesn't work. Simply removing the check
> doesn't work, it will cause warnings and errors all over when doing a
> complete build.
>
> Please try the attached patch which actually disables the building of
> ecpg if pthreads is not specified.
>
>
> //Magnus

> Index: src\tools\msvc/Project.pm
> ===================================================================
> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Project.pm,v
> retrieving revision 1.5
> diff -c -r1.5 Project.pm
> *** src\tools\msvc/Project.pm    4 Jan 2007 17:58:19 -0000    1.5
> --- src\tools\msvc/Project.pm    11 Jan 2007 18:54:19 -0000
> ***************
> *** 367,377 ****
>       }
>       $libs =~ s/ $//;
>       $libs =~ s/__CFGNAME__/$cfgname/g;
>       print $f <<EOF;
>     <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
>       ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
>       <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
> !
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{solution}->{options}->{pthread};$self->{includes}"
>
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
>           StringPooling="$p->{strpool}"
>           RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
> --- 367,379 ----
>       }
>       $libs =~ s/ $//;
>       $libs =~ s/__CFGNAME__/$cfgname/g;
> +     my $pth = $self->{solution}->{options}->{pthread};
> +     $pth = '' unless $pth;
>       print $f <<EOF;
>     <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
>       ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
>       <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
> !
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$pth;$self->{includes}"
>
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
>           StringPooling="$p->{strpool}"
>           RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
> Index: src\tools\msvc/Solution.pm
> ===================================================================
> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Solution.pm,v
> retrieving revision 1.5
> diff -c -r1.5 Solution.pm
> *** src\tools\msvc/Solution.pm    29 Dec 2006 16:49:02 -0000    1.5
> --- src\tools\msvc/Solution.pm    11 Jan 2007 18:52:16 -0000
> ***************
> *** 6,12 ****
>   sub new {
>       my $junk = shift;
>       my $options = shift;
> -     die "Pthreads is required.\n" unless $options->{pthread};
>       my $self = {
>           projects => {},
>           options  => $options,
> --- 6,11 ----
> Index: src\tools\msvc/mkvcbuild.pl
> ===================================================================
> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/mkvcbuild.pl,v
> retrieving revision 1.9
> diff -c -r1.9 mkvcbuild.pl
> *** src\tools\msvc/mkvcbuild.pl    9 Jan 2007 06:00:43 -0000    1.9
> --- src\tools\msvc/mkvcbuild.pl    11 Jan 2007 18:52:32 -0000
> ***************
> *** 90,117 ****
>   $pgtypes->AddReference($postgres,$libpgport);
>   $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');
>
> ! my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
> ! $libecpg->AddDefine('FRONTEND');
> ! $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
> ! $libecpg->AddIncludeDir('src\interfaces\libpq');
> ! $libecpg->AddIncludeDir('src\port');
> ! $libecpg->AddLibrary('wsock32.lib');
> ! $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
> ! $libecpg->AddReference($libpq,$pgtypes);
> !
> ! my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
> ! $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
> ! $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
> ! $libecpgcompat->AddReference($pgtypes,$libecpg);
> !
> ! my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
> ! $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
> ! $ecpg->AddIncludeDir('src\interfaces\libpq');
> ! $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
> ! $ecpg->AddDefine('MAJOR_VERSION=4');
> ! $ecpg->AddDefine('MINOR_VERSION=2');
> ! $ecpg->AddDefine('PATCHLEVEL=1');
> ! $ecpg->AddReference($libpgport);
>
>
>   # src/bin
> --- 90,122 ----
>   $pgtypes->AddReference($postgres,$libpgport);
>   $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');
>
> ! if ($config->{pthread}) {
> !    my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
> !    $libecpg->AddDefine('FRONTEND');
> !    $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
> !    $libecpg->AddIncludeDir('src\interfaces\libpq');
> !    $libecpg->AddIncludeDir('src\port');
> !    $libecpg->AddLibrary('wsock32.lib');
> !    $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
> !    $libecpg->AddReference($libpq,$pgtypes);
> !
> !    my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
> !    $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
> !    $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
> !    $libecpgcompat->AddReference($pgtypes,$libecpg);
> !
> !    my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
> !    $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
> !    $ecpg->AddIncludeDir('src\interfaces\libpq');
> !    $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
> !    $ecpg->AddDefine('MAJOR_VERSION=4');
> !    $ecpg->AddDefine('MINOR_VERSION=2');
> !    $ecpg->AddDefine('PATCHLEVEL=1');
> !    $ecpg->AddReference($libpgport);
> ! }
> ! else {
> !    print "Not building ecpg due to lack of pthreads.\n";
> ! }
>
>
>   # src/bin

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: pthread option of msvc build.

From
Magnus Hagander
Date:
Yes, please.

//Magnus

Bruce Momjian wrote:
> Is this ready to be applied?
>
> ---------------------------------------------------------------------------
>
> Magnus Hagander wrote:
>> Hiroshi Saito wrote:
>>> Hi Magnus-san.
>>>
>>> I am trying simple construction by operating config.pl.
>>> It has changed wonderfully now. however, I do not use ecpg, and see the
>>> simplest construction. At that time, even pthread might not be needed.
>>> It was simple.
>> Good point, but the patch doesn't work. Simply removing the check
>> doesn't work, it will cause warnings and errors all over when doing a
>> complete build.
>>
>> Please try the attached patch which actually disables the building of
>> ecpg if pthreads is not specified.
>>
>>
>> //Magnus
>
>> Index: src\tools\msvc/Project.pm
>> ===================================================================
>> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Project.pm,v
>> retrieving revision 1.5
>> diff -c -r1.5 Project.pm
>> *** src\tools\msvc/Project.pm    4 Jan 2007 17:58:19 -0000    1.5
>> --- src\tools\msvc/Project.pm    11 Jan 2007 18:54:19 -0000
>> ***************
>> *** 367,377 ****
>>       }
>>       $libs =~ s/ $//;
>>       $libs =~ s/__CFGNAME__/$cfgname/g;
>>       print $f <<EOF;
>>     <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
>>       ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
>>       <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
>> !
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{solution}->{options}->{pthread};$self->{includes}"
>>
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
>>           StringPooling="$p->{strpool}"
>>           RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
>> --- 367,379 ----
>>       }
>>       $libs =~ s/ $//;
>>       $libs =~ s/__CFGNAME__/$cfgname/g;
>> +     my $pth = $self->{solution}->{options}->{pthread};
>> +     $pth = '' unless $pth;
>>       print $f <<EOF;
>>     <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
>>       ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
>>       <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
>> !
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$pth;$self->{includes}"
>>
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
>>           StringPooling="$p->{strpool}"
>>           RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
>> Index: src\tools\msvc/Solution.pm
>> ===================================================================
>> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Solution.pm,v
>> retrieving revision 1.5
>> diff -c -r1.5 Solution.pm
>> *** src\tools\msvc/Solution.pm    29 Dec 2006 16:49:02 -0000    1.5
>> --- src\tools\msvc/Solution.pm    11 Jan 2007 18:52:16 -0000
>> ***************
>> *** 6,12 ****
>>   sub new {
>>       my $junk = shift;
>>       my $options = shift;
>> -     die "Pthreads is required.\n" unless $options->{pthread};
>>       my $self = {
>>           projects => {},
>>           options  => $options,
>> --- 6,11 ----
>> Index: src\tools\msvc/mkvcbuild.pl
>> ===================================================================
>> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/mkvcbuild.pl,v
>> retrieving revision 1.9
>> diff -c -r1.9 mkvcbuild.pl
>> *** src\tools\msvc/mkvcbuild.pl    9 Jan 2007 06:00:43 -0000    1.9
>> --- src\tools\msvc/mkvcbuild.pl    11 Jan 2007 18:52:32 -0000
>> ***************
>> *** 90,117 ****
>>   $pgtypes->AddReference($postgres,$libpgport);
>>   $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');
>>
>> ! my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
>> ! $libecpg->AddDefine('FRONTEND');
>> ! $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
>> ! $libecpg->AddIncludeDir('src\interfaces\libpq');
>> ! $libecpg->AddIncludeDir('src\port');
>> ! $libecpg->AddLibrary('wsock32.lib');
>> ! $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
>> ! $libecpg->AddReference($libpq,$pgtypes);
>> !
>> ! my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
>> ! $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
>> ! $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
>> ! $libecpgcompat->AddReference($pgtypes,$libecpg);
>> !
>> ! my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
>> ! $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
>> ! $ecpg->AddIncludeDir('src\interfaces\libpq');
>> ! $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
>> ! $ecpg->AddDefine('MAJOR_VERSION=4');
>> ! $ecpg->AddDefine('MINOR_VERSION=2');
>> ! $ecpg->AddDefine('PATCHLEVEL=1');
>> ! $ecpg->AddReference($libpgport);
>>
>>
>>   # src/bin
>> --- 90,122 ----
>>   $pgtypes->AddReference($postgres,$libpgport);
>>   $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');
>>
>> ! if ($config->{pthread}) {
>> !    my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
>> !    $libecpg->AddDefine('FRONTEND');
>> !    $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
>> !    $libecpg->AddIncludeDir('src\interfaces\libpq');
>> !    $libecpg->AddIncludeDir('src\port');
>> !    $libecpg->AddLibrary('wsock32.lib');
>> !    $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
>> !    $libecpg->AddReference($libpq,$pgtypes);
>> !
>> !    my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
>> !    $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
>> !    $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
>> !    $libecpgcompat->AddReference($pgtypes,$libecpg);
>> !
>> !    my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
>> !    $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
>> !    $ecpg->AddIncludeDir('src\interfaces\libpq');
>> !    $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
>> !    $ecpg->AddDefine('MAJOR_VERSION=4');
>> !    $ecpg->AddDefine('MINOR_VERSION=2');
>> !    $ecpg->AddDefine('PATCHLEVEL=1');
>> !    $ecpg->AddReference($libpgport);
>> ! }
>> ! else {
>> !    print "Not building ecpg due to lack of pthreads.\n";
>> ! }
>>
>>
>>   # src/bin
>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 5: don't forget to increase your free space map settings
>


Re: pthread option of msvc build.

From
Bruce Momjian
Date:
Patch applied.  Thanks.

---------------------------------------------------------------------------


Magnus Hagander wrote:
> Hiroshi Saito wrote:
> > Hi Magnus-san.
> >
> > I am trying simple construction by operating config.pl.
> > It has changed wonderfully now. however, I do not use ecpg, and see the
> > simplest construction. At that time, even pthread might not be needed.
> > It was simple.
>
> Good point, but the patch doesn't work. Simply removing the check
> doesn't work, it will cause warnings and errors all over when doing a
> complete build.
>
> Please try the attached patch which actually disables the building of
> ecpg if pthreads is not specified.
>
>
> //Magnus

> Index: src\tools\msvc/Project.pm
> ===================================================================
> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Project.pm,v
> retrieving revision 1.5
> diff -c -r1.5 Project.pm
> *** src\tools\msvc/Project.pm    4 Jan 2007 17:58:19 -0000    1.5
> --- src\tools\msvc/Project.pm    11 Jan 2007 18:54:19 -0000
> ***************
> *** 367,377 ****
>       }
>       $libs =~ s/ $//;
>       $libs =~ s/__CFGNAME__/$cfgname/g;
>       print $f <<EOF;
>     <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
>       ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
>       <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
> !
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{solution}->{options}->{pthread};$self->{includes}"
>
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
>           StringPooling="$p->{strpool}"
>           RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
> --- 367,379 ----
>       }
>       $libs =~ s/ $//;
>       $libs =~ s/__CFGNAME__/$cfgname/g;
> +     my $pth = $self->{solution}->{options}->{pthread};
> +     $pth = '' unless $pth;
>       print $f <<EOF;
>     <Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}"
IntermediateDirectory=".\\$cfgname\\$self->{name}"
>       ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
>       <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
> !
AdditionalIncludeDirectories="src/include;src/include/port/win32;src/include/port/win32_msvc;$pth;$self->{includes}"
>
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
>           StringPooling="$p->{strpool}"
>           RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
> Index: src\tools\msvc/Solution.pm
> ===================================================================
> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/Solution.pm,v
> retrieving revision 1.5
> diff -c -r1.5 Solution.pm
> *** src\tools\msvc/Solution.pm    29 Dec 2006 16:49:02 -0000    1.5
> --- src\tools\msvc/Solution.pm    11 Jan 2007 18:52:16 -0000
> ***************
> *** 6,12 ****
>   sub new {
>       my $junk = shift;
>       my $options = shift;
> -     die "Pthreads is required.\n" unless $options->{pthread};
>       my $self = {
>           projects => {},
>           options  => $options,
> --- 6,11 ----
> Index: src\tools\msvc/mkvcbuild.pl
> ===================================================================
> RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/tools/msvc/mkvcbuild.pl,v
> retrieving revision 1.9
> diff -c -r1.9 mkvcbuild.pl
> *** src\tools\msvc/mkvcbuild.pl    9 Jan 2007 06:00:43 -0000    1.9
> --- src\tools\msvc/mkvcbuild.pl    11 Jan 2007 18:52:32 -0000
> ***************
> *** 90,117 ****
>   $pgtypes->AddReference($postgres,$libpgport);
>   $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');
>
> ! my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
> ! $libecpg->AddDefine('FRONTEND');
> ! $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
> ! $libecpg->AddIncludeDir('src\interfaces\libpq');
> ! $libecpg->AddIncludeDir('src\port');
> ! $libecpg->AddLibrary('wsock32.lib');
> ! $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
> ! $libecpg->AddReference($libpq,$pgtypes);
> !
> ! my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
> ! $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
> ! $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
> ! $libecpgcompat->AddReference($pgtypes,$libecpg);
> !
> ! my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
> ! $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
> ! $ecpg->AddIncludeDir('src\interfaces\libpq');
> ! $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
> ! $ecpg->AddDefine('MAJOR_VERSION=4');
> ! $ecpg->AddDefine('MINOR_VERSION=2');
> ! $ecpg->AddDefine('PATCHLEVEL=1');
> ! $ecpg->AddReference($libpgport);
>
>
>   # src/bin
> --- 90,122 ----
>   $pgtypes->AddReference($postgres,$libpgport);
>   $pgtypes->AddIncludeDir('src\interfaces\ecpg\include');
>
> ! if ($config->{pthread}) {
> !    my $libecpg = $solution->AddProject('libecpg','dll','interfaces','src\interfaces\ecpg\ecpglib');
> !    $libecpg->AddDefine('FRONTEND');
> !    $libecpg->AddIncludeDir('src\interfaces\ecpg\include');
> !    $libecpg->AddIncludeDir('src\interfaces\libpq');
> !    $libecpg->AddIncludeDir('src\port');
> !    $libecpg->AddLibrary('wsock32.lib');
> !    $libecpg->AddLibrary($config->{'pthread'} . '\pthreadVC2.lib');
> !    $libecpg->AddReference($libpq,$pgtypes);
> !
> !    my $libecpgcompat = $solution->AddProject('libecpg_compat','dll','interfaces','src\interfaces\ecpg\compatlib');
> !    $libecpgcompat->AddIncludeDir('src\interfaces\ecpg\include');
> !    $libecpgcompat->AddIncludeDir('src\interfaces\libpq');
> !    $libecpgcompat->AddReference($pgtypes,$libecpg);
> !
> !    my $ecpg = $solution->AddProject('ecpg','exe','interfaces','src\interfaces\ecpg\preproc');
> !    $ecpg->AddIncludeDir('src\interfaces\ecpg\include');
> !    $ecpg->AddIncludeDir('src\interfaces\libpq');
> !    $ecpg->AddFiles('src\interfaces\ecpg\preproc','pgc.l','preproc.y');
> !    $ecpg->AddDefine('MAJOR_VERSION=4');
> !    $ecpg->AddDefine('MINOR_VERSION=2');
> !    $ecpg->AddDefine('PATCHLEVEL=1');
> !    $ecpg->AddReference($libpgport);
> ! }
> ! else {
> !    print "Not building ecpg due to lack of pthreads.\n";
> ! }
>
>
>   # src/bin

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +