Giter Club home page Giter Club logo

Comments (13)

kenaniah avatar kenaniah commented on May 17, 2024

IMHO, this project's documentation should not include instructions to install Postgres.app, mainly because homebrew is the de facto package management tool for Mac. I have nothing against Postgres.app, and many developers find it to be a wonderful alternative for installing a PostgreSQL server. I am against this simply because it does not provide any meaningful value over the existing instructions.

from postgresql.

regan-sarwas avatar regan-sarwas commented on May 17, 2024

I'm not requesting instruction on the installation of Postgres.app. However I'm using Postgres.app, and I'd rather not migrate to the Brew Postgres just to experiment with Vapor. This is where I got stuck and stopped. I was hoping there were others in my situation that had solved this, but maybe not.

from postgresql.

pruthvikar avatar pruthvikar commented on May 17, 2024

I use Postgres.app and there is no difference when using Vapor. Can you explain where you are hitting a roadblock?

from postgresql.

rsarwas avatar rsarwas commented on May 17, 2024

@pruthvikar that is good news. Thanks for responding.
my problem is error: 'libpq-fe.h' file not found. I suspect there will also be linking errors once this is resolved. It may be because I do not know how to specify the include and lib paths with the swift package manager.

I have postgres.app 2.0.3 (21) and swift 3.1 installed.

$ pg_config --includedir
/Applications/Postgres.app/Contents/Versions/9.6/include
$ pg_config --libdir
/Applications/Postgres.app/Contents/Versions/9.6/lib
$ swift --version
Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9

Reproduce with:

cd /tmp
mkdir Project
cd Project
swift package init --type executable
cat <<EOT > Package.swift
import PackageDescription
let package = Package(
    name: "Project",
    dependencies: [
        .Package(url: "https://github.com/vapor/postgresql.git", majorVersion: 2)
    ]
)
EOT
swift build

Results:

Fetching https://github.com/vapor/postgresql.git
Fetching https://github.com/vapor-community/cpostgresql.git
Fetching https://github.com/vapor/node.git
Fetching https://github.com/vapor/core.git
Fetching https://github.com/vapor/bits.git
Fetching https://github.com/vapor/debugging.git
Cloning https://github.com/vapor/node.git
Resolving https://github.com/vapor/node.git at 2.0.3
Cloning https://github.com/vapor-community/cpostgresql.git
Resolving https://github.com/vapor-community/cpostgresql.git at 2.0.0
Cloning https://github.com/vapor/postgresql.git
Resolving https://github.com/vapor/postgresql.git at 2.0.1
Cloning https://github.com/vapor/core.git
Resolving https://github.com/vapor/core.git at 2.0.2
Cloning https://github.com/vapor/debugging.git
Resolving https://github.com/vapor/debugging.git at 1.0.0
Cloning https://github.com/vapor/bits.git
Resolving https://github.com/vapor/bits.git at 1.0.0
Compile Swift Module 'Debugging' (1 sources)
Compile Swift Module 'Bits' (19 sources)
Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'Core' (23 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'Node' (38 sources)
Compile Swift Module 'PostgreSQL' (12 sources)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "shim.h"
        ^
/private/tmp/Project/.build/checkouts/cpostgresql.git-2801679829006959247/shim.h:4:10: error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
         ^
/private/tmp/Project/.build/checkouts/postgresql.git-5650722971996441103/Sources/PostgreSQL/Connection.swift:1:8: error: could not build Objective-C module 'CPostgreSQL'
import CPostgreSQL
       ^
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /private/tmp/Project/.build/debug.yaml

libpq-fe.h exists.

$ ls `pg_config --includedir`/libpq-fe.h
/Applications/Postgres.app/Contents/Versions/9.6/include/libpq-fe.h

from postgresql.

rsarwas avatar rsarwas commented on May 17, 2024

I'm not sure if this is the correct solution, but I was able to get it to compile by creating a pkgConfig file called:
/usr/local/lib/pkgconfig/libpq.pc
with this content:

prefix=/Applications/Postgres.app/Contents/Versions/latest
Cflags: -I${prefix}/include
Libs: -L${prefix}/lib -lpq

I am closing this issue since it really belongs in the Cpostgres instructions.

from postgresql.

natebird avatar natebird commented on May 17, 2024

I created a pull request on cPostgres for this. Let me know if it looks ok and I'll merge it in.

Thanks for figuring this out.

from postgresql.

vzsg avatar vzsg commented on May 17, 2024

I disagree about where it belongs.
No one should depend on cpostgresql directly, so I'd rather see it here in the README.

from postgresql.

regan-sarwas avatar regan-sarwas commented on May 17, 2024

@natebird the pull request looks good to me. Thanks!

from postgresql.

natebird avatar natebird commented on May 17, 2024

@vzsg I agree that no one should directly depend on the CPostgresql repo. We have a readme for setting up CPosgresql on different environments so I'll add it there but I'll also add a section in this readme about it as well. Does that sound good?

from postgresql.

vzsg avatar vzsg commented on May 17, 2024

@natebird Yeah, sounds good. 👍

from postgresql.

phawk avatar phawk commented on May 17, 2024

The pkgconfig worked for me too, I think Postgres.app is a very common way of running postgres on mac, particularly coming form the ruby community. Would love to see this in the readme 👍

from postgresql.

micheltlutz avatar micheltlutz commented on May 17, 2024

Solve for me my postgresql installation with brew

Create File
sudo vim /usr/local/lib/pkgconfig/libpq.pc

With content...

path=/usr/local/Cellar/[email protected]/9.6.6/
Cflags: -I${path}/include
Libs: -L${path}/lib -lpq

Path found with command

$ locate libpq-fe.h
/Library/PostgreSQL/9.6/include/libpq-fe.h
/usr/local/Cellar/[email protected]/9.6.6/include/libpq-fe.h

After I Running vapor build --verbose
and .. Building Project [Done]

from postgresql.

gizmolab10 avatar gizmolab10 commented on May 17, 2024

i have the same problem:

/vapor/Packages/CPostgreSQL-1.0.0/module.modulemap:8:12: error: header '/usr/include/postgresql/libpq-fe.h' not found

and yet, "locate libpq-fe.h" returns:

/usr/include/postgresql/libpq-fe.h

i have a /usr/lib/pkgconfig/libpq.pc file, with contents:

Name: libpq
Description: PostgreSQL libpq library
Url: http://www.postgresql.org/
Version: 9.3.23
Requires:
Requires.private:
Cflags: -I/usr/include/postgresql
Libs: -L/usr/lib -lpq
Libs.private: -L/usr/lib/mit-krb5 -L/usr/lib/x86_64-linux-gnu/mit-krb5 -lssl -lcrypto -lkrb5 -lcom_err -lgssapi_krb5 -lcrypt -lldap_r -lpthread

i'm stumped. can anyone help me out with this?

from postgresql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.