4 Replies
      Latest reply: Oct 17, 2016 3:02 AM by eskimo RSS
      IsaacRaz Level 1 Level 1 (0 points)

        I am trying to use libpq in Xcode with c , I added the libpq.tbd lib and #include <libpq-fe.h> to the main . but Xcode won't compile .

        Thanks for the help

        • Re: Using libpq in Xcode with "c"
          eskimo Apple Staff Apple Staff (7,450 points)

          but Xcode won't compile .

          What error do you get?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Using libpq in Xcode with "c"
              iosdevroa Level 1 Level 1 (0 points)

              Hi Quinn,

               

              I had a similar question over at https://forums.developer.apple.com/thread/65619 with contents:

               

              Hi,

              I'm writing a small Postgres SQL database client app in Objective C for macOS Sierra.  Just to be clear: my app will be the SQL client that will allow you to type in SQL queries and see result sets by sending the queries to a separate Postgres server instance (which may be local or remote and has nothing to do with my app).

              My question: if my app is installed on a fresh/clean Mac running macOS Sierra that has no version of Postgres or Xcode installed, where will the Postgres drivers be found?  Are they built in to macOS Sierra?  Will they be wrapped up inside my app when it is compiled and linked?  I need to be able to distribute my app to non-developers who won't have either Xcode or Postgres installed on their Macs.

              I'm adding libpq.tbd as a "Linked Frameworks and Libraries" to my project's General page, that's how I'm "including" the Postgres drivers in my app's Xcode project.

              On my build machine, I have a version of Postgres server installed so that the libpq headers (.h files) are available at /usr/local/Cellar/postgresql/9.5.4/include and can be seen in Xcode's headers search path.  However, those were installed by Homebrew, which isn't guaranteed to be on an end user's machine.  By mousing over libpq.tbd in Xcode, I see that it is located at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libpq.tbd .  But that's inside the Xcode app, so where will it be on a Mac that doesn't have Xcode or Postgres installed but does have my app installed?

              I guess I'm not sure what a .tbd file is and if libpq is being treated as a dynamic library or is being compiled in, wholesale and statically, into my app at link time.

              Any ideas?

              Apple?

              Thanks!

                • Re: Using libpq in Xcode with "c"
                  iosdevroa Level 1 Level 1 (0 points)

                  OK, I see:

                   

                  bash>
                  
                  ls -1l /usr/lib/libpq.*
                  -rwxr-xr-x  1 root  wheel   144K Dec  2  2015 /usr/lib/libpq.5.6.dylib*
                  lrwxr-xr-x  1 root  wheel    15B Nov 29  2015 /usr/lib/libpq.5.dylib@ -> libpq.5.6.dylib
                  lrwxr-xr-x  1 root  wheel    15B Nov 29  2015 /usr/lib/libpq.dylib@ -> libpq.5.6.dylib
                  
                  

                   

                  So does that mean that libpq.5.6.dylib (or some variant) will be installed on those Macs running macOS Sierra even if they don't have either Xcode or Postgres server/Postgres dev or buildtools installed on them?  Please confirm.  :-)

                  • Re: Using libpq in Xcode with "c"
                    eskimo Apple Staff Apple Staff (7,450 points)

                    I had a similar question over at …

                    I’ve responded on that thread.

                    Share and Enjoy

                    Quinn “The Eskimo!”
                    Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                    let myEmail = "eskimo" + "1" + "@apple.com"