Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error #42

Open
Varun-Sethu opened this issue Aug 27, 2017 · 9 comments
Open

Compilation Error #42

Varun-Sethu opened this issue Aug 27, 2017 · 9 comments

Comments

@Varun-Sethu
Copy link

I am having this issue when trying to compile my project:

# github.com/deuill/go-php
src/github.com/deuill/go-php/context.go:11:23: fatal error: main/php.h: No such file or directory
 // #include <main/php.h>
                       ^
compilation terminated.

Could this be because I set up the project incorrectly or another reason

@deuill
Copy link
Owner

deuill commented Aug 27, 2017

Hi, which OS and distribution are you trying to run this on?

@Varun-Sethu
Copy link
Author

Ubuntu 16.04 LTS

@Varun-Sethu
Copy link
Author

I moved everything up one directory because for some reason all my php files were stored in /usr/include/php/20151012. But now I am getting the following error:

/usr/bin/ld: cannot find -lphp7
collect2: error: ld returned 1 exit status

@deuill
Copy link
Owner

deuill commented Aug 28, 2017

Try building with the debian tag:

go get -u -v -tags 'php7 debian' github.com/deuill/go-php

@Varun-Sethu
Copy link
Author

Ok thanks.

@Varun-Sethu
Copy link
Author

I'm still getting the ld returned 1 error.

@deuill
Copy link
Owner

deuill commented Sep 1, 2017

Is it possible that you haven't installed the right package? You'd need to install libphp-embed.

@KMantas
Copy link

KMantas commented Sep 8, 2017

steps I had to follow to install under ubuntu:
apt-get install libphp7.0-embed
go get -u -v -tags 'php7 debian' github.com/deuill/go-php

on compile I still was getting error. had to change context.go(I took those definitions from php7-debian):

-// #cgo CFLAGS: -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM
-// #cgo CFLAGS: -I/usr/include/php/Zend -Iinclude
+// #cgo CFLAGS: -I/usr/include/php/20151012 -Iinclude/php7 -Isrc/php7
+// #cgo CFLAGS: -I/usr/include/php/20151012/main -I/usr/include/php/20151012/Zend
+// #cgo CFLAGS: -I/usr/include/php/20151012/TSRM
+// #cgo LDFLAGS: -lphp7.0

@boredwookie
Copy link

In case anyone else runs into this same issue: I am running Ubuntu 16.04 and encountered this same issue when trying to 'go get' the library (go get -u -v -tags 'php7 debian' github.com/deuill/go-php) and had to install these 2 packages for it to 'go get' successfully:

  • libphp7.0-embed
  • php7.0-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants