tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
381 stars 102 forks source link

macOS install fails with fatal error: 'sybfront.h' file not found #197

Closed cstork closed 5 years ago

cstork commented 5 years ago

Hi, thanks for all your work!!

This issue was actually mentioned two years ago in passing in #127 but the (easy?) solution wasn't put in place:

Since the recommended installation uses Homebrew the freeTDS include files will reside in /usr/local/include/ but the Makefile is only looking in ./include/.

A solution might be to simply advice people to compile for macOS via make USE_PGXS=1 PG_CPPFLAGS="-I./include/ -I/usr/local/include/ -fvisibility=hidden" or to adapt the Makefile. In the latter case I can't judge potential problems for other platforms.

(While you're at it, you could remove the "requires requires" in the Makefile. :-) )

juliogonzalez commented 5 years ago

A solution might be to simply advice people to compile for macOS via make USE_PGXS=1 PG_CPPFLAGS="-I./include/ -I/usr/local/include/ -fvisibility=hidden"

As a short term solution, I will create a PR for the doc (or you can do it, if you want :-)

or to adapt the Makefile. In the latter case I can't judge potential problems for other platforms.

IIRC, there are ways of evaluating if the system is MacOS, but that solution would take more time and -more important- neither @GeoffMontee or myself have a Mac to try.

But of course, if you want to give it a try, you are more than welcome! :-)

cstork commented 5 years ago

I'll give it a try...

cstork commented 5 years ago

@juliogonzalez One question: even though there's now InstallWindows.md I assume the Makefile is supposed to also run on Windows, correct?

juliogonzalez commented 5 years ago

@juliogonzalez One question: even though there's now InstallWindows.md

Where? I can't see it at master branch, and I am not aware it was there before.

I assume the Makefile is supposed to also run on Windows, correct?

As far as I know, it doesn't. See #53 and #32.

cstork commented 5 years ago

Argh! s/now/no/ Sorry! But you answered my question either way...

These two issues make clear that even though there's currently no success on Windows there is a desire to make it work on Windows in the future.

SudoerWithAnOpinion commented 5 years ago

Sorry to be an issue nazi here but... Windows support is out of the scope of this issue. Can we get this closed? it looks like the original issue is resolved. If windows NEEDS to be discussed, use a new issue or existing one about it.

cstork commented 5 years ago

Isn't it closed already? :-)

BTW, my last comment referenced running on Windows just as a concern in case we'd fix the issue via detecting the OS in the Makefile. As it turns out, that wasn't the right way to fix this issue anyway and #199 solved it differently.

deinspanjer commented 1 year ago

If anyone comes here years later running into this problem, I found that getting it to run with the latest version of Homebrew required the following two changes:

In the Makefile, edit the following two lines:

SHLIB_LINK := -L/opt/homebrew/lib -lsybdb
TDS_INCLUDE :=

to point at the proper include and lib directories for Homebrew

SHLIB_LINK := -L/opt/homebrew/lib -lsybdb
TDS_INCLUDE := -I/opt/homebrew/include

The TDS_INCLUDE could be specified on the commandline, but the SHLIB_LINK is not set up the same way, so I think it needs to be edited directly.

ryannguyen360td commented 6 months ago

In my cases, I have followed but can not resolve. When reading the file

.../tiny_tds/extconf.rb

I saw this

DIRS.unshift(ENV['FREETDS_DIR']) if ENV.has_key?('FREETDS_DIR')

I did as below

brew install freetds

=> In the install log, we will see the path: /opt/homebrew/Cellar/freetds/1.4.xx

Next define env variable

export FREETDS_DIR="/opt/homebrew/Cellar/freetds/1.4.xx"

=> It resolved the issue