简体   繁体   English

在Debian上,运行单错误CS8027:运行pkg-config时出错

[英]On Debian, running mono- error CS8027: Error running pkg-config

I am on debian. 我在debian上。 I did sudo apt-get install mono-complete 我做了sudo apt-get install mono-complete

I am trying to compile this program 我正在尝试编译这个程序

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 ();

        }
}

Then when I try to compile it I get this error 然后,当我尝试编译它时,我得到了这个错误

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:~$ 

one answer to a similar problem said try dmcs 一个类似问题的答案就说试试dmcs

user@debian:~$ dmcs 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:~$ 

but dmcs gives the same error 但dmcs给出了同样的错误

I saw a suggestion to do yum install gtk-sharp2 but whatever incantation I use it says no package available so i'm not sure what that package is 我看到有人建议你做yum install gtk-sharp2,但无论我使用什么咒语说没有包可用所以我不确定那个包是什么

user@debian:~$ sudo yum install gtk-sharp-2.0
Setting up Install Process
No package gtk-sharp-2.0 available.
Nothing to do
user@debian:~$ 

user@debian:~$ sudo yum install gtk-sharp2-devel
Setting up Install Process
No package gtk-sharp2-devel available.
Nothing to do
user@debian:~$ 

I looked up my error https://stackoverflow.com/search?q=cs8027 and they all say this variable PKG_CONFIG_PATH has to point to the correct path. 我查了一下我的错误https://stackoverflow.com/search?q=cs8027 ,他们都说这个变量PKG_CONFIG_PATH必须指向正确的路径。

At the moment though the variable doesn't exist and I don't know what path to point it to. 目前虽然变量不存在,但我不知道指向它的路径。 Apparently it's a path with some .pc files for gtk. 显然,这是一个包含gtk的.pc文件的路径。 I have no idea where that is. 我不知道那是哪里。

user@debian:/usr$ echo $PKG_CONFIG_PATH

user@debian:/usr$

You say you are using debian, yet you run yum ? 你说你正在使用debian,但你运行yum Doesn't seem like a good idea. 似乎不是一个好主意。

Try running: 试试跑步:

sudo apt-get update
sudo apt-get install gtk-sharp2

Then, don't forget to do: 然后,别忘了做:

make clean

And start the compilation process from the very beginning. 并从一开始就开始编译过程。

added by barlop 由barlop添加

I got errors the first time I tried it like problem: 0:System.Drawing.SizeF.Conversion, with xpath: /Type/Members/Member[@MemberName='op_Conversion']/Docs and I interrupted the installation but it continued trying to install then said it interrupted. 我第一次尝试它时遇到了错误problem: 0:System.Drawing.SizeF.Conversion, with xpath: /Type/Members/Member[@MemberName='op_Conversion']/Docs和我中断了安装但是继续尝试安装然后说它打断了。

but doing that command again, apt-get didn't seem to install it again but immediately said it's the newest version, and my program compiled. 但再次执行该命令,apt-get似乎没有重新安装它,但立即说它是最新版本,我的程序编译。 So it must have installed or installed sufficiently despite the problems while installing. 因此,尽管安装时出现问题,但必须已经安装或安装。

it makes this file /usr/lib/pkgconfig/gtk-sharp-2.0.pc among others, 它使这个文件/usr/lib/pkgconfig/gtk-sharp-2.0.pc等等,

and

$ dmcs a2.cs -pkg:gtk-sharp-2.0 <-- then works $ dmcs a2.cs -pkg:gtk-sharp-2.0 < - 然后工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM