{"id":270,"date":"2024-11-25T03:31:04","date_gmt":"2024-11-25T11:31:04","guid":{"rendered":"https:\/\/robingingras.com\/?p=270"},"modified":"2024-11-25T03:31:04","modified_gmt":"2024-11-25T11:31:04","slug":"how-to-configure-qt-6-for-openssl-and-postgresql-on-windows","status":"publish","type":"post","link":"https:\/\/robingingras.com\/index.php\/2024\/11\/25\/how-to-configure-qt-6-for-openssl-and-postgresql-on-windows\/","title":{"rendered":"How to configure Qt 6 for OpenSSL and PostgreSQL on Windows"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;m posting this for anyone who may need to compile Qt 6 on Windows with support for both OpenSSL and PosgreSQL. Since I spent an hour of my life figuring this out, I figured I&#8217;d share it in hopes that it saves someone else the time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can install both OpenSSL and PosgreSQL from the distributed binaries (easy to find). Make sure you adjust the paths as relevant to your setup. I&#8217;m following <a href=\"https:\/\/wiki.qt.io\/Building_Qt_6_from_Git\">this guide<\/a> to compile Qt 6. Here is my command for the configure stage:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>D:\\Projects\\qt6\\configure.bat ^\n  -opensource ^\n  -confirm-license ^\n  -developer-build ^\n  -openssl-linked ^\n  -I \"C:\/Program Files\/OpenSSL-Win64\/include\" ^\n  -L \"C:\/Program Files\/OpenSSL-Win64\/lib\" ^\n  -nomake examples -nomake tests ^\n  -- --fresh ^\n  -DPostgreSQL_LIBRARY=\"C:\/Program Files\/PostgreSQL\/17\/lib\" ^\n  -DPostgreSQL_INCLUDE_DIR=\"C:\/Program Files\/PostgreSQL\/17\/include\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can then build as normal. You may want to study the configure output closely to make sure the paths were properly picked up. Once you build you can run a simple application to test your results. ChatGPT gave me this for PostgreSQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;QSqlDatabase&gt;\n#include &lt;QDebug&gt;\n\nint main() {\n    if (QSqlDatabase::isDriverAvailable(\"QPSQL\")) {\n        qDebug() &lt;&lt; \"PostgreSQL driver is available!\";\n    } else {\n        qDebug() &lt;&lt; \"PostgreSQL driver is NOT available!\";\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">ChatGPT also provided me with this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (QSslSocket::supportsSsl()) {\n    qDebug() &lt;&lt; \"SSL is supported!\";\n} else {\n    qDebug() &lt;&lt; \"SSL is NOT supported!\";\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should, of course, check these suggestions for accuracy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m posting this for anyone who may need to compile Qt 6 on Windows with support for both OpenSSL and PosgreSQL. Since I spent an hour of my life figuring this out, I figured I&#8217;d share it in hopes that it saves someone else the time. You can install both OpenSSL and PosgreSQL from the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[9,13,14,15,16,20,27],"class_list":["post-270","post","type-post","status-publish","format-standard","hentry","category-how-to","tag-database","tag-openssl","tag-postgres","tag-postgresql","tag-programming","tag-qt6","tag-sql"],"_links":{"self":[{"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/posts\/270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/comments?post=270"}],"version-history":[{"count":0,"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/posts\/270\/revisions"}],"wp:attachment":[{"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/media?parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/categories?post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robingingras.com\/index.php\/wp-json\/wp\/v2\/tags?post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}