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

Cannot perl Makefile.PL, always ask EXPATLIBPATH= EXPATINCPATH= #83

Open
aptxinc opened this issue Apr 22, 2020 · 3 comments
Open

Cannot perl Makefile.PL, always ask EXPATLIBPATH= EXPATINCPATH= #83

aptxinc opened this issue Apr 22, 2020 · 3 comments

Comments

@aptxinc
Copy link

aptxinc commented Apr 22, 2020

Hello,

I try to install XML::Parser from CPAN. I have installed expat-win32bin-2.2.9.exe and when I do the command perl Makefile.PL EXPATLIBPATH="C:\Expat\Bin" EXPATINCPATH="C:\Expat\Source\lib", always ce message :

Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' (or
'libexpat1-dev') package with your OS package manager. See 'README'.

Or you can download expat from:

http://sourceforge.net/projects/expat/

If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

Perl building on Windows 10 with Visual Studio 2019.

Thanks.

@glensc
Copy link

glensc commented May 28, 2023

this worked for me:

brew install expat
export EXPATINCPATH="$(brew --prefix)/opt/expat/include"
export EXPATLIBPATH="$(brew --prefix)/opt/expat/lib"
cpanm -L extlib XML::Parser

this didn't work for me, what brew install expat suggested:

For compilers to find expat you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/expat/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/expat/include"

For pkg-config to find expat you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/expat/lib/pkgconfig"

@ballapete
Copy link

I am having a similar problem on an old Mac with Perl 5.34, using the MacPorts package manager. It is able to step through the stages of building and installing an Open Source Software. Extracting and possibly patching the source are trivial. For configuration step this is being used as invocation:

port -vs configure p5.34-xml-parser
--->  Computing dependencies for p5.34-xml-parser.
--->  Configuring p5.34-xml-parser
Executing:  cd "/opt/local/var/macports/build/_Volumes_BSD-Linux_MacPorts-distfiles_ports_perl_p5-xml-parser/p5.34-xml-parser/work/XML-Parser-2.47" && /opt/local/bin/perl5.34 Makefile.PL INSTALLDIRS=vendor CC="/opt/local/bin/gcc-apple-4.2" LD="/opt/local/bin/gcc-apple-4.2" EXPATLIBPATH=/opt/local/lib EXPATINCPATH=/opt/local/include

which then leads to:

Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' (or
'libexpat1-dev') package with your OS package manager. See 'README'.

Or you can download expat from:

http://sourceforge.net/projects/expat/

If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

The variables are set via this recipe:

    configure.post_args-append \
                    EXPATLIBPATH=${prefix}/lib \
                    EXPATINCPATH=${prefix}/include

This scheme obviously works on most versions of macOS or Mac OS X. A similar recipe is used for Template::Toolkit and Image::PNG::Libpng – which both build and install without problems. On my old Mac…

glensc solves the problem by setting environment variables instead of passing arguments to the configuration process. So I did the same, using this recipe:

    configure.env-append \
                    EXPATLIBPATH=${prefix}/lib \
                    EXPATINCPATH=${prefix}/include

And I had success too, XML::Parse built, installed, and even tested fine!

@ryandesign
Copy link

I have installed expat-win32bin-2.2.9.exe and when I do the command perl Makefile.PL EXPATLIBPATH="C:\Expat\Bin" EXPATINCPATH="C:\Expat\Source\lib"

@aptxinc Are you sure those are the correct directories? I tried installing expat-win32bin-2.2.9.exe and by default it installs to C:\Program Files (x86)\Expat 2.2.9. But the above could be correct if you changed the installation directory to C:\Expat.


@glensc I do not believe what you're reporting has anything to do with what @aptxinc was experiencing.

this worked for me:

brew install expat
export EXPATINCPATH="$(brew --prefix)/opt/expat/include"
export EXPATLIBPATH="$(brew --prefix)/opt/expat/lib"
cpanm -L extlib XML::Parser

Great. Specifying EXPATINCPATH and EXPATLIBPATH as either environment variables or as arguments to perl Makefile.PL is the correct way to tell XML::Parser where expat is.

this didn't work for me, what brew install expat suggested:

For compilers to find expat you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/expat/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/expat/include"

For pkg-config to find expat you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/expat/lib/pkgconfig"

Specifying LDFLAGS and CPPFLAGS is the correct way to tell many software packages (those that use those variables) where something is. Specifying PKG_CONFIG_PATH is the correct way to tell software that uses pkg-config where something is. XML::Parser is evidently not either of those two kinds of software so those notes are inapplicable here.

The developer of XML::Parser has no influence over the notes that Homebrew prints out when you install expat. If you believe Homebrew should print different information, you'll have to discuss that with the developers of Homebrew, but I guess they will say that the information it currently prints is exactly what they want it to print and they won't make any changes. They probably will not feel it necessary to change what the expat install prints just to accommodate the unique expectations of XML::Parser.


I am having a similar problem on an old Mac with Perl 5.34

@ballapete I am able to reproduce this issue on PowerPC Mac OS X 10.4 but I do not believe that your problem is at all related to either of the previous two issues. We can deal with it in the MacPorts ticket you filed about it: https://trac.macports.org/ticket/69245.

glensc solves the problem by setting environment variables instead of passing arguments to the configuration process

@glensc didn't mention having tried arguments instead of environment variables. The code clearly allows EXPATINCPATH and EXPATLIBPATH to be specified either as environment variables or as arguments. I suspect it would have also worked fine if arguments had been used instead of environment variables.

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