zephir-lang / zephir

Zephir is a compiled high-level language aimed to ease the creation of C-extensions for PHP
https://zephir-lang.com
MIT License
3.3k stars 466 forks source link

[ERROR] Internal extension compilation failed. #2152

Closed rui-alves closed 3 years ago

rui-alves commented 3 years ago

I'm just trying the exemple in zephir documentation and geting the output:

 Preparing for PHP compilation...
 Preparing configuration file...
sh: 1: ./configure: not found
 Compiling...
 Installing...

 [ERROR] Internal extension compilation failed. Check compile-errors.log for more information.

in the compile-errors.log:

make: *** No targets specified and no makefile found.  Stop.
make: *** No targets specified and no makefile found.  Stop.

zephir --help:

Zephir 0.12.20 by Andres Gutierrez and Serghei Iakovlev (source)

Ubuntu 20.04 LTS PHP 7.4.3

Any idea what i am doing wrong? (Sorry if I posted on wrong place)

Jeckerson commented 3 years ago

Hello, could you specify commands that you used?

rui-alves commented 3 years ago

Hello and thanks for the help!

I'm use:

$ zephir build

installed by:

composer global require phalcon/zephir

and this is the tree directory after zephir init (and where I am run the zephir build)

utils
├── utils/compile-errors.log
├── utils/compile.log
├── utils/config.json
├── utils/ext
│   ├── utils/ext/build
│   │   ├── utils/ext/build/ax_check_compile_flag.m4
│   │   ├── utils/ext/build/ax_gcc_func_attribute.m4
│   │   ├── utils/ext/build/config.guess
│   │   ├── utils/ext/build/config.sub
│   │   ├── utils/ext/build/libtool.m4
│   │   ├── utils/ext/build/ltmain.sh
│   │   ├── utils/ext/build/Makefile.global
│   │   ├── utils/ext/build/php_cxx_compile_stdcxx.m4
│   │   ├── utils/ext/build/php.m4
│   │   ├── utils/ext/build/pkg.m4
│   │   └── utils/ext/build/shtool
│   ├── utils/ext/clean
│   ├── utils/ext/config.m4
│   ├── utils/ext/configure.ac
│   ├── utils/ext/config.w32
│   ├── utils/ext/ext_config.h
│   ├── utils/ext/ext.h
│   ├── utils/ext/install
│   ├── utils/ext/kernel
│   │   ├── utils/ext/kernel/array.c
│   │   ├── utils/ext/kernel/array.h
│   │   ├── utils/ext/kernel/array.h.gch
│   │   ├── utils/ext/kernel/backtrace.c
│   │   ├── utils/ext/kernel/backtrace.h
│   │   ├── utils/ext/kernel/backtrace.h.gch
│   │   ├── utils/ext/kernel/concat.c
│   │   ├── utils/ext/kernel/concat.h
│   │   ├── utils/ext/kernel/concat.h.gch
│   │   ├── utils/ext/kernel/debug.c
│   │   ├── utils/ext/kernel/debug.h
│   │   ├── utils/ext/kernel/debug.h.gch
│   │   ├── utils/ext/kernel/exception.c
│   │   ├── utils/ext/kernel/exception.h
│   │   ├── utils/ext/kernel/exception.h.gch
│   │   ├── utils/ext/kernel/exit.c
│   │   ├── utils/ext/kernel/exit.h
│   │   ├── utils/ext/kernel/exit.h.gch
│   │   ├── utils/ext/kernel/fcall.c
│   │   ├── utils/ext/kernel/fcall.h
│   │   ├── utils/ext/kernel/fcall.h.gch
│   │   ├── utils/ext/kernel/fcall_internal.h
│   │   ├── utils/ext/kernel/fcall_internal.h.gch
│   │   ├── utils/ext/kernel/file.c
│   │   ├── utils/ext/kernel/file.h
│   │   ├── utils/ext/kernel/file.h.gch
│   │   ├── utils/ext/kernel/filter.c
│   │   ├── utils/ext/kernel/filter.h
│   │   ├── utils/ext/kernel/filter.h.gch
│   │   ├── utils/ext/kernel/globals.h
│   │   ├── utils/ext/kernel/globals.h.gch
│   │   ├── utils/ext/kernel/iterator.c
│   │   ├── utils/ext/kernel/iterator.h
│   │   ├── utils/ext/kernel/iterator.h.gch
│   │   ├── utils/ext/kernel/main.c
│   │   ├── utils/ext/kernel/main.h
│   │   ├── utils/ext/kernel/main.h.gch
│   │   ├── utils/ext/kernel/math.c
│   │   ├── utils/ext/kernel/math.h
│   │   ├── utils/ext/kernel/math.h.gch
│   │   ├── utils/ext/kernel/memory.c
│   │   ├── utils/ext/kernel/memory.h
│   │   ├── utils/ext/kernel/memory.h.gch
│   │   ├── utils/ext/kernel/object.c
│   │   ├── utils/ext/kernel/object.h
│   │   ├── utils/ext/kernel/object.h.gch
│   │   ├── utils/ext/kernel/operators.c
│   │   ├── utils/ext/kernel/operators.h
│   │   ├── utils/ext/kernel/operators.h.gch
│   │   ├── utils/ext/kernel/README.md
│   │   ├── utils/ext/kernel/require.c
│   │   ├── utils/ext/kernel/require.h
│   │   ├── utils/ext/kernel/require.h.gch
│   │   ├── utils/ext/kernel/string.c
│   │   ├── utils/ext/kernel/string.h
│   │   ├── utils/ext/kernel/string.h.gch
│   │   ├── utils/ext/kernel/time.c
│   │   ├── utils/ext/kernel/time.h
│   │   ├── utils/ext/kernel/time.h.gch
│   │   ├── utils/ext/kernel/variables.c
│   │   ├── utils/ext/kernel/variables.h
│   │   └── utils/ext/kernel/variables.h.gch
│   ├── utils/ext/php_ext.h
│   ├── utils/ext/php_utils.h
│   ├── utils/ext/run-tests.php
│   ├── utils/ext/utils
│   │   ├── utils/ext/utils/greeting.zep.c
│   │   └── utils/ext/utils/greeting.zep.h
│   ├── utils/ext/utils.c
│   └── utils/ext/utils.h
└── utils/utils
    └── utils/utils/greeting.zep
utils/.zephir
└── utils/.zephir/0.12.20-$Id$
    ├── utils/.zephir/0.12.20-$Id$/compiled-files-sum
    ├── utils/.zephir/0.12.20-$Id$/ext_utils_greeting.zep.c.md5
    ├── utils/.zephir/0.12.20-$Id$/ext_utils_greeting.zep.h.md5
    ├── utils/.zephir/0.12.20-$Id$/gcc-version
    ├── utils/.zephir/0.12.20-$Id$/php-includes
    ├── utils/.zephir/0.12.20-$Id$/utils_greeting.zep.js
    └── utils/.zephir/0.12.20-$Id$/utils_greeting.zep.js.php

Zephir Parser in php -i

The Zephir Parser delivered as a C extension for the PHP language.
Zephir Parser => enabled
Author => Zephir Team and contributors
Version => 1.3.6
Build Date => Feb 22 2021 09:14:23
AlexNDRmac commented 3 years ago

@rui-alves it looks like you don't have Autotools. Try to install apt-get install autoconf, also check if you have phpize on your machine - without it you cannot get configure script and Makefile to compile extension.

rui-alves commented 3 years ago

Hello @AlexNDRmac! Thanks for the help!

I verify and has all the packges in my enviroment:

$ sudo apt-get install autoconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
autoconf is already the newest version (2.69-11.1).
0 upgraded, 0 newly installed, 0 to remove and 86 not upgraded.  
$ phpize -v
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
AlexNDRmac commented 3 years ago

Can you try to run next commands from utils/ext dir?

cd utils/ext phpize // check if configure file exists after phpize ./configure // check if Makefile exists after configure make

rui-alves commented 3 years ago

This test helped me to find the problem!

I was execute the zephir build in a vagrant shared folder. I puted some rulles on Vagrantfile:

mount_options: ["dmode=775,fmode=664"]

With that, any files generate by zephir had no permission to execute ...

Well, problem discovered!

Thank's a lot for the pacience @AlexNDRmac and @Jeckerson