Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
699 stars 145 forks source link

Multicorn installation on mac OSX - Working #212

Open markp2 opened 5 years ago

markp2 commented 5 years ago

Having spent the best part of a day attempting to build a version on Mac OSX, thought I would write up the process gleaned here and from others to here to help anyone!

Versions: MacOS high Sierra 10.13.6, Python 3.6, postgresql 10.5, Multicorn 1.3.4, Xcode 10.0.

1.Use brew to install postgresql. I previously was using EDB+language pack and it failed with a large number of link errors, likely due to not having the developer version. Then add to your path:

PATH=$PATH:/usr/local/Cellar/postgresql/10.5/bin

2.Clone the repo:

git clone git://github.com/Kozea/Multicorn.git
cd Multicorn

3.Modify the Makefile by changing lowercase darwin to uppercase Darwin:

ifeq ($(PORTNAME),darwin)

ifeq ($(PORTNAME),Darwin)

4.Since Xcode 10 ships with a newer version of the SDK, you will need to create an alias like:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk /Library/Developer/CommandLineTools/SDKs

5.Run make but override the 2.7 Python used by default with your newer version e.g. 3.6 to make the install:

sudo ARCHFLAGS="-arch x86_64" make -d PYTHON_OVERRIDE=python3.6  install
jon-freed commented 4 years ago

Sadly, these instructions did not work for me with macOS Mojave v 10.14.6, python 3.7.4, PostgreSQL 12, today's clone of git://github.com/Kozea/Multicorn.git, and Xcode 11.3.1.

Incidentally, step 3, above, appears to already be the default in the Makefile.

markp2 commented 4 years ago

I just re-built Multicorn successfully on Mac OSX Catalina 10.15.5

Multicorn installation on Mac OSX Catalina 10.15.5 Instructions

1.Use brew to install postgresql 12. Then add to you path:

PATH=$PATH:/usr/local/Cellar/postgresql/12.3_4/bin

2.Clone the repo:

git clone git://github.com/Kozea/Multicorn.git
cd Multicorn

3.Run make but override the 2.7 used by default with your newer version 3.6 to make the install:

sudo ARCHFLAGS="-arch x86_64" make -d PYTHON_OVERRIDE=python3.6  install
222momo commented 3 years ago

Versions: macos 10.15.2, Python 3.7, postgresql 11.5 I try to install multicorn in macos 10.15.2 . I add /usr/local/Cellar/postgresql/11.5_1/bin to path ,and python version is 3.7 so I use cd Multicorn sudo ARCHFLAGS="-arch x86_64" make -d PYTHON_OVERRIDE=python3.7 install I meet the problem Python version is 3.7 Usage: /usr/local/anaconda3/bin/python3.7-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir] clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2 -bundle -multiply_defined suppress -o multicorn.so src/errors.o src/python.o src/query.o src/multicorn.o -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -Wl,-dead_strip_dylibs -bundle_loader /usr/local/Cellar/postgresql/11.5_1/bin/postgres -lpython3.7m -ldl -framework CoreFoundation -L/usr/local/anaconda3/lib/python3.7/config-3.7m-darwin -lpython3.7m -ldl -framework CoreFoundation -Wl,-stack_size,1000000 -framework CoreFoundation ld: -stack_size option can only be used when linking a main executable clang-10: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [multicorn.so] Error 1 it shows ld: -stack_size option can only be used when linking a main executable clang-10: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [multicorn.so] Error 1

thanks all.

222momo commented 3 years ago

Versions: macos 10.15.2, Python 3.7, postgresql 11.5 I try to install multicorn in macos 10.15.2 . I add /usr/local/Cellar/postgresql/11.5_1/bin to path ,and python version is 3.7 so I use cd Multicorn sudo ARCHFLAGS="-arch x86_64" make -d PYTHON_OVERRIDE=python3.7 install I meet the problem Python version is 3.7 Usage: /usr/local/anaconda3/bin/python3.7-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir] clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2 -bundle -multiply_defined suppress -o multicorn.so src/errors.o src/python.o src/query.o src/multicorn.o -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -Wl,-dead_strip_dylibs -bundle_loader /usr/local/Cellar/postgresql/11.5_1/bin/postgres -lpython3.7m -ldl -framework CoreFoundation -L/usr/local/anaconda3/lib/python3.7/config-3.7m-darwin -lpython3.7m -ldl -framework CoreFoundation -Wl,-stack_size,1000000 -framework CoreFoundation ld: -stack_size option can only be used when linking a main executable clang-10: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [multicorn.so] Error 1 it shows ld: -stack_size option can only be used when linking a main executable clang-10: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [multicorn.so] Error 1

thanks all.

I solve it .Because in Mac OSX Terminal python3-config --ldflags it will give me -L/usr/local/anaconda3/lib/python3.7/config-3.7m-darwin -lpython3.7m -ldl -framework CoreFoundation -Wl,-stack_size,1000000 -framework CoreFoundation so I changed the entry to the PY_LDFLAGS option in makefile to -L/usr/local/anaconda3/lib/python3.7/config-3.7m-darwin -lpython3.7m -ldl -framework CoreFoundation i.e. everything before the -Wl flag.

# PY_LDFLAGS = $(shell ${PYTHON_CONFIG} --ldflags)
PY_LDFLAGS = -L/usr/local/anaconda3/lib/python3.7/config-3.7m-darwin -lpython3.7m -ldl -framework 

but I met another problem I don't know how to solve.