虚拟机找不到网卡Ubuntu下Sublime Text build始终找不到 exec,请问为啥

& sublime text 3配置c/c++编译环境
支付宝打赏
如果文章对你有帮助,欢迎点赞或打赏(金额不限)。你的打赏将全部用于支付网站服务器费用和提高网站文章质量,谢谢支持。
, , , , , ,
相关的文章
可以问下为什么语法有错误的时候sublime不提示呢?
没有问题的时候是能正常编译运行的。。Ubuntu下Sublime Text 3 和搜狗拼音输入法安装全套解决方案
我的图书馆
Ubuntu下Sublime Text 3 和搜狗拼音输入法安装全套解决方案
&首先声明采用方法并非原创,参考了网上的帖子,经过自己的实践做了一些优化,参考帖子如下:
/A-Song/archive//2993194.html
/blog/1536184
http://my.oschina.net/wugaoxing/blog/121281
http://my.oschina.net/Khiyuan/blog/98713
http://forum./viewtopic.php?f=16&t=333
/forum/viewtopic.php?f=3&t=7006&start=10#p41343
1. 安装sougou for linux:
(1)卸载原有的输入法,fcitx或ibus。如卸载fcitx
sudo apt-get remove fcitx*(如不需保留配置文件用purge)
sudo apt-get autoremove(自动卸载依赖软件)
sudo dpkg –get-selections | grep fcitx(查询fcitx相关的软件包是否卸载)
(2)通过软件源安装(最好用的)
sudo add-apt-repository ppa:fcitx-team/nightly
sudo apt-get update
sudo apt-get install fcitx-sogoupinyin
然后下载皮肤安装:fcitx-sougou-skin 。在fcitx配置 -& 外观中选择sougou就行了。
fcitx-sougou-skin下载地址:
/share/link?shareid=&uk=
(3)安装完毕,重新登录系统,即可使用搜狗输入法了。
2. 安装配置Sublime Text 3
(1) 添加Sublime Text 3的安装源并执行更新(可忽略非该源产生的更新错误)。
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
(2) 安装Sublime Text 3
sudo apt-get install sublime-text (3) 需要其他配置了,如设置为默认编辑器等等,请参考:
/blog/1536184
(4) 下面进入Sublime Text 3 下输入中文的配置。
保存以下代码到文件sublime_imfix.c
#include &gtk/gtkimcontext.h&
void gtk_im_context_set_client_window (GtkIMContext *context,
GtkIMContextClass *
g_return_if_fail (GTK_IS_IM_CONTEXT (context));
klass = GTK_IM_CONTEXT_GET_CLASS (context);
if (klass-&set_client_window)
klass-&set_client_window (context, window);
g_object_set_data(G_OBJECT(context),"window",window);
if(!GDK_IS_WINDOW (window))
int width = gdk_window_get_width(window);
int height = gdk_window_get_height(window);
if(width != 0 && height !=0)
gtk_im_context_focus_in(context);
(5) 安装C/C++的编译环境和gtk libgtk2.0-dev
sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
(6) 编译成共享库
gcc -shared -o libsublime-imfix.so sublime_imfix.c
`pkg-config --libs --cflags gtk+-2.0` -fPIC
(7) 测试运行
LD_PRELOAD=./libsublime-imfix.so sublime_text
注意:sublime_text 为sublime-text安装后的可执行命令,不同版本的名称可能不一样
如果测试可以运行,则进行第四步配置;如果不行,再试试
http://my.oschina.net/wugaoxing/blog/121281&这个帖子里的sublime_imfix.c文件
(8) 拷贝文件到/opt/sublime_text目录下
sudo cp libsublime-imfix.so /opt/sublime_text/libsublime-imfix.so
注意:/opt/sublime_text/不同版本可能有所不同,请调整为自己安装版本的路径
(9) 打开终端修改/usr/bin/subl
sudo vim /usr/bin/subl
修改/usr/bin/subl文件,在第一行加入:
export LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so
注意:/opt/sublime_text/不同版本可能有所不同,请调整为自己安装版本的路径
(10) 修改sublime-text-2.desktop
注意:sublime_text.desktop不同版本有所不同,请调整为自己安装版本的路径&
sudo vim /usr/share/applications/sublime_text.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/usr/bin/subl %F&&&&&&&&#这里修改执行路径为/usr/bin/subl,subl文件刚才已经修改过,大家应该记得
Terminal=false
MimeType=text/&&&&&&&&
Icon=sublime-text
Categories=TextED
StartupNotify=true
Actions=WD
[Desktop Action Window]
Name=New Window
Exec=/usr/bin/subl -n&&&&&&&#这里修改执行路径为/usr/bin/subl,subl文件刚才已经修改过,大家应该记得
OnlyShowIn=U
[Desktop Action Document]
Name=New File
Exec=/usr/bin/subl new_file&&&&#这里修改执行路径为/usr/bin/subl,subl文件刚才已经修改过,大家应该记得
OnlyShowIn=U
修改以上三处代码,保存。以上步骤主要完成了Sublime Text 3在三种情况下打开中文完全正常运行,搜狗输入法比小企鹅输入法好用的多。
(11) 测试和方法的不足
Sublime Text 3 有5种打开方式,以下是我给的方法的支持程度:
1. 点击桌面图标或者锁定到任务栏的图标来打开Sublime Text 3&&&&& & 支持中文搜狗拼音
2. 在Sublime Text 3 中新建文件(快捷键Ctrl + N)中&&&&&&&&&&&&&&&&&支持中文搜狗拼音
3. 选中文本文件用右键打开文件&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&支持中文搜狗拼音
4. 命令行执行subl&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&支持中文搜狗拼音
5. 命令行执行sublime_text&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&不支持中文
相信以上五种方式的测试已经让你深深的爱上了我给的方法。在使用过程中其实还是有一些bug的,但一般都不是致命的bug如:
1. 执行sublime_text不能输入中文,这个相信大家用的并不多,真正用到命令行打开文件时可以用subl代替
2. sublime text 3 输入中文时输入框不跟随文字,这个暂时无解啊,不影响核心使用。
相信也会有其他的bug,已经使用上的如果有好的解决方案可以发出来大家共同探讨。
以上方法同样适用于sublime text 2 版本,不同的是在用路径的时候要修改为自己的路径。
TA的最新馆藏
喜欢该文的人也喜欢订阅你的位置: >
> 【已解决】VMware Workstation的Ubuntu虚拟机中安装VMWare Tools出现提示:Enter the path to the kernel header files for the 3.8.0-27-generic kernel?
【问题】折腾:期间,重新安装VMWare Tools,结果又遇到之前就遇到的那个提示:crifan@ubuntu:vmware-tools-distrib$ sudo ./vmware-install.pl
The installer found the following conflicting packages installed on the system and will now remove them:
open-vm-tools
dpkg: warning: ignoring request to remove open-vm-tools, only the config
files of whi use --purge to remove them too
A previous installation of VMware Tools has been detected.
The previous installation was made by the tar installer (version 4).
Keeping the tar4 installer database format.
You have a version of VMware Tools installed.
Continuing this install will
first uninstall the currently installed version.
Do you wish to continue?
(yes/no) [yes]
Uninstalling the tar installation of VMware Tools.
Stopping services for VMware Tools
vmware-tools stop/waiting
File /usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gdk-pixbuf.loaders is
backed up to
/usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gdk-pixbuf.loaders.old.4.
File /usr/lib/vmware-tools/lib32/libconf/etc/pango/pangorc is backed up to
/usr/lib/vmware-tools/lib32/libconf/etc/pango/pangorc.old.4.
This program previously created the file
/usr/lib/vmware-tools/libconf/etc/pango/pangorc, and was about to remove it.
Somebody else apparently did it already.
File /etc/vmware-tools/vmware-user.desktop is backed up to
/etc/vmware-tools/vmware-user.desktop.old.4.
File /usr/lib/vmware-tools/lib32/libconf/etc/fonts/fonts.conf is backed up to
/usr/lib/vmware-tools/lib32/libconf/etc/fonts/fonts.conf.old.4.
This program previously created the file
/usr/lib/vmware-tools/lib32/libconf/etc/pango/pango.modules, and was about to
remove it.
Somebody else apparently did it already.
This program previously created the file
/usr/lib/vmware-tools/libconf/etc/gtk-2.0/gdk-pixbuf.loaders, and was about to
remove it.
Somebody else apparently did it already.
File /usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gtk.immodules is backed up
to /usr/lib/vmware-tools/lib32/libconf/etc/gtk-2.0/gtk.immodules.old.4.
This program previously created the file
/usr/lib/vmware-tools/libconf/etc/gtk-2.0/gtk.immodules, and was about to
remove it.
Somebody else apparently did it already.
This program previously created the file
/usr/lib/vmware-tools/lib32/libconf/etc/pango/pangox.aliases, and was about to
remove it.
Somebody else apparently did it already.
update-initramfs: Generating /boot/initrd.img-3.8.0-27-generic
update-initramfs: Generating /boot/initrd.img-3.8.0-19-generic
The removal of VMware Tools 8.8.6 build-1035889 for Linux completed
successfully.
Installing VMware Tools.
In which directory do you want to install the binary files?
[/usr/bin]
What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
What is the directory that contains the init scripts?
[/etc/init.d]
In which directory do you want to install the daemon files?
[/usr/sbin]
In which directory do you want to install the library files?
[/usr/lib/vmware-tools]
In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
The path &/usr/share/doc/vmware-tools& does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]
The installation of VMware Tools 8.8.6 build-1035889 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: &/usr/bin/vmware-uninstall-tools.pl&.
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: &/usr/bin/vmware-config-tools.pl&. Do you want
this program to invoke the command for you now? [yes]
Initializing...
Making sure services for VMware Tools are stopped.
[EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that
creates backups of virtual machines. Please refer to the VMware Knowledge Base
for more details on this capability. Do you wish to enable this feature?
Before you can compile modules, you need to have the following installed...
kernel headers of the running kernel
Searching for GCC...
Detected GCC binary at &/usr/bin/gcc&.
The path &/usr/bin/gcc& appears to be a valid path to the gcc binary.
Would you like to change it? [no]
Searching for a valid kernel header path...
The path && is not a valid path to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes]
Enter the path to the kernel header files for the 3.8.0-27-generic kernel?即:Enter the path to the kernel header files for the 3.8.0-27-generic kernel?【解决过程】1.参考:去安装对应版本的linux source,结果是本身就已经安装好了:crifan@ubuntu:~$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-3.8.0-27-generic is already the newest version.
The following packages were automatically installed and are no longer required:
dkms fakeroot g++-4.7 libdumbnet1 libstdc++6-4.7-dev zerofree
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
crifan@ubuntu:~$2.再参考另外那人回复,所以去:sudo apt-get update&&sudo apt-get dist-upgrade3.但是参考:所以可以先去看看自己此处是否对应目录已有头文件,结果是有的:crifan@ubuntu:~$ ls /usr/src/linux-
linux-headers-3.8.0-19/
linux-headers-3.8.0-27/
linux-source-3.2.0/
linux-headers-3.8.0-19-generic/ linux-headers-3.8.0-27-generic/ linux-source-3.2.0.tar.bz2
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-
linux-headers-3.8.0-19/
linux-headers-3.8.0-27/
linux-headers-3.8.0-19-generic/ linux-headers-3.8.0-27-generic/
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27-generic/
Documentation
Module.symvers
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27-generic/include
clocksource
asm-generic
crifan@ubuntu:~$所以,手动输入对应的路径,但是还是提示是非法的路径:Searching for a valid kernel header path...
The path && is not a valid path to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes]
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-27-generic/include
The path &/usr/src/linux-headers-3.8.0-27-generic/include& is not a valid path
to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes]又试了试,其他几个header,结果也还是不行:crifan@ubuntu:~$ uname -r
3.8.0-27-generic
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-19/include
clocksource
asm-generic
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-19-generic/include
clocksource
asm-generic
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27-generic/include
clocksource
asm-generic
crifan@ubuntu:~$ ls /usr/src/linux-headers-3.8.0-27/include
clocksource
asm-generic
crifan@ubuntu:~$和:Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-19/include
The path &/usr/src/linux-headers-3.8.0-19/include& is not a valid path to the
3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-19-generic/include
The path &/usr/src/linux-headers-3.8.0-19-generic/include& is not a valid path
to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-27-generic/include
The path &/usr/src/linux-headers-3.8.0-27-generic/include& is not a valid path
to the 3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
Enter the path to the kernel header files for the 3.8.0-27-generic kernel? /usr/src/linux-headers-3.8.0-27/include
The path &/usr/src/linux-headers-3.8.0-27/include& is not a valid path to the
3.8.0-27-generic kernel headers.
Would you like to change it? [yes] yes
Enter the path to the kernel header files for the 3.8.0-27-generic kernel?4.再去参考:去试试:sudo apt-get update   sudo apt-get install kernel-headers kernel-devel gcc make结果根本找不到:crifan@ubuntu:~$ sudo apt-get install kernel-headers kernel-devel gcc make
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package kernel-headers
E: Unable to locate package kernel-devel
crifan@ubuntu:~$5.参考去重启Ubuntu。然后再去安装build-essential:sudo apt-get install build-essential再去安装linux header:sudo apt-get install linux-headers-$(uname -r)然后再去安装试试:突然看到提示说之前安装了open-vm-tools,会有冲突,所以,手动去卸载:sudo apt-get autoremove open-vm-tools再重新安装,结果竟然还是检测到已经安装了open-vm-tools,然后还由于无法继续调用/usr/bin/vmware-uninstall-tools.pl而终于运行了。最后的最后,还是通过,重新安装open-vm-tools,而得以正常的使用文件夹共享,但是剪贴板共享,还是不行。6.再参考:去修改vmware-install.pl,但是,此刻,就只是之前的错误:无法继续安装vmware-install.pl了。因为:始终出错,显示:cannot execute /usr/bin/vmware-uninstall-tools.pl而去/usr/bin下面看了看,的确没有vmware-uninstall-tools.pl导致:无论如何,都无法继续安装或卸载当前的vmware tools了。。。7.后来是发现,本身vmware-tools下面有个bin目录,其下就有个vmware-uninstall-tools.pl,所以sudo cp一下到/usr/bin中后,再去执行,就可以找到此文件了。【总结】最后,还是通过:先卸载之前的open-vm-tools再安装vmware-tools.pl再安装open-vm-tools而解决了所有问题,使得可以:剪贴板共享可用,文件共享可用。没有找到其他更好的办法。【后记 】1.后来,在折腾:期间,最终,找到了此问题的:原因:Ubuntu 13.04是最新的3.0的Linux内核,其内核版本的头文件的位置发生了变化,导致之前,相对旧的VMWare Tools,找不到对应的头文件,因此而报错。解决办法:用当前,实际上已经存在的头文件,做个软链接:sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h就可以了。结论:VMWare,尤其是VMWare Tools,还是做得很不好:相比之下,Virtualbox,就没有这类很挫的问题:(中的:)转载请注明: & 与本文相关的文章
19 queries in 1.280 seconds, using 10.53MB memoryubuntu下新建sublime_text桌面图标 |
| 灰色代码灰色代码

我要回帖

更多关于 虚拟机找不到网卡 的文章

 

随机推荐