编译libjpeg [英] Compiling libjpeg

查看:89
本文介绍了编译libjpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人成功地在一些编译器中包含libjpeg?我试过一切:Dev C ++,VS10,CodeBlocks,手工复制头和lib,添加与链接器,但没有。现在我真的很困惑,因为没有一个官方指南如何编译它在任何编译器。如果有人可以提供有关如何在任何编译器中编译库的教程,我将非常高兴。
提前谢谢。

解决方案

这是我在Windows上使用MinGW创建libjpeg:



1。使用MSYS获取MinGW



我有一份来自 http:// sourceforge的副本.net / projects / mingw /
引用自www.mingw.org:


MSYS是一个GNU工具集合,例如bash,make,gawk和grep允许构建依赖于传统UNIX工具的应用程序和程序。


我们需要它来运行<$ c






2。获取libjpeg源



http://www.ijg.org/ ,采取Unix格式包(Windows不能使用此过程)。我使用了 jpeg_8d 版本。






< h2> 3。准备建筑物目录

我在 D中创建了名为 tmp \ ,但你可以选择任何适合你的需要。重要的是MSYS中路径的名称。由于它向Windows提供了一些* Unixity *,路径不能以其原始形式使用。
简而言之:



C:\path\to\file 变为 / c / path / to / file 在MSYS土地,所以
D:\tmp 变为 / d / tmp



解压缩 D:\tmp ,因此您有 jpeg-8d 目录。



创建<$ c $在 D:\tmp 中的 jpeg-build 目录,它将保存构建的库。



现在一切准备好了。






./configure,make,make install



这是在Unix土地上建立的口头禅。应添加一个选项,将安装过程重定向到 D:\tmp\jpeg-build



在MSYS shell(在Windows开始菜单中也命名为MinGW shell)中运行以下命令:

  cd / d / tmp / jpeg -8d 
./configure --prefix = / d / tmp / jpeg-build
make
make install

作为一个额外的步骤,您可以运行 make test

$ c>。



这些命令将构建libjpeg的静态和共享版本。






5。取出商品,删除暂时



如果一切正常,您可以删除 D:\tmp\jpeg-8d 目录,但保留 jpeg-build 。它包含:




  • 一个 include 目录,包含libjpeg头文件。您可以将它们移动到您的编译器的头文件目录。

  • a lib 目录, .a 文件传递给链接器。您可以将它们移动到编译器的库目录。

  • 一个 bin 目录,包含libjpeg共享库 libjpeg目录中包含 -8.dll 和jpeg工具

  • a



现在,您可以通过指示来创建程序并将其链接到libjpeg



您可以找到有关libjpeg建筑物的许多细节,以及



我希望这将是有用的。


Is there anyone who succeed to include libjpeg in some compiler? I tried everything: Dev C++, VS10, CodeBlocks, copy the headers and the lib by hand, add with the linker but nothing. Right now I am really confisued as there is not an official guide on how to compile it in any compiler. I would be really happy if someone could provide a tutorial on how the library can be compiled in any compiler. Thank you in advance.

解决方案

Here is how I've built libjpeg using MinGW on Windows :

1. Get MinGW with MSYS

I've got a copy from http://sourceforge.net/projects/mingw/. Quoting from www.mingw.org :

MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present.

We will need it to run the configure script that comes with libjpeg sources.


2. Get libjpeg sources

From http://www.ijg.org/, take the Unix format package (the Windows one won't work with this procedure). I took the jpeg_8d version.


3. Prepare a building directory

I've made a temporary directory named tmp in D:\, but you could choose whatever suits your needs. The thing that matters is the name of paths in MSYS. As it brings some * Unixity * to Windows, paths cannot be used in their original form. In a nutshell:

C:\path\to\file becomes /c/path/to/file in MSYS land, an so D:\tmp becomes /d/tmp.

Decompress the libjpeg sources in D:\tmp, so you have a jpeg-8d directory in there.

Create a jpeg-build directory inside D:\tmp, it will hold the built library.

Now everything is ready for the build.


4. ./configure, make, make install

That is the mantra of building in Unix land. An option should be added to redirect the install process to D:\tmp\jpeg-build.

Run the following commands in an MSYS shell (also named MinGW shell in Windows start menu):

cd /d/tmp/jpeg-8d
./configure --prefix=/d/tmp/jpeg-build
make
make install

As an additional step, you can run make test for safety.

These commands will build both static and shared versions of libjpeg.


5. Take the goods, delete the temporaries

If everything runs fine, you can delete the D:\tmp\jpeg-8d directory, but keep the jpeg-build one. It contains:

  • an include directory, containing libjpeg headers. You can move them to your compiler's headers directory.
  • a lib directory, with .a file to pass to the linker. You can move them to your compiler's library directory.
  • a bin directory, holding the libjpeg shared library libjpeg-8.dll and jpeg tools.
  • a share directory, containing man pages for the jpeg tools.

You can now build your program and link it against libjpeg by indicating the right include and library paths.


You can find many details about the libjpeg building and installation process in install.txt inside the source package.

I hope this will be useful.

这篇关于编译libjpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆