FreeBASIC-Extended-Library / fb-ext-lib

A set of general purpose and game oriented libraries for FreeBASIC
Other
14 stars 11 forks source link

Issue during build with Postgres #8

Closed davegorst closed 4 years ago

davegorst commented 7 years ago

Currently building gives this error :

fbc -c -w all -g -i ../../../include/freebasic drivers/postgre.bas -o drivers/postgre.o drivers/postgre.bas(29) error 14: Expected identifier, found 'pg_conn' in 'db as pg_conn' drivers/postgre.bas(88) warning 5(0): Implicit conversion drivers/postgre.bas(89) warning 1(1): Passing scalar as pointer, at parameter 1 of PQSTATUS() drivers/postgre.bas(96) warning 1(1): Passing scalar as pointer, at parameter 1 of PQFINISH() drivers/postgre.bas(105) warning 1(1): Passing scalar as pointer, at parameter 1 of PQEXEC() drivers/postgre.bas(105) warning 5(0): Implicit conversion drivers/postgre.bas(107) warning 1(1): Passing scalar as pointer, at parameter 1 of PQRESULTSTATUS() drivers/postgre.bas(121) warning 1(1): Passing scalar as pointer, at parameter 1 of PQNTUPLES() drivers/postgre.bas(135) warning 1(1): Passing scalar as pointer, at parameter 1 of PQNFIELDS() drivers/postgre.bas(143) warning 1(1): Passing scalar as pointer, at parameter 1 of PQFNAME() drivers/postgre.bas(153) warning 1(1): Passing scalar as pointer, at parameter 1 of PQGETVALUE() drivers/postgre.bas(163) warning 1(1): Passing scalar as pointer, at parameter 1 of PQCLEAR() drivers/postgre.bas(171) warning 1(1): Passing scalar as pointer, at parameter 1 of PQRESULTERRORMESSAGE() drivers/postgre.bas(173) warning 1(1): Passing scalar as pointer, at parameter 1 of PQERRORMESSAGE() drivers/postgre.bas(176) warning 1(1): Passing scalar as pointer, at parameter 1 of PQERRORMESSAGE() drivers/postgre.bas(192) warning 4(1): Suspicious pointer assignment drivers/postgre.bas(197) warning 4(1): Suspicious pointer assignment drivers/postgre.bas(206) warning 1(1): Passing scalar as pointer, at parameter 1 of PQCMDTUPLES() Makefile:46: recipe for target 'drivers/postgre.o' failed make[2]: *** [drivers/postgre.o] Error 1

I had a quick look and it looks like it may have gone missing in this commit? 8e468e1590d467a8ffa1abffad2d29990baa5ca1

This is running "psql (PostgreSQL) 9.4.9" on Linux (both on Raspbian and Ubuntu 16.04).

mudhairless commented 7 years ago

Appears the pg header has changed or is missing.

davegorst commented 7 years ago

Looks like it - I'll see if I can track it down ...

mudhairless commented 7 years ago

There is a copy in my old project on Google code: https://code.google.com/archive/p/freebasic-headers/source/default/source I can't download it at the moment so I don't know how old it is. It is most likely what this is built against though.

FreifunkErzgebirge commented 6 years ago

Any news about this? Still getting the same errors when building at x64 linux.

danielt3 commented 6 years ago

It seems that the PostgreSQL header has changed in FreeBASIC. I found an old thread in FreeBASIC forums (https://www.freebasic.net/forum/viewtopic.php?f=14&t=5712&hilit=PostgreSQL) that what seems to be a more complete header. I'm not sure what happened since them but in 1.05, the postgre header seems to be missing stuff.

danielt3 commented 6 years ago

I found out that commit 8e468e1590d467a8ffa1abffad2d29990baa5ca1 in 'inc/postgresql/libpq-fe.bi' removed the definitions that fixes this problem. I'm not sure why they were removed but I can see two scenarios:

  1. They were actually removed by mistake
  2. They were removed because the interface of the PostgreSQL library has changed

First one is easy to fix in FBC. Second one should be fixed in ext-library.

Quick and dirty hack to fix this: in src/modules/database/drivers/postgre.bas

type PostgreDriverInfo
-    db as pg_conn
-    res as pg_result
+    db as any ptr
+    res as any ptr
     conn_s as string
     st as uinteger
     ep as uinteger

I had successfully compiled ext-library with this (and other) fix.