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

Where is the extension file? #82

Open
murraycollingwood opened this issue May 30, 2022 · 4 comments
Open

Where is the extension file? #82

murraycollingwood opened this issue May 30, 2022 · 4 comments
Labels

Comments

@murraycollingwood
Copy link

Description

I'm sorry this seems like a dumb question, but I can't find the extension file anywhere.
I did the brew install which appeared to work fine

Jacaranda:trunk murraycollingwood$ brew install traildb/judy/judy
==> Downloading https://downloads.sourceforge.net/project/judy/judy/Judy-1.0.5/Judy-1.0.5.tar.gz
Already downloaded: /Users/murraycollingwood/Library/Caches/Homebrew/downloads/811cf99b7c77d4f35a25ce2e232e5f8f8bc1eb030a8f08ee09317475108af72a--Judy-1.0.5.tar.gz
==> Installing judy from traildb/judy
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 13.3.

==> ./configure --prefix=/opt/homebrew/Cellar/judy/1.0.5
==> make install
🍺  /opt/homebrew/Cellar/judy/1.0.5: 104 files, 1.4MB, built in 33 seconds
==> `brew cleanup` has not been run in the last 30 days, running now...

I then added the extension to the php.ini file:

extension=memprof.so

And lastly, when I run my php unit test:

Warning: PHP Startup: Unable to load dynamic library 'memprof.so' (tried: /opt/homebrew/lib/php/pecl/20210902/memprof.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/memprof.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/memprof.so' (no such file), '/usr/local/lib/memprof.so' (no such file), '/usr/lib/memprof.so' (no such file)), /opt/homebrew/lib/php/pecl/20210902/memprof.so.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/memprof.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/memprof.so.so' (no such file), '/usr/local/lib/memprof.so.so' (no such file), '/usr/lib/memprof.so.so' (no such file))) in Unknown on line 0

Was it my xcode / clt being slightly out of date?
Was it something in the brew?
Or did it all work and I'm just looking in the wrong directory?

Cheers
Murray

php-memprof Version

judy 1.0.5

PHP Version

PHP 8.1

Operating System

OSX 12.2

@murraycollingwood
Copy link
Author

I'm re-reading through the install instructions, and I can see libJudy is defined as a Dependency.
So I'm thinking now the libJudy is included when compiling the memprof library.
So now I'm running the pecl install memprof command. It's working till I get to the point where I'm looking for Judy.h

checking whether to enable memprof support... yes, shared
checking for judy lib... yes, shared
checking for include/Judy.h in /usr/local /usr... not found
configure: error: Please install lib judy
ERROR: `/private/tmp/pear/temp/memprof/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config' failed

So then I copy Judy.h to /usr/local/include/Judy.h
image

I then rerun the pecl install memprof thinking this should get further, but it doesn't...

checking whether to enable memprof support... yes, shared
checking for judy lib... yes, shared
checking for include/Judy.h in /usr/local /usr... not found
configure: error: Please install lib judy
ERROR: `/private/tmp/pear/temp/memprof/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config' failed

Looks just the same - I'm not making any progress on this.

Cheers
Murray

@arnaud-lb
Copy link
Owner

Hi

Currently the pecl package doesn't support specifying a custom libjudy install path.

The manual install method will work: https://github.com/arnaud-lb/php-memory-profiler#installing-manually

@murraycollingwood
Copy link
Author

@arnaud-lb
The instructions aren't entirely clear - there are a lot of assumptions involved:
Download the source and run the following commands in the source directory:

  1. This assumes just using the download option from the 'Code' button on this page. That's an easy assumption.
  2. Next - there are checkout options with git or svn, or download the zip. Again, I'm going to assume we are downloading the zip file.
  3. Where should I extract this - generally I'm using brew to build all of these things... but I'm not aware that is an option. Is it? So I'm going to assume that I will just stick in my home folder somewhere and build it there.
  4. phpize seems to work, although there was one warning configure.ac:161: warning: The macro AC_TRY_LINK' is obsolete.`
  5. The ./configure required the one where I specified the path to Judy/1.0.5, it seems to work.
  6. make seems to work, again a warning warning: No support for malloc hooks, this build will not track persistent allocations [-W#warnings]
  7. make install appears to install the library in the correct folder.
  8. Assume we need to restart Apache2 - restarts okay.
  9. Ran phpinfo() but there is no indication of memprof or Judy. Assuming we should now add the library to the php.ini file. Added extension=memprof.so to the php.ini file and restart Apache2 again. It now appears in the phpinfo()

image

I hope you don't mind - but I've added this detail to help others, like me, who may need a few more instructions to get this working. Thanks for your help.

Now, to turn it on in my script and start working out my memory leaks.

@arnaud-lb
Copy link
Owner

Thank you for the details !

Happy debugging :)

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

No branches or pull requests

2 participants