顯示具有 lubuntu 標籤的文章。 顯示所有文章
顯示具有 lubuntu 標籤的文章。 顯示所有文章

2015年9月30日 星期三

使用 RVM 安裝 rails 出現找不到函式庫的錯誤

作業系統:Lubuntu 14.04

錯誤內容如下:
mattias@mattias-Desktop:~$ gem install rails
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: minitest-5.8.1.gem (100%)
Successfully installed minitest-5.8.1
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.4.gem (100%)
Successfully installed activesupport-4.2.4
Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%)
Successfully installed rails-deprecated_sanitizer-1.0.3
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
 ERROR: Failed to build gem native extension.

    /home/mattias/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150930-14059-do0e7v.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
 --with-opt-dir
 --without-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/home/mattias/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
 --help
 --clean
/home/mattias/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
 from /home/mattias/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
 from /home/mattias/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
 from /home/mattias/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
 from extconf.rb:80:in `nokogiri_try_compile'
 from extconf.rb:87:in `block in add_cflags'
 from /home/mattias/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
 from extconf.rb:86:in `add_cflags'
 from extconf.rb:337:in `
' extconf failed, exit code 1 Gem files will remain installed in /home/mattias/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.2 for inspection. Results logged to /home/mattias/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out

其中有一句寫到 "Check the mkmf.log file for more details.",那就來找出這支檔案看一下到底哪裡出問題了吧!

2015年9月27日 星期日

Nvidia 驅動程式導致 Lubuntu 14.04 下的畫面 DPI 提高

Lenovo W510 安裝 Lubuntu 14.04.3 後,首先就是進入 [偏好設定] -> [額外驅動程式] 尋找並套用適當的 Nvidia 顯示卡的驅動程式,之後重開機卻發生整個畫面上的內容看起來都放大了的情況。
截圖的話,懶得用自己的電腦截圖了,直接借用他人的圖,如下所示

BEFOR

AFTER

之後閱讀到這篇的解決方式覺得還不錯,就記錄下來。

2015年8月4日 星期二

Lubuntu 14.04 下安裝 Android Studio 時發生 "JDK Required: 'tools.jar' seems to be not in Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE." 錯誤

這篇雖然是在 Lubuntu 下發生的錯誤,但是問題其實和作業系本身無關,是 JDK 的指向路徑問題,所以解法應該也適用於其他 Linux 發行版。

下載 Android Studio 的壓縮檔後在終端機內執行 studio.sh 命令,發生下列錯誤:

JDK Required: 'tools.jar' seems to be not in Studio classpath.
Please ensure JAVA_HOME points to JDK rather than JRE.

這是因為啟動程式找不到 JDK 緣故。如果還未安裝 JDK 請安裝,如果已安裝的就請在環境變數 JAVA_HOME 中指定 JDK 路徑。

我當初是下載 Oracle 的 Java JDK 壓縮檔並在 PATH 環境變數中指定 JDK 的路徑,不是透過 APT 來安裝,所以作法是編輯 studio.sh,在頂端加入下列內容:

JAVA_HOME=~/Develop/sdks/jdk

其中 ~/Develop/sdks/jdk 即為我的 JDK 的安裝路徑。

存檔後再於終端機內重新執行 studio.sh 即可順利啟動 Android Studio。

2015年6月23日 星期二

【備忘】用 iconv 來轉換文字編碼

在 Linux 下閱讀簡體字的文件時,可以先透過 iconv 來轉換文字編碼,避免用文字編輯器打開檔案時呈現亂碼

iconv 的說明:
NAME
       iconv - Convert encoding of given files from one encoding to another

SYNOPSIS
       iconv -f encoding [-t encoding] [inputfile]...

DESCRIPTION
       The iconv program converts the encoding of characters in inputfile, or from the standard input if no filename is specified, from one coded character set to another. The result is
       written to standard output unless otherwise specified by the --output option.

       --from-code, -f encoding
              Convert characters from encoding.

       --to-code, -t encoding
              Convert characters to encoding. If not specified the encoding corresponding to the current locale is used.

       --list, -l
              List known coded character sets.

       -c     Omit invalid characters from output.

       --output, -o file
              Specify output file (instead of stdout).

       --silent, -s
              Suppress warnings, but not errors.

       --verbose
              Print progress information.

       --help, -?
              Give help list.

       --usage
              Give a short usage message.

       --version, -V
              Print program version.
假設來源檔案為 source.txt,轉換成 utf-8 後的檔名叫 target.txt,那麼就在命令列輸入下列內容:
iconv -f gb2312 -t utf-8 source.txt --output target.txt
搞定收工!

2015年6月4日 星期四

Lubuntu 14.04 64-bit 下安裝 Teamviewer 10 時出現 "lib32asound2" 相依性錯誤


剛剛想要安裝 Teamviewer 時出現了上圖的錯誤。

哎呀!這是怎麼了?我用的是 Lubuntu 64 位元,當然是下載 64 位元的套件吧!怎麼還是跟我說缺少 32 位元的相依套件?

2015年2月27日 星期五

Lubuntu 14.04 下 設定 Lenovo W510 亮度控制

首先編輯 xorg.conf(必須有 su 權限):

sudo vi /etc/X11/xorg.conf

然後找到 "Device" 區段,將

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"


改成

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro FX 880M"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection


之後重開機即可。