You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

compilation c code failed because libxml2 library is missing on my iMac sonoma

I'm trying to compile a C-code for research (sac seismic analysis), and the compilation require libxml2 libraries which obviously are missing on my iMac (Sonoma 14.7.1). No libxml in /usr/lib or usr/local/lib.

How can I implement them or are those librairies hidden somewhere?


Thanks for you help

Christel

iMac 27″, macOS 14.7

Posted on Nov 26, 2024 2:21 AM

Reply
4 replies

Nov 26, 2024 3:37 AM in response to christel184

It depends on whether you are using Apple's Developer tools (Xcode or Command Line Tools for Xcode), or some other compilation suite (e.g. GNU C) or IDE. If any dependencies were installed with a package manager (homebrew, MacPorts, etc.) and your code depends upon them, you need to refer to those libraries and include instructions.


The current Xcode and command line tools for Xcode install libxml2 in their respective lib and include locations.



Nov 26, 2024 2:29 PM in response to christel184

I haven't done anything with X11 XTerm in ages, so cannot comment on compilation suite behavior in that environment. It would seem to me that you should find the xml2 bits in these locations that clang should just find on macOS 15.1.1 using the Command Line Tools for Xcode 16.1. I don't have a Sonoma installation at this time, but would expect the libXML stuff to be in the most recent locations for the last SDKs installed there.


Include

/Library/Developer/CommandLineTools/SDKs/MacOSX15.1.sdk/usr/include/libxml2/libxml


Library

/Library/Developer/CommandLineTools/SDKs/MacOSX15.1.sdk/usr/lib/libxml2.2.tbd


No need to install libxml2 from a package manager.


compilation c code failed because libxml2 library is missing on my iMac sonoma

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.