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

macOS: cannot build remacs due to libxml/tree.h file not found #1557

Open
wingyplus opened this issue Dec 27, 2019 · 10 comments
Open

macOS: cannot build remacs due to libxml/tree.h file not found #1557

wingyplus opened this issue Dec 27, 2019 · 10 comments

Comments

@wingyplus
Copy link

Step to reproduce

  1. ./autogen.sh
  2. ./configure --enable-rust-debug
  3. make

Expected:

make should be fine

Actual:

xml.c:26:10: fatal error: 'libxml/tree.h' file not found
#include <libxml/tree.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [xml.o] Error 1
make: *** [src] Error 2

This is a build log from my machine https://gist.github.com/wingyplus/cfb1de708870ada1cab1183c66efaa06.

@db48x
Copy link
Collaborator

db48x commented Dec 27, 2019

In addition to having the libxml2 library installed, you also need the libxml2 library's headers installed. The headers are not normally installed with the library because most users never compile any software on their computer, so it would be a waste of space.

Since I don't use a mac, I can't tell you how to install these headers. On my computer I would run dnf install libxml2-dev and my package manager would do all the work for me. In the primitive days of old it was not uncommon to have to download a tarball containing the source code for a library and use that. (Hopefully OSX does not force you to take such extreme measures.)

If you want to build Remacs without going through the trouble of finding these headers, you can run configure the --without-xml2 option. The resulting Remacs will lack some features, but will still be a good text editor.

@wingyplus
Copy link
Author

@db48x Thanks for your help. I work fine when add --without-xml2. But after I ran ./src/remacs it open program with blank screen like this:

Screen Shot 2562-12-27 at 14 09 53

@vijaykiran
Copy link

I was able to build with libxml using:

brew install libxml2
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"

before running autogen/configure/make.

But, I've the same issue of editor not displaying any text on macOS.

@shaleh
Copy link
Collaborator

shaleh commented Jan 6, 2020

@wingyplus the blank screen is likely due to other Mac issues on the latest builds of MacOS. Several of us have stayed behind to work around this but I know that isn't an option for those with new hardware.

@wingyplus
Copy link
Author

@shaleh can it build with nox option? As my daily life, I didn't uses emacs via GUI but from terminal itself.

@shaleh
Copy link
Collaborator

shaleh commented Jan 10, 2020

@wingyplus it should work. We use the nox option as part of the Travis test. We build both with and without a gui for every PR on Linux and MacOS. Please let us know if that doesn't successfully build or run.

@cjohansson
Copy link
Contributor

macOS 10.15 (Catalina) has libxml2 built-in you just need to specify paths, this works:

export LIBXML2_CFLAGS=`xml2-config --cflags`
export LIBXML2_LIB=`xml2-config --libs`

I'm revisiting remacs on my mac now

@cjohansson
Copy link
Contributor

cjohansson commented Apr 13, 2020

Compilation works, GUI doesn't work, run in terminal works. You probably need to merge some commits by Alan Third to get macOS GUI work in 10.15 Catalina

@shaleh
Copy link
Collaborator

shaleh commented Apr 13, 2020

Thanks for the update @cjohansson

Can you guess as to why pkg-config is not doing its job to help us find libxml2?

@cjohansson
Copy link
Contributor

No I have no idea

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

5 participants