Mac OS 编译第三方库(续)

来源:互联网 发布:java定时任务时间格式 编辑:程序博客网 时间:2024/05/15 06:09

1. Compile and installpkg-config:

(which is a program used to retrieve information about installed libraries)

Open Terminal.app and navigate to the newly-created pkg-config folder. Then, run the following commands in order, after the prior command has completed. If you’ve ever compiled anything from source in the command line before, this may be familiar (and will be, by the time we’re through):

./configure

make

sudo make install (be prepared to provide your password)

2. Compile and installgettext:

(which is a set of tools for multilanguage support in GNU applications)

Navigate to the gettext folder, and follow the same steps as before:

./configure

make

sudo make install

3. Compile and installlibiconv:

(which is a text encoding converter, used to convert between various character encodings in international text)

As before, navigate to the libiconv folder in your Downloads folder, and run your favorite three commands, entering your password for the third: ./configure, then make, then sudo make install.

4. Recompilegettext:

Yes. Believe it or not, but libiconv and gettext have circular dependencies and depend upon each other for certain features. While libiconv needed certain features from gettext to compile with crucial functionality enabled, gettext also requires libiconv to be installed in order to enable yet more features. This time, we have to clean out any trace of prior compilation, so we’re going to prefix a command like so:

make distclean

./configure

make

sudo make install

5. Compile and installGlib:

GLib is a core suite of libraries for unix- and or gnome-style applications written in C. This one is a bit bigger than the others, and also requires a bit of source code hacking to get installed. If you haven’t grabbed a snack yet, now’s a good time to, unless you are one of those people with an impeccably-clean keyboard and desk. First, we start the configuration process by navigating to the glib folder and running:

./configure

Once this is complete, we’ll need to replace 3 lines in a certain source file.

From what I understand, apple’s included libiconv doesn’t support 64bit, and I happen to be building a 64bit irssi. So, let’s make the changes below to make sure the libiconv that we’ve built is used. Navigate to the ‘glib’ folder (just plain glib, the one INSIDE of the main glib source folder), and open ‘gconvert.c’ with your favorite editor.

#if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
#error GNU libiconv in use but included iconv.h not from libiconv
#endif
#if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H)
#error GNU libiconv not in use but included iconv.h is from libiconv
#endif

replace the last 3 lines, like so:

#if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
#error GNU libiconv in use but included iconv.h not from libiconv
#endif
#if !(defined(__APPLE__) && defined(__LP64__)) && !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H)
#error GNU libiconv not in use but included iconv.h is from libiconv
#endif

Save and close the file in place. Now you’re ready to compile and install glib:

make

sudo make install

原创粉丝点击