* Compiling GNATColl on Windows @ 2014-12-15 13:06 mhardeman25 2014-12-15 13:25 ` Michael Hardeman 2014-12-15 19:46 ` Shark8 0 siblings, 2 replies; 16+ messages in thread From: mhardeman25 @ 2014-12-15 13:06 UTC (permalink / raw) I have been trying to compile GNATColl on Windows 8.1 and I'm having some trouble. I'm hoping somebody here has some tips/tricks that I may have missed. I do have the latest source from the svn repository here: http://viewvc.libre.adacore.com/viewvc.cgi/Public/trunk/gps/gnatlib/ Location of important components: * GNATColl src: C:\development\tools\ada\gnatlib * Adacore Gnat GPL: C:\development\tools\ada\GNAT\2014 * Mingw with Msys and GNAT: C:\development\tools\common\mingw * Postgresql: C:\development\tools\sql\postgresql * SQLite: C:\development\tools\sql\sqlite Environment Variables: * Path: C:\development\tools\ada\GNAT\2014\bin;C:\development\tools\common\mingw\bin;C:\development\tools\sql\postgresql\bin;C:\development\tools\sql\sqlite;C:\development\tools\java\jdk x64\bin;C:\Users\Michael\AppData\Roaming\npm I have tried it both with GNAT\2014\bin first and with mingw\bin first. (switching which GNAT compiler/gnatlib I was using) Compilation steps: run msys.bat cd /c/development/tools/ada/gnatlib ./configure -prefix=/c/development/tools/ada/gnat/2014/ --with-postgresql=/c/development/tools/sql/postgresql/ --with-sqlite=/c/development/tools/sql/sqlite/ make Failure message using GNAT\2014\bin: c:/development/tools/ada/gnat/2014/bin/../libexec/gcc/i686-pc-mingw32/4.7.4/ld.exe: cannot find -lpq collect2.exe: error: ld returned 1 exit status gprlib: c:\development\tools\ada\gnat\2014\bin\gcc execution error gprbuild: could not build library for project gnatcoll_postgres make: *** [build_library_type/relocatable] Error 4 Failure message using mingw\bin: gprbuild -m -j0 -XLIBRARY_TYPE=relocatable -Pgnatcoll_build -p gnatcoll.gpr:34:10: unknown file "xutil.ads" gnatcoll.gpr:34:23: unknown file "xutil.adb" gnatcoll.gpr:34:36: unknown file "xsnamest.adb" gprbuild: "gnatcoll_build" processing failed make: *** [build_library_type/relocatable] Error 4 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 13:06 Compiling GNATColl on Windows mhardeman25 @ 2014-12-15 13:25 ` Michael Hardeman 2014-12-15 15:47 ` David Botton 2014-12-15 19:46 ` Shark8 1 sibling, 1 reply; 16+ messages in thread From: Michael Hardeman @ 2014-12-15 13:25 UTC (permalink / raw) Also in reguards to the -lpq error when using GNAT GPL compiler. I have tried exporting LDFLAGS='-L/c/development/tools/sql/postgresql/lib' as well as adding that folder to my PATH environment variable. It still can't find that library (libpq.dll). ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 13:25 ` Michael Hardeman @ 2014-12-15 15:47 ` David Botton 2014-12-15 15:49 ` David Botton 2014-12-15 16:09 ` Michael Hardeman 0 siblings, 2 replies; 16+ messages in thread From: David Botton @ 2014-12-15 15:47 UTC (permalink / raw) > It still can't find that library (libpq.dll). It is not looking for libpq.dll but rather libpq.a for your gcc environment. http://www.mingw.org/wiki/createimportlibraries ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 15:47 ` David Botton @ 2014-12-15 15:49 ` David Botton 2014-12-15 16:10 ` Michael Hardeman 2014-12-15 16:09 ` Michael Hardeman 1 sibling, 1 reply; 16+ messages in thread From: David Botton @ 2014-12-15 15:49 UTC (permalink / raw) > It is not looking for libpq.dll but rather libpq.a for your gcc environment. > > http://www.mingw.org/wiki/createimportlibraries If you are doing a windows centric project consider using ADO, there are database bindings in GWindows - https://sourceforge.net/projects/gnavi/ If doing something cross platform ODBC also an option see http://www.dmitry-kazakov.de/ada/components.htm David Botton ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 15:49 ` David Botton @ 2014-12-15 16:10 ` Michael Hardeman 2014-12-15 21:55 ` Björn Lundin 0 siblings, 1 reply; 16+ messages in thread From: Michael Hardeman @ 2014-12-15 16:10 UTC (permalink / raw) On Monday, December 15, 2014 10:50:01 AM UTC-5, David Botton wrote: > > It is not looking for libpq.dll but rather libpq.a for your gcc environment. > > > > http://www.mingw.org/wiki/createimportlibraries > > If you are doing a windows centric project consider using ADO, there are database bindings in GWindows - https://sourceforge.net/projects/gnavi/ > > If doing something cross platform ODBC also an option see http://www.dmitry-kazakov.de/ada/components.htm > > David Botton I'll look into dmitry's ODBC bindings. They may be sufficient for my needs. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 16:10 ` Michael Hardeman @ 2014-12-15 21:55 ` Björn Lundin 2014-12-15 22:37 ` Dmitry A. Kazakov 2014-12-15 23:00 ` Björn Lundin 0 siblings, 2 replies; 16+ messages in thread From: Björn Lundin @ 2014-12-15 21:55 UTC (permalink / raw) On 2014-12-15 17:10, Michael Hardeman wrote: > On Monday, December 15, 2014 10:50:01 AM UTC-5, David Botton wrote: >>> It is not looking for libpq.dll but rather libpq.a for your gcc environment. >>> >>> http://www.mingw.org/wiki/createimportlibraries >> >> If you are doing a windows centric project consider using ADO, there are database bindings in GWindows - https://sourceforge.net/projects/gnavi/ >> >> If doing something cross platform ODBC also an option see http://www.dmitry-kazakov.de/ada/components.htm >> >> David Botton > > I'll look into dmitry's ODBC bindings. They may be sufficient for my needs. > If it is just postgres you want, I use this https://dl.dropboxusercontent.com/u/26175828/sql-pg.zip It's based on an old binding from Samuel Tardieu, on which I put another layer on a somewhat higher abstraction layer. For just reading... Stm : Sql.Statement_Type; T : Sql.Transaction_Type; Sql.Connect(Db_Name => "My_Db" => user ...); Stm.Prepare("select COL1,COL2 from MY_TABLE where a = :A and b = :B"); T.Start; Stm.Set("A",Some_Value); Stm.Set("B",another_value); --Open a cursor at the backend - This executes the query Stm.Open_Cursor; Stm.Fetch(End_Of_Set); If not End_of_set then Stm.Get("COL1",Some_Variable); Stm.Get("COL2",Some_Other_Variable); end if; Stm.close_cursor(); T.Commit(); Sql.Close_Session; use Some_Variable and Some_Other_Variable -- Björn ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 21:55 ` Björn Lundin @ 2014-12-15 22:37 ` Dmitry A. Kazakov 2014-12-15 23:14 ` Björn Lundin 2014-12-16 8:48 ` Björn Lundin 2014-12-15 23:00 ` Björn Lundin 1 sibling, 2 replies; 16+ messages in thread From: Dmitry A. Kazakov @ 2014-12-15 22:37 UTC (permalink / raw) On Mon, 15 Dec 2014 22:55:18 +0100, Björn Lundin wrote: > If it is just postgres you want, > I use this > https://dl.dropboxusercontent.com/u/26175828/sql-pg.zip > > It's based on an old binding from Samuel Tardieu, > on which I put another layer on a somewhat higher > abstraction layer. > > For just reading... > > Stm : Sql.Statement_Type; > T : Sql.Transaction_Type; > Sql.Connect(Db_Name => "My_Db" => user ...); > Stm.Prepare("select COL1,COL2 from MY_TABLE where a = :A and b = :B"); > T.Start; > Stm.Set("A",Some_Value); > Stm.Set("B",another_value); > --Open a cursor at the backend - This executes the query > Stm.Open_Cursor; > Stm.Fetch(End_Of_Set); > If not End_of_set then > Stm.Get("COL1",Some_Variable); > Stm.Get("COL2",Some_Other_Variable); > end if; > Stm.close_cursor(); > T.Commit(); > Sql.Close_Session; > > use Some_Variable and Some_Other_Variable Roughly same in ODBC: declare Environment : aliased ODBC_Environment; Connection : aliased ODBC_Connection (Environment'Access); begin Connect (Connection, "My_DB", "Myself", ...); declare Command : aliased ODBC_Command (Connection'Access); begin Prepare (Command, "SELECT COL1,COL2 FROM ..."); Execute (Command); Fetch (Command); Some_Variable := Get (Command'Access, 1, On_Error); Some_Other_Variable := Get (Command'Access, 2, Always); end; end; No need to fiddle with cursors explicitly and nothing to commit, if only reading. ODBC has a lot of problems, but it usually is simpler than native clients. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 22:37 ` Dmitry A. Kazakov @ 2014-12-15 23:14 ` Björn Lundin 2014-12-16 8:48 ` Björn Lundin 1 sibling, 0 replies; 16+ messages in thread From: Björn Lundin @ 2014-12-15 23:14 UTC (permalink / raw) On 2014-12-15 23:37, Dmitry A. Kazakov wrote: > No need to fiddle with cursors explicitly and nothing to commit, if only > reading. hmm, yes. I got the spec from work, where we use Oracle and Ms-sql-server from win and Aix. I wanted the pg-interface to be code compatible, with that, for future use. - If we ever start using pg at work. The idea is that any interaction with the db, with no transaction, is a sign of error. Thats why a transaction is needed. Good or bad, that is the reason, libpq itself need no transaction for read-only. > ODBC has a lot of problems, but it usually is simpler than native clients. I've had problems using a cursor in a cursor with ODBC. T.Start; Stm.Set("A",Some_Value); Stm.Open_Cursor; Stm.Fetch(End_Of_Set); If not End_of_set then Stm.Get("COL1",Some_Variable); Stm2.Set("COL3", Some_Variable) -- use value from stm in stm2 Stm2.Execute; <-- bang - crash end if; Stm.Close_Cursor; T.Commit; Turned out I had to enable mars - multiple active recordset But did not work on unix-odbc from linux with sql-server. And I do not even dare to try it on AIX. Native client however, works fine. But for windows, perhaps odbc is a better choise -- Björn ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 22:37 ` Dmitry A. Kazakov 2014-12-15 23:14 ` Björn Lundin @ 2014-12-16 8:48 ` Björn Lundin 2014-12-16 10:10 ` Dmitry A. Kazakov 1 sibling, 1 reply; 16+ messages in thread From: Björn Lundin @ 2014-12-16 8:48 UTC (permalink / raw) On 2014-12-15 23:37, Dmitry A. Kazakov wrote: > > Roughly same in ODBC: > > declare > Environment : aliased ODBC_Environment; > Connection : aliased ODBC_Connection (Environment'Access); > begin > Connect (Connection, "My_DB", "Myself", ...); > declare > Command : aliased ODBC_Command (Connection'Access); > begin > Prepare (Command, "SELECT COL1,COL2 FROM ..."); > Execute (Command); > Fetch (Command); > Some_Variable := Get (Command'Access, 1, On_Error); > Some_Other_Variable := Get (Command'Access, 2, Always); > end; > end; > > No need to fiddle with cursors explicitly and nothing to commit, if only > reading. Actually you do need to fiddle with server-side cursors sometimes. Like if you have a very large table and want to treat all rows. I've got a simulation program that reads a table of 30_000_000 rows, that are recordings from actual events since this June. The simulation reads the data in timestamp order (which is a field in the table) and tries different algorithms on the data. The outcome is somewhat based on previous outcome, so I do not want to split the recordset. The one with best outcome survives ans is tried in real life later on. But the table grows, and I expect it to be ca 33 M rows at the ens of the year. And next year, if I record the whole year, I'll end up with 60M+ rows. For that, I _really_ like cursors on the server side. It seems like your ODBC reads the whole recordset into the clients memory? Or do I misunderstand it? --Björn ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-16 8:48 ` Björn Lundin @ 2014-12-16 10:10 ` Dmitry A. Kazakov 2014-12-16 10:21 ` Björn Lundin 0 siblings, 1 reply; 16+ messages in thread From: Dmitry A. Kazakov @ 2014-12-16 10:10 UTC (permalink / raw) On Tue, 16 Dec 2014 09:48:16 +0100, Björn Lundin wrote: > But the table grows, and I expect it to be ca 33 M rows at the ens of > the year. And next year, if I record the whole year, I'll end up with > 60M+ rows. But you could use the time stamp in the SELECT's WHEN? > For that, I _really_ like cursors on the server side. > It seems like your ODBC reads the whole recordset into the clients memory? No idea. It probably depends on the driver. I never used ODBC to its end, because it would defeat the purpose of keeping it RDBMS-agnostic. The cases where I used DB I tired to use the most basic set of the features. > Or do I misunderstand it? The greatest problem of ODBC is that it practically does not mandate anything. So you must question the capabilities of the actual driver and then adapt your application to what is available. For an Ada programmers it is the world turned upside-down, and a patented nightmare to write a minimally robust and maintainable application. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-16 10:10 ` Dmitry A. Kazakov @ 2014-12-16 10:21 ` Björn Lundin 0 siblings, 0 replies; 16+ messages in thread From: Björn Lundin @ 2014-12-16 10:21 UTC (permalink / raw) On 2014-12-16 11:10, Dmitry A. Kazakov wrote: > On Tue, 16 Dec 2014 09:48:16 +0100, Björn Lundin wrote: > >> But the table grows, and I expect it to be ca 33 M rows at the ens of >> the year. And next year, if I record the whole year, I'll end up with >> 60M+ rows. > > But you could use the time stamp in the SELECT's WHEN? > well no, not in a clean way. As I said "The outcome is somewhat based on previous outcome, so I do not want to split the recordset.-- " That is I do NOT want a to use a where-clause based on the timestamp. But I could, if I restructure the simulator. But then, we are into redesign because of limitations in the implementation. Yes, sometimes reality comes and bites you, and you need to give in. But if it can be avoided, I prefer not to change programs just because data size increases. >The greatest problem of ODBC is that it practically does not mandate >anything. So you must question the capabilities of the actual driver >and then adapt your application to what is available. For an Ada >programmers it is the world turned upside-down, and a patented >nightmare to write a minimally robust and maintainable application. Indeed. -- Björn ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 21:55 ` Björn Lundin 2014-12-15 22:37 ` Dmitry A. Kazakov @ 2014-12-15 23:00 ` Björn Lundin 1 sibling, 0 replies; 16+ messages in thread From: Björn Lundin @ 2014-12-15 23:00 UTC (permalink / raw) On 2014-12-15 22:55, Björn Lundin wrote: > If it is just postgres you want, > I use this > https://dl.dropboxusercontent.com/u/26175828/sql-pg.zip bad link - wrong file This one it should be https://dl.dropboxusercontent.com/u/26175828/pg_ifc.tar.gz -- -- Björn ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 15:47 ` David Botton 2014-12-15 15:49 ` David Botton @ 2014-12-15 16:09 ` Michael Hardeman 1 sibling, 0 replies; 16+ messages in thread From: Michael Hardeman @ 2014-12-15 16:09 UTC (permalink / raw) On Monday, December 15, 2014 10:47:12 AM UTC-5, David Botton wrote: > > It still can't find that library (libpq.dll). > > It is not looking for libpq.dll but rather libpq.a for your gcc environment. > > http://www.mingw.org/wiki/createimportlibraries generating a libpq.a file using the dll tool does not change the error. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 13:06 Compiling GNATColl on Windows mhardeman25 2014-12-15 13:25 ` Michael Hardeman @ 2014-12-15 19:46 ` Shark8 2014-12-16 17:50 ` Michael Hardeman 1 sibling, 1 reply; 16+ messages in thread From: Shark8 @ 2014-12-15 19:46 UTC (permalink / raw) On 15-Dec-14 06:06, mhardeman25@gmail.com wrote: > I have been trying to compile GNATColl on Windows 8.1 and I'm having some trouble. > I'm hoping somebody here has some tips/tricks that I may have missed. I don't think I ever got a good build-compile/link of Gnatcoll's DB stuff. Even when it would compile/install the library, it would fail on the linking of the project using it. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-15 19:46 ` Shark8 @ 2014-12-16 17:50 ` Michael Hardeman 2014-12-16 20:27 ` Björn Lundin 0 siblings, 1 reply; 16+ messages in thread From: Michael Hardeman @ 2014-12-16 17:50 UTC (permalink / raw) On Monday, December 15, 2014 2:46:34 PM UTC-5, Shark8 wrote: > On 15-Dec-14 06:06, mhardeman25@gmail.com wrote: > > I have been trying to compile GNATColl on Windows 8.1 and I'm having some trouble. > > I'm hoping somebody here has some tips/tricks that I may have missed. > > I don't think I ever got a good build-compile/link of Gnatcoll's DB > stuff. Even when it would compile/install the library, it would fail on > the linking of the project using it. It's not just the DB stuff I need, I also need the JSON stuff. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Compiling GNATColl on Windows 2014-12-16 17:50 ` Michael Hardeman @ 2014-12-16 20:27 ` Björn Lundin 0 siblings, 0 replies; 16+ messages in thread From: Björn Lundin @ 2014-12-16 20:27 UTC (permalink / raw) On 2014-12-16 18:50, Michael Hardeman wrote: > > It's not just the DB stuff I need, I also need the JSON stuff. There are only 5 files (in the version I got) that relates to JSON. I just ripped them out, and used as any other code. No installation at all -- Björn ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2014-12-16 20:27 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-12-15 13:06 Compiling GNATColl on Windows mhardeman25 2014-12-15 13:25 ` Michael Hardeman 2014-12-15 15:47 ` David Botton 2014-12-15 15:49 ` David Botton 2014-12-15 16:10 ` Michael Hardeman 2014-12-15 21:55 ` Björn Lundin 2014-12-15 22:37 ` Dmitry A. Kazakov 2014-12-15 23:14 ` Björn Lundin 2014-12-16 8:48 ` Björn Lundin 2014-12-16 10:10 ` Dmitry A. Kazakov 2014-12-16 10:21 ` Björn Lundin 2014-12-15 23:00 ` Björn Lundin 2014-12-15 16:09 ` Michael Hardeman 2014-12-15 19:46 ` Shark8 2014-12-16 17:50 ` Michael Hardeman 2014-12-16 20:27 ` Björn Lundin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox