这是 Makefile 中的 CFLAGS。
CFLAGS = -I/usr/include/libglade-2.0 -I/usr/include/gsl `pkg-config --cflags --libs gtk+-2.0` -lglade-2.0 -lglut -I/usr/local/include/dc1394 -ldc1394
Run Code Online (Sandbox Code Playgroud)
我想使用 CMAKE 而不是 Makefile。这部分是我写的CMakeLists.txt文件。
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED "gtk+-2.0")
# Add the path to its header files to the compiler command line
include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
# Add any compiler flags it requires
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GTK_CFLAGS}")
# Add the makefile target for your executable and link in the GTK library
target_link_libraries(${CMAKE_PROJECT_NAME} ${GTK_LIBRARIES})
# gtk and glade
find_package(GTK2 2.10 REQUIRED gtk glade)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} ${GTK2_LIBRARIES}) …Run Code Online (Sandbox Code Playgroud) 为什么最新的Debian 的 Sid(Sid,在Debian Buster 10.0之后)测试存储库不包含pkg-config的.pc文件?
的结果dpkg -L freeglut3-dev:
/.
/usr
/usr/include
/usr/include/GL
/usr/include/GL/glut.h
/usr/include/GL/freeglut_std.h
/usr/include/GL/freeglut_ext.h
/usr/include/GL/freeglut.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libglut.a
/usr/share
/usr/share/doc
/usr/share/doc/freeglut3-dev
/usr/share/doc/freeglut3-dev/changelog.gz
/usr/share/doc/freeglut3-dev/index.html
/usr/share/doc/freeglut3-dev/progress.html
/usr/share/doc/freeglut3-dev/ogl_sm.png
/usr/share/doc/freeglut3-dev/download.html
/usr/share/doc/freeglut3-dev/freeglut_user_interface.html
/usr/share/doc/freeglut3-dev/copyright
/usr/share/doc/freeglut3-dev/freeglut_logo.png
/usr/share/doc/freeglut3-dev/freeglut.html
/usr/share/doc/freeglut3-dev/structure.html
/usr/share/doc/freeglut3-dev/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/libglut.so
Run Code Online (Sandbox Code Playgroud)
请注意,在freeglut的存储库中有freeglut.pc.in文件,并且包含在CMakeLists.txt中。
我知道有一些关于这个问题的线程,但它们没有涉及任何Linux发行版。
相关问题:在Linux上安装Freeglut。
我正在尝试利用go build我的资源。
go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lgdal
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我的LD_LIBRARY_PATH变量包含/home/fzd/project/lib64文件目录的路径libgdal.so。我的包含具有以下内容的文件PKG_CONFIG_PATH目录的路径:.pc
prefix=/home/fzd/project
exec_prefix=${prefix}
libdir=${prefix}/lib64
deplibdir=${prefix}/lib64
includedir=${prefix}/include
Name: myLibs
Description: Libs
Requires:
Version: v1.0
Libs: -L${deplibdir} -lgdal
Cflags: -I${includedir}
Run Code Online (Sandbox Code Playgroud)
我不知道要检查哪个变量。一切看起来都很好,有趣的是,当我在其他地方克隆我的存储库时,我没有遇到问题(相同LD_LIBRARY_PATH等)
有人知道我可以检查什么吗?
我在CentOS7.6上使用go1.11.1。
答案是:
当我们尝试使用以下命令在 termux 中安装无线工具时,会出现此错误
pkg install wireless-tools
这是因为termux-root-packages存储库未订阅。要订阅根存储库,请使用以下命令。
pkg install root-repo
安装根存储库后,您可以安装无线工具而不会出现错误。
pkg install wireless-tools
希望这些信息有帮助。
我正在尝试使用cygwin作为Windows下的构建环境.我对第三方软件包有一些依赖,例如GTK +.
通常当我在Linux下构建时,在我的Makefile中我可以添加对pkg-config的调用作为gcc的参数,所以它就像这样:
gcc example.c `pkg-config --libs --cflags gtk+-2.0`
这在Linux下工作正常,但在cygwin中,我得到:
:Invalid argument make: *** [example] Error 1
现在,我只是手动运行pkg-config并将输出粘贴到Makefile中,这真的很糟糕.有没有一种解决方法或解决此问题的好方法?
制造不是罪魁祸首.我可以复制并粘贴用于调用gcc的命令行,并且它本身将运行gcc,它将以":Invalid argument"停止.
我写了一个小的测试程序来打印出命令行参数:
for (i = 0; i < argc; i++)
printf("'%s'\n", argv[i]);
Run Code Online (Sandbox Code Playgroud)
注意单引号.
$ pkg-config --libs gtk+-2.0 -Lc:/mingw/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpang owin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule- 2.0 -lglib-2.0 -lintl
贯穿测试程序:
$ ./t `pkg-config --libs gtk+-2.0` 'C:\cygwin\home\smo\pvm\src\t.exe' '-Lc:/mingw/lib' '-lgtk-win32-2.0' '-lgdk-win32-2.0' '-latk-1.0' '-lgdk_pixbuf-2.0' '-lpangowin32-1.0' '-lgdi32' '-lpangocairo-1.0' '-lpango-1.0' '-lcairo' '-lgobject-2.0' '-lgmodule-2.0' '-lglib-2.0' '-lintl' '
注意最后一行的单引号.看起来argc比它应该更大,而argv [argc - 1]为null.在Linux上运行相同的测试没有这个结果.
也就是说,有一些方法可以让Makefile将pkg-config的结果存储到变量中,然后使用该变量,而不是使用反向运算符?
我已经尝试过cpan和cpanp shell而且我一直在:
ExtUtils::PkgConfig requires the pkg-config utility, but it doesn't
seem to be in your PATH. Is it correctly installed?
Run Code Online (Sandbox Code Playgroud)
什么是pkg-config实用程序以及如何安装它?
更新:
我正在尝试安装fuse-python包,当我运行时
python setup.py build
Run Code Online (Sandbox Code Playgroud)
它失败了,当我检查setup.py的内容时,我找到了这一行
if os.system('pkg-config --exists fuse 2> /dev/null') == 0
Run Code Online (Sandbox Code Playgroud)
这条线路失败了.当我检查PKG_CONFIG_PATH时
echo $PKG_CONFIG_PATH
Run Code Online (Sandbox Code Playgroud)
它什么都不打印.任何形式的帮助表示赞赏.提前致谢
操作系统:OS X Mavericks (v10.9)
保险丝:OSXFUSE v2.6.2
$ make
cc -D_FILE_OFFSET_BITS=64 -I/usr/local/include/osxfuse/fuse -Wall -g -F/Library/Frameworks -o loopback loopback.c -losxfuse
ld: library not found for -losxfuse
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [loopback] Error 1
Run Code Online (Sandbox Code Playgroud)
尝试编译boxfs2也会产生这个错误:
$ make
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package …Run Code Online (Sandbox Code Playgroud) 我在 debian 上。我做了 sudo apt-get install mono-complete
我正在尝试编译这个程序
user@debian:~$ cat a2.cs
using Gtk;
using System;
class Hello {
static void Main()
{
Application.Init ();
Window window = new Window ("helloworld");
window.Show();
Application.Run ();
}
}
Run Code Online (Sandbox Code Playgroud)
然后当我尝试编译它时,我收到此错误
user@debian:~$ mcs a2.cs -pkg:gtk-sharp-2.0
Package gtk-sharp-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk-sharp-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk-sharp-2.0' found
error CS8027: Error running pkg-config. Check the above output.
user@debian:~$
Run Code Online (Sandbox Code Playgroud)
类似问题的一个答案是尝试 dmcs
user@debian:~$ …Run Code Online (Sandbox Code Playgroud) 如何将 pkg-config 添加到以下内容setup.py(例如,如果我想添加glib-2.0)
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
wrapper = Extension(
name="wrapper",
sources=["wrapper.pyx"],
libraries=["library"],
library_dirs=["builddir/lib"],
include_dirs=["lib"]
)
setup(
name="wrapper",
ext_modules=cythonize([wrapper])
)
Run Code Online (Sandbox Code Playgroud)
我可以按如下方式执行此操作,但我不想使用路径(/usr/lib/x86_64-linux-gnu/和/usr/include/glib-2.0)并使其可移植
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
wrapper = Extension(
name="wrapper",
sources=["wrapper.pyx"],
libraries=["library"],
library_dirs=["builddir/lib", "/usr/lib/x86_64-linux-gnu/"],
include_dirs=["lib", "/usr/include/glib-2.0"]
)
setup(
name="wrapper",
ext_modules=cythonize([wrapper])
)
Run Code Online (Sandbox Code Playgroud)