Thread: Compiling pgAdmin on SuSE 10.1

Compiling pgAdmin on SuSE 10.1

From
Miha Radej
Date:
Hi!

I tried to compile pgAdmin on a Suse 10.1 system, using a fresh SVN
checkout (rev 5210).

Attached is a patch with changes I had to apply in order to be able to
compile pgAdmin.

I also got the following warnings while compiling pgAdmin - got them
before and after adding the headers, only line numbers differ:

./frm/frmReport.cpp: In member function ‘virtual void
reportObjectDataDictionaryFactory::GenerateReport(frmReport*, pgObject*)’:
./frm/frmReport.cpp:1335: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1335: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1335: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1335: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1335: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1341: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1389: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1389: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime
./frm/frmReport.cpp:1389: warning: cannot pass objects of non-POD type
‘class wxString’ through ‘...’; call will abort at runtime

Suse 10.1 comes with gcc v 4.1.0 if this info is of any help and with
some headaches in order to compile pgAdmin, at least for someone like me :)

Regards,
Miha

--
"... the small primitive tribes joined up and became huge, powerful
primitive tribes with more sophisticated weapons."
  -- Terry Pratchett, Small Gods
Index: src/include/ctl/ctlSQLResult.h
===================================================================
--- src/include/ctl/ctlSQLResult.h    (revision 5210)
+++ src/include/ctl/ctlSQLResult.h    (working copy)
@@ -65,7 +65,7 @@
     int RunStatus();
     wxString GetMessagesAndClear();
     wxString GetErrorMessage();
-    pgError ctlSQLResult::GetResultError();
+    pgError GetResultError();

     void DisplayData(bool single=false);

Index: src/include/ctl/ctlSQLGrid.h
===================================================================
--- src/include/ctl/ctlSQLGrid.h    (revision 5210)
+++ src/include/ctl/ctlSQLGrid.h    (working copy)
@@ -28,8 +28,8 @@
     int Copy();

     virtual bool CheckRowPresent(int row) { return true; }
-    wxSize ctlSQLGrid::GetBestSize(int row, int col);
-    void ctlSQLGrid::OnLabelDoubleClick(wxGridEvent& event);
+    wxSize GetBestSize(int row, int col);
+    void OnLabelDoubleClick(wxGridEvent& event);
 };

 #endif
Index: src/frm/frmReport.cpp
===================================================================
--- src/frm/frmReport.cpp    (revision 5210)
+++ src/frm/frmReport.cpp    (working copy)
@@ -29,6 +29,9 @@
 #include "pgColumn.h"
 #include "pgConstraints.h"
 #include "pgaJob.h"
+#include "pgForeignKey.h"
+#include "pgIndexConstraint.h"
+#include "pgCheck.h"

 // XML2/XSLT headers
 #include <libxml/xmlmemory.h>

Re: Compiling pgAdmin on SuSE 10.1

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of Miha Radej
> Sent: 27 May 2006 16:03
> To: pgadmin-hackers
> Subject: [pgadmin-hackers] Compiling pgAdmin on SuSE 10.1
>
> Hi!
>
> I tried to compile pgAdmin on a Suse 10.1 system, using a fresh SVN
> checkout (rev 5210).
>
> Attached is a patch with changes I had to apply in order to be able to
> compile pgAdmin.

Thanks - applied. We really need a buildfarm....

> I also got the following warnings while compiling pgAdmin - got them
> before and after adding the headers, only line numbers differ:
>
> ./frm/frmReport.cpp: In member function 'virtual void
> reportObjectDataDictionaryFactory::GenerateReport(frmReport*,
> pgObject*)':
> ./frm/frmReport.cpp:1335: warning: cannot pass objects of non-POD type
> 'class wxString' through '...'; call will abort at runtime

Yeah, these ones only fail on GCC - it's complaining about passing a
wxString as a parameter to a variadic function. The fix is to use the
c_str() member, eg.

printf("%s: %s", sqlState.c_str(), errMsg.c_str());

It's easy to forget :-(

Thanks, Dave.

Re: Compiling pgAdmin on SuSE 10.1

From
Miha Radej
Date:
Hi!

Dave Page pravi:
>> ./frm/frmReport.cpp: In member function 'virtual void
>> reportObjectDataDictionaryFactory::GenerateReport(frmReport*,
>> pgObject*)':
>> ./frm/frmReport.cpp:1335: warning: cannot pass objects of non-POD type
>> 'class wxString' through '...'; call will abort at runtime
>
> Yeah, these ones only fail on GCC - it's complaining about passing a
> wxString as a parameter to a variadic function. The fix is to use the
> c_str() member, eg.

The above warnings are now gone, but I noticed these now:

./frm/frmEditGrid.cpp: In member function ‘void sqlTable::Paste()’:
./frm/frmEditGrid.cpp:1840: warning: comparison between signed and
unsigned integer expressions
./frm/frmEditGrid.cpp:1841: warning: comparison between signed and
unsigned integer expressions
./frm/frmEditGrid.cpp:1856: warning: comparison between signed and
unsigned integer expressions
./frm/frmEditGrid.cpp:1857: warning: comparison between signed and
unsigned integer expressions

The attached patch is yet another "works for me" kind of patch, I don't
know what good/standard C++ practice is in such situations, considering
I don't know C++ at all :)

Regards,
Miha

--
"... the small primitive tribes joined up and became huge, powerful
primitive tribes with more sophisticated weapons."
  -- Terry Pratchett, Small Gods
Index: src/frm/frmEditGrid.cpp
===================================================================
--- src/frm/frmEditGrid.cpp    (revision 5211)
+++ src/frm/frmEditGrid.cpp    (working copy)
@@ -1837,8 +1837,8 @@
     skipSerial = false;

     for (col = 0; col < nCols; col++) {
-        if ((unsigned int)columns[col].type == PGOID_TYPE_SERIAL ||
-            (unsigned int)columns[col].type == PGOID_TYPE_SERIAL8)
+        if ((unsigned int)columns[col].type == (unsigned int)PGOID_TYPE_SERIAL ||
+            (unsigned int)columns[col].type == (unsigned int)PGOID_TYPE_SERIAL8)
         {
             wxMessageDialog msg(GetView()->GetParent(),
                 _("This table contains serial columns. Do you want to use the values in the clipboard for these
columns?"),
@@ -1853,8 +1853,8 @@

     for (col = (hasOids ? 1 : 0); col < nCols && col < (int)data.GetCount(); col++)
     {
-        if (!(skipSerial && ((unsigned int)columns[col].type == PGOID_TYPE_SERIAL ||
-            (unsigned int)columns[col].type == PGOID_TYPE_SERIAL8)))
+        if (!(skipSerial && ((unsigned int)columns[col].type == (unsigned int)PGOID_TYPE_SERIAL ||
+            (unsigned int)columns[col].type == (unsigned int)PGOID_TYPE_SERIAL8)))
         {
             SetValue(row, col, data.Item(col));
         }

Re: Compiling pgAdmin on SuSE 10.1

From
"Dave Page"
Date:

> -----Original Message-----
> From: Miha Radej [mailto:miha.radej@siix.com]
> Sent: 29 May 2006 21:27
> To: Dave Page
> Cc: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] Compiling pgAdmin on SuSE 10.1
>
> Hi!
>
> Dave Page pravi:
> >> ./frm/frmReport.cpp: In member function 'virtual void
> >> reportObjectDataDictionaryFactory::GenerateReport(frmReport*,
> >> pgObject*)':
> >> ./frm/frmReport.cpp:1335: warning: cannot pass objects of
> non-POD type
> >> 'class wxString' through '...'; call will abort at runtime
> >
> > Yeah, these ones only fail on GCC - it's complaining about passing a
> > wxString as a parameter to a variadic function. The fix is
> to use the
> > c_str() member, eg.
>
> The above warnings are now gone, but I noticed these now:
>
> ./frm/frmEditGrid.cpp: In member function 'void sqlTable::Paste()':
> ./frm/frmEditGrid.cpp:1840: warning: comparison between signed and
> unsigned integer expressions
> ./frm/frmEditGrid.cpp:1841: warning: comparison between signed and
> unsigned integer expressions
> ./frm/frmEditGrid.cpp:1856: warning: comparison between signed and
> unsigned integer expressions
> ./frm/frmEditGrid.cpp:1857: warning: comparison between signed and
> unsigned integer expressions
>
> The attached patch is yet another "works for me" kind of
> patch, I don't
> know what good/standard C++ practice is in such situations,
> considering
> I don't know C++ at all :)

:-)

Modified patch applied. I blind-fixed that one earlier and put the casts
on the wrong operands :-(

Thanks, Dave.