deuill / go-php

PHP bindings for the Go programming language (Golang)
MIT License
925 stars 105 forks source link

library not found for -lphp7 #57

Open naliferov opened 5 years ago

naliferov commented 5 years ago

I use Mac OS. I got php7 installed.

 /usr/bin/php -v                
PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

but when i execute "go get github.com/deuill/go-php" i getting this error:

# github.com/deuill/go-php
ld: library not found for -lphp7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
# github.com/deuill/go-php
engine.c:43:10: warning: enumeration values 'SAPI_HEADER_DELETE_ALL' and 'SAPI_HEADER_SET_STATUS' not handled in switch [-Wswitch]
engine.c:43:10: note: add missing switch cases
engine.c:97:2: warning: incompatible pointer types initializing 'void (*)(char *, int)' with an expression of type 'void (char *)' [-Wincompatible-pointer-types]
# github.com/deuill/go-php
receiver.c:79:1: warning: control reaches end of non-void function [-Wreturn-type]
# github.com/deuill/go-php
value.c:121:47: warning: incompatible pointer types passing 'unsigned long *' to parameter of type 'zend_ulong *' (aka 'unsigned long long *') [-Wincompatible-pointer-types]
../github.com/deuill/go-php/include/php7/_value.h:14:87: note: passing argument to parameter 'num_index' here
deuill commented 5 years ago

Hi, in general, most PHP packages do not include the necessary libraries that Go needs to link against. Your best bet is either using the included Docker container (which you can build with make docker-image) for as your compilation environment, or compile PHP for Mac OS X with --enable-embed provided to the ./configure script.

You can also build go-php and link against a static version of the PHP library with the STATIC variable, and can also provide a specific PHP version to build against with the PHP_VERSION variable, e.g. make docker-build STATIC=true PHP_VERSION=7.1.22.

Hope this helps.