Problem installing/rebuilding Xdebug under Apple Silicon M1 - xdebug

Failing to install XDebug under the new Apple Silicon M1 under Big Sur - After using pecl install xdebug and running php --ini I am getting the following error:
PHP Warning: Failed loading Zend extension 'xdebug.so' (tried: /opt/homebrew/lib/php/pecl/20190902/xdebug.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found. Did find:
/opt/homebrew/lib/php/pecl/20190902/xdebug.so: mach-o, but wrong architecture
/opt/homebrew/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=22), /opt/homebrew/lib/php/pecl/20190902/xdebug.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so.so, 9): image not found)) in Unknown on line 0
Warning: Failed loading Zend extension 'xdebug.so' (tried: /opt/homebrew/lib/php/pecl/20190902/xdebug.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found. Did find:
/opt/homebrew/lib/php/pecl/20190902/xdebug.so: mach-o, but wrong architecture
/opt/homebrew/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=22), /opt/homebrew/lib/php/pecl/20190902/xdebug.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so.so, 9): image not found)) in Unknown on line 0
I tried recompiling xdebug from source (git clone git://github.com/xdebug/xdebug.git) with the same results. Can I force the correct architecture in the config.m4 when recompiling xdebug? - ANy other suggestions?

I needed to specify the architecture.
It worked with :
arch -arm64 sudo pecl install xdebug

tried install with pecl install xdebug and got this error:
Build process completed successfully
Installing '/opt/homebrew/Cellar/php#7.4/7.4.15_1/pecl/20190902/xdebug.so'
Warning: mkdir(): File exists in System.php on line 294
Warning: mkdir(): File exists in /opt/homebrew/Cellar/php#7.4/7.4.15_1/share/php#7.4/pear/System.php on line 294
ERROR: failed to mkdir /opt/homebrew/Cellar/php#7.4/7.4.15_1/pecl/20190902
I used fix from this link https://patriqueouimet.ca/tip/installing-php-and-pecl-extensions-on-macos and it helped
Your warnings are about architecture, maybe need to remove and install again - i was do all from arm64 terminal...

Simply open your php.ini file and replace this line:
zend_extension="xdebug.so"
with whatever the installation process offered you
in my case it's:
/opt/homebrew/Cellar/php/8.1.5/pecl/20210902/xdebug.so
And remember to restart your services!

On a fresh MacOS installation I was getting an error:
Warning: mkdir(): File exists in System.php on line 294 PHP Warning: mkdir(): File exists in /usr/local/Cellar/php/7.3.3/share/php/pear/System.php on line 294
Warning: mkdir(): File exists in /usr/local/Cellar/php/7.3.3/share/php/pear/System.php on line 294 ERROR: failed to mkdir /usr/local/Cellar/php/7.3.3/pecl/20180731
You simply need to make the directory the script cannot, to accomplish this, run the following:
pecl config-get ext_dir | pbcopy
mkdir -p {paste clipboard value}
Now you can install PECL extensions
pecl install xdebug

You will likely have to install Xdebug through PECL with:
arch -x86_64 sudo pecl install xdebug

Not sure if this was the problem. However, I did a full reset of my M1 Macbook. And this time I only used arm software (iterm, homebrew...), this time it installed without any issue.

Related

Undefined subroutine &main::open_quote called at /usr/local/bin/autom4te line 262

Hi I try to install xdebug via pecl on macox (Big Sur 11.5.2)
But I get error message
xdebug volodymyr$ pecl install xdebug
downloading xdebug-3.0.4.tgz ...
Starting to download xdebug-3.0.4.tgz (215,870 bytes)
.............................................done: 215,870 bytes
87 source files, building
running: phpize
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
Undefined subroutine &main::open_quote called at /usr/local/bin/autom4te line 262.
ERROR: `phpize' failed
I update perl but it did help me (I can't catch if the open_quote is a part of perl)
Also I didn't find any information in the internet that is related with open_quote function issue
I tried to install xdebug from source and get the same bug on the ./phpize step
Resolve:
Just reinstall autoconf automake libtool
I run
brew reinstall autoconf automake libtool
After that I run brew link --force autoconf and it resolved the trouble
The error here comes from autom4te, not pecl or ./phpize. You need to update automake and autoconf, and/or related packages.

PHPUnit gives No Code Coverage Driver Is Available

I have a laravel project and I tried to run phpunit to give me a coverage report. I ran the command vendor/bin/phpunit --coverage-html storage/test-output-data/coverage-html and it gave the output:
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
Error: No code coverage driver is available
I tried to resolve this situation by doing a sudo pecl install pcov, but running the phpunit still gave the same error above.
I noticed that I have the file /usr/lib/php/20170718/pcov.so. So I added the line extension=/usr/lib/php/20170718/pcov.so to my /etc/php/7.4/cli/php.ini file. But when I type php -v, I get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/pcov.so' (tried: /usr/lib/php/20170718/pcov.so (/usr/lib/php/20170718/pcov.so: undefined symbol: _zval_ptr_dtor), /usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so (/usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.11 (cli) (built: Oct 10 2020 19:44:50) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies
I also have a folder called /usr/lib/php/20190902 but it does not have a pcov.so file.
I also tried doing a sudo pecl install xdebug, but I run into similar errors as above where phpunit says there's no driver and typing php -v says some global variable is missing similar to the pcov issue.
What am I doing wrong?
I noticed that I have the file /usr/lib/php/20170718/pcov.so. So I added the line extension=/usr/lib/php/20170718/pcov.so to my /etc/php/7.4/cli/php.ini file.
This file is for PHP 7.2 (based on 20170718 part) while you are trying to use it in PHP 7.4.
You need to get the right version of Xdebug (or PCOV) for your PHP 7.4. (NOTE: for PHP 7.4 the API version (and the right folder in the path) will be 20190902.)
Try this solution from the following answer to switch / install extensions via PECL for specific PHP version (7.4 instead of your current 7.2): https://stackoverflow.com/a/54594604/783119
sudo pecl -d php_suffix=7.4 install <package-name>
This has nothing to do with PHPUnit. You have a problem with your PHP environment: "PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/pcov.so' (tried: /usr/lib/php/20170718/pcov.so (/usr/lib/php/20170718/pcov.so: undefined symbol: _zval_ptr_dtor), /usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so (/usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0"
You just need to install xdebug, so the coverage knows how to run.
For example, for PHP 7.1, it's this package:
sudo apt install php7.1-xdebug
Just fixed it today for my scenario. In your case, just change the PHP version to:
sudo apt install php7.4-xdebug

MacPorts failed install port

I have trouble installing PHP, MySQL and Apache2 using MacPorts. Currently my OS is Mavericks and i'm downloading the official binary package for mavericks (also tried compile from source and running selfupdate) but I got this error message:
---> Building readline
Error: org.macports.build for port readline returned: command execution failed
Error: Failed to install readline
Please see the log file for port readline for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_readline/readline/main.log
Error: The following dependencies were not installed: apache2 apr-util mysql5 readline tcp_wrappers sqlite3 libedit pcre bzip2 autoconf213 gawk xz m4 gsed libtool libxml2 mhash pkgconfig
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port php5 failed
How can I solve this?
Thanks
Can you please check the error message block within the log file:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_readline/readline/main.log
Also make sure xcode command line tools are installed.
FYI: I faced similar error in Mavericks. My case was:
opt is a different partition which is mounted in /Volumes/opt
/opt is a symbolic link to /Volumes/opt.
It has been solved after editing /opt/local/etc/macports/macports.conf by replacing /opt with /Volumes/opt. Note sure this can help your case.

Error during installation of Cairo package on Red Hat (RHEL)

I am working on R and I need to install the Cairo package.
install.packages("Cairo")
Specification
R version 2.15.0 (2012-03-30)
OS : Red Hat Enterprise Linux Server release 6.1 (Santiago)
I'm getting following error message:
xlib-backend.c:34:74: fatal error: X11/Intrinsic.h: No such file or directory
compilation terminated.
make: *** [xlib-backend.o] Error 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/usr/local/lib64/R/library/Cairo’
The downloaded source packages are in
‘/tmp/RtmpqtvjPA/downloaded_packages’
Updating HTML index of packages in '.Library'
Making packages.html ... done
Warning message:
In install.packages("Cairo") :
installation of package ‘Cairo’ had non-zero exit status
Had same error. To solve:
Ran the 3 following pieces which were already installed, but doesn't hurt to run and check
yum install libX11
yum install libX11-devel
yum install libXt
Then ran the following which fixed my problem:
yum install libXt-devel
Was able to install.packages("Cairo") afterwards in R 2.15.0 RHEL6.1
On Alpine-linux I fixed this using the following:
apk add cairo-dev

Cannot install YUM in MacOS

I'm trying to run the build script from HTML5 Boilerplate and I have to install YUM for that. I am on Mac OS Snow Leopard 10.6.8. When I did sudo port install yum, i'm getting the following error. Any idea how can I rectify it and install yum properly?
---> Computing dependencies for py24-nose
---> Dependencies to be installed: py24-distribute
---> Activating py24-distribute #0.6.24_0 Error: Target org.macports.activate returned: Image error:
/opt/local/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg-info
already exists and does not belong to a registered port. Unable to
activate port py24-distribute. Use 'port -f activate py24-distribute'
to force the activation. Error: Failed to install py24-distribute Log
for py24-distribute is at:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-distribute/py24-distribute/main.log
Error: The following dependencies were not installed: py24-distribute
Error: Unable to upgrade port: 1 Error: Unable to execute port:
upgrade py24-nose failed To report a bug, see
<http://guide.macports.org/#project.tickets>
Previously after installing YUM, i was getting Segmentation Fault, so I uninstalled and installed it again using Macports to get the above error.
I think you've got the wrong end of the stick here. You do not need to install YUM on the Mac. In fact, that act is sheer madness, because you already have a perfectly good package manager in the shape of MacPorts!
Read again what it says
If you're on Mac or Linux...
You've got all your dependencies pre-installed, likely. You may need a yum install ant-contrib or what have you.
The key bit there is "or what have you". That is a cryptic way of saying "or the equivalent command for your package manager". On Red Hat-based systems, the package manager is indeed YUM; on Debian systems, it's APT; on the Mac, it's MacPorts.
So, remove your YUM installation, and simply do:
port install ant-contrib
You can now proceed to actually running Ant.

Resources