tds_fdw icon indicating copy to clipboard operation
tds_fdw copied to clipboard

Make fails on MacOS 11.1 Big Sur - can't find libraries

Open DavidGradwell opened this issue 3 years ago • 2 comments

Issue report

Following the instructions at https://github.com/tds-fdw/tds_fdw/blob/master/InstallOSX.md we successfully installed freetds and then did:

export TDS_FDW_VERSION="2.0.2" wget https://github.com/tds-fdw/tds_fdw/archive/v${TDS_FDW_VERSION}.tar.gz tar -xvzf v${TDS_FDW_VERSION}.tar.gz cd tds_fdw-${TDS_FDW_VERSION} make USE_PGXS=1 TDS_INCLUDE=-I/usr/local/include/

The make failed with:

ld: warning: directory not found for option '-L/opt/local/Current/lib' ld: warning: directory not found for option '-L/opt/local/libexec/llvm-6.0/lib' ld: warning: directory not found for option '-L/opt/local/libexec/llvm-6.0/lib' ld: warning: directory not found for option '-L/opt/local/20180529/lib'

Looking at /opt we find the directory is empty.

It looks like the instructions don't work for the latest Big Sur release (11.1) which I suspect has re-organised some directories.

Operating system

Mac OS Big sur 11.1 (20C69).

Version of tds_fdw

2.0.2

Version of PostgreSQL

11

Version of FreeTDS

Output

make USE_PGXS=1 TDS_INCLUDE=-I/usr/local/include/ gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -arch x86_64 -O2 -I./include/ -fvisibility=hidden -I/usr/local/include/ -I. -I./ -I/Library/PostgreSQL/11/include/postgresql/server -I/Library/PostgreSQL/11/include/postgresql/internal -I/opt/local/Current/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/opt/local/20180529/include/libxml2 -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include -c -o src/tds_fdw.o src/tds_fdw.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -arch x86_64 -O2 -I./include/ -fvisibility=hidden -I/usr/local/include/ -I. -I./ -I/Library/PostgreSQL/11/include/postgresql/server -I/Library/PostgreSQL/11/include/postgresql/internal -I/opt/local/Current/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/opt/local/20180529/include/libxml2 -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include -c -o src/options.o src/options.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -arch x86_64 -O2 -I./include/ -fvisibility=hidden -I/usr/local/include/ -I. -I./ -I/Library/PostgreSQL/11/include/postgresql/server -I/Library/PostgreSQL/11/include/postgresql/internal -I/opt/local/Current/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/opt/local/20180529/include/libxml2 -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include -c -o src/deparse.o src/deparse.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -arch x86_64 -O2 -bundle -multiply_defined suppress -o tds_fdw.so src/tds_fdw.o src/options.o src/deparse.o -L/Library/PostgreSQL/11/lib -L/opt/local/Current/lib -L/opt/local/libexec/llvm-6.0/lib -L/opt/local/libexec/llvm-6.0/lib -L/opt/local/20180529/lib -Wl,-dead_strip_dylibs -lsybdb -bundle_loader /Library/PostgreSQL/11/bin/postgres ld: warning: directory not found for option '-L/opt/local/Current/lib' ld: warning: directory not found for option '-L/opt/local/libexec/llvm-6.0/lib' ld: warning: directory not found for option '-L/opt/local/libexec/llvm-6.0/lib' ld: warning: directory not found for option '-L/opt/local/20180529/lib' ld: library not found for -lsybdb clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [tds_fdw.so] Error 1

DavidGradwell avatar Jan 07 '21 15:01 DavidGradwell

I made /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk. from Phracker https://github.com/phracker/MacOSX-SDKs . That resolved one problem.

I noted that /opt/homebrew/include has the missing headers.

make USE_PGXS=1 TDS_INCLUDE=-I/opt/homebrew/include runs but still fails on

ld: warning: directory not found for option '-L/opt/local/Current/lib' ld: warning: directory not found for option '-L/opt/local/libexec/llvm-8.0/lib' ld: warning: directory not found for option '-L/opt/local/libexec/llvm-8.0/lib' ld: warning: directory not found for option '-L/opt/local/20200428/lib' ld: library not found for -lsybdb clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [tds_fdw.so] Error 1

Does anyone know where to find these libraries so that I can put them in the expected places ?

DavidGradwell avatar Feb 09 '21 09:02 DavidGradwell

You need to pass an extra library path so the library is found:

# On Intel processors:
LIBRARY_PATH=/usr/local/lib make USE_PGXS=1 TDS_INCLUDE=-I/usr/local/include
# On M1/M2 processors:
LIBRARY_PATH=/opt/homebrew/lib make USE_PGXS=1 TDS_INCLUDE=-I/opt/homebrew/include

letiemble avatar Nov 21 '22 12:11 letiemble