Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » postgresql mingw ( (): lld-link: error: C:\Ultimate++\upp\bin/pgsql/x86/bin\libpq.dll: bad file type. Did you specify a DLL instead of an import library?)
postgresql mingw [message #51763] Sun, 19 May 2019 07:05 Go to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-

I am fooling around tonight on my 3 day vacation.

I built PostgreSQL with mingw. I built is so it would generate .a and .dll files too.

However, to simplify things I left the path, lib, include all configured like:
C:\Ultimate++\upp\bin/pgsql/x86/bin for instance.

Basically, I said to myself, what is the way that Ultimate++ is right out of the box.
Then I ran the PostgreSQL tutorial code, and I get the error listed in the topic description.
So my question is, why when I didn't change any of the configuration settings to point anywhere else can I not get it to link?
I disabled my paths in environment variables for my mingw that exist outside of the boxed environment for U++.

I have a PostgreSQL server running but can't get it to link anyway. I've been in PostgreSQL and created the schema for the
tutorial test db. I found that when I run conemu from mintty I can use it to run psql.

I tried on static only and shared too. Nothing seems to work.

One final curiosity is that there is a libpq.lib file. I didn't think mingw liked that.

Well, out of the box it doesn't see to run. Not sure why. I am able to run dialogs in the examples, so I know it is
a linker with PostgreSQL problem and not anything to do with the dialogs.

I am running version 13068.

Thanks for any comment.

I am off to get refreshments. Be back to check in on things in a bit.
thnx. Roboloki



Re: postgresql mingw [message #51765 is a reply to message #51763] Mon, 20 May 2019 02:25 Go to previous messageGo to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-
So I thought while I am trying to figure out what in the world is going on with PostgreSQL with mingw in U++ I had another idea. Everyone knows that mingw can be used with other frameworks so I tried to fire up libpqxx. Here is my printout:

checking for pkg-config... /mingw64/bin/pkg-config
configure: using PostgreSQL headers at c:/pgsql/include
configure: using PostgreSQL libraries at c:/pgsql/lib
checking c:/pgsql/include/libpq-fe.h usability... yes
checking c:/pgsql/include/libpq-fe.h presence... yes
checking for c:/pgsql/include/libpq-fe.h... yes
checking for ability to compile source files using libpq... yes

So everything was going great until with my bright idea tried to use the version 12 development branch and that is newer than the libpqxx on GitHub.

Well, I need pgsql to work so I will try to compile a different version of postgres with mingw.

I had to do some nifty configuring to get that to work. It (libpqxx configure script) couldn't find libraries or headers so I made one of these files (libpq.pc):
refix=/c/pgsql
exec_prefix=${prefix}/bin
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: postgresql
Description: DB
Requires:
Version: 12.0
Libs: -Lc:/pgsql/lib
Cflags: -Ic:/pgsql/include

I hope that helps anyone wanting to get into SWIG with U++ and libpqxx. That way you can use tkinter with python and C++ or just Tk and C++ all with postgres.

I will return at a little later time once I get another version set up and see what I can't figure out about why I couldn't get U++ up and running with postgres on mingw.

Hope you are having a cool weekend. I am on a 3 day weekend. It has been fun.
thnx

later - Roboloki
Re: postgresql mingw [message #51770 is a reply to message #51763] Mon, 20 May 2019 23:10 Go to previous messageGo to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-

It is kind of related to sql, so I will let you know how it is going with libpqxx.
Please check out my issue opened up on GitHub re: stable branch of libpqxx if you are interested.
I am using ultimate++ to test out libpqxx with postgres 11.3 and the stable branch of libpqxx on mingw.
Here is the link:

https://github.com/jtv/libpqxx/issues/186

I am not sure I am correct because undefinded symbols are not familiar to me.
Hope everyone is having a cool day.
thnx roboloki
Re: postgresql mingw [message #51771 is a reply to message #51770] Tue, 21 May 2019 07:25 Go to previous messageGo to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-

We think we solved the libpqxx issue. I am talking on GitHub and it might be related to -lws2_32. I will see if I can find that the package that contains that file and execute a special install instruction.

I am also wondering if when I build both static and dynamic libraries it might cause U++ to be confused. I am going to try to do static only install with mingw if it will let me with postgres.

Have to go get some sleep. I am at gmt -4 and work is coming fast tomorrow.

Thnx roboloki
Re: postgresql mingw [message #51772 is a reply to message #51771] Thu, 23 May 2019 02:53 Go to previous messageGo to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-

After getting knocked out by a late night with insomnia (lost a day) I am back at it.
It took forever to figure out where ws2_32.dll is hiding. I copied it from windows system 32.
I have this for build methods under mingw64:
-Wl,--stack,20000000 -L. ws2_32.dll -lpqxx -lpq

I get this error msg on linking with U++:
(): lld-link: error: ws2_32.dll: bad file type. Did you specify a DLL instead of an import library?

Hey- this worked on the command line:
$ x86_64-w64-mingw32-g++.exe -I. -Ic:/pgsql/include -L. -Lc:/pgsql/lib -Lc:/msys64/mingw64/lib ws2_32.dll pgtest.cpp -lpqxx -lpq -o wott.exe

I am not sure if I am missing anything but that is all you need to do in mingw64 in shell for mingw.
If anyone that reads this wants to use msys2 shell for running the postgres server you need conemu with the mingw environment option.
There is a bug they never fixed that won't let you use psql command with the regular mintty.
Sorry I couldn't get back sooner.
Have cool night,
roboloki

Re: postgresql mingw [message #51774 is a reply to message #51772] Sat, 25 May 2019 04:29 Go to previous messageGo to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-

I am up and running. Not only am I building libpqxx projects but also U++ dialogs with PostgreSQL now.

I did NOT use the bundled mingw with all the prebuilt paths for that self contained environment.

Easiest way for me is to use windows without mingw and then put in your own paths, libs, and includes.

I saw one person go to great lengths to convert the .lib file in the self contained environment to a .a file.

I realized that if all that is involved is converting a .lib to a .a. file then just use my own PostgreSQL that I actually built from source with mingw because it has a .a file already.

For some reason with bundled mingw it gave me fits!

I am very excited that U++ supports mingw and so does PostgreSQL!

Please don't pull support for these great tools.

We can't use firebird in mingw anymore because they dropped support per the user group at yahoo for firebird.

I am very lucky that you all support this for my hobby.

have a very cool weekend.

thnx roboloki
Re: postgresql mingw [message #51775 is a reply to message #51774] Sat, 25 May 2019 13:44 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi,

Setting change required as follows

Setup->BuildMethods-> libdir

it is bin\pgsql\x64\bin

Change to

....bin\pgsql\x64\lib

Also in package organiser change is required.

index.php?t=getfile&id=5845&private=0


Warm Regards

Deepak
Re: postgresql mingw [message #51777 is a reply to message #51775] Sat, 25 May 2019 16:38 Go to previous message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi Deepak-
Thnx for the cool tricks.
Have a nice weekend.
Roboloki
Previous Topic: Sql Lite schema with DATE type
Next Topic: Escape string in MySQL
Goto Forum:
  


Current Time: Thu Mar 28 20:59:33 CET 2024

Total time taken to generate the page: 0.01089 seconds