Comments (13)
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.
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.
I use Postgres.app and there is no difference when using Vapor. Can you explain where you are hitting a roadblock?
from postgresql.
@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.
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.
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.
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.
@natebird the pull request looks good to me. Thanks!
from postgresql.
@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.
@natebird Yeah, sounds good. 👍
from postgresql.
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.
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.
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)
- Two Phase Commit support? HOT 1
- Preparations causing fatal error HOT 23
- Problem with bytea field HOT 1
- No execute on postgreSQL instance.
- Incorrect result when parsing "NUMERIC" values HOT 2
- Using Listen Leads To Crashes
- 'libpq-fe.h' file not found when compiling via Xcode HOT 4
- Way to write to specific scheme
- Does not support prefix_range type
- PostgreSQL Vapor Packages won't compile after install HOT 3
- Travis build badge not working
- commit 3c24375 changed test database name
- Memory leak in `Bind` HOT 1
- Support for connection pooling
- Examples don't show what to do with the result. HOT 1
- Redirect old Repository to this one HOT 3
- Bug: Use of `assert` prevents code from being executed when optimization is turned on
- Numeric values like 0.0x are deserialized as 0.x0 HOT 4
- Compile error with swift package HOT 13
- Error encoding array of enums as jsonb HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postgresql.