我的本地gcc版本是
寫道 [email protected]:~/softken$ gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/lto-wrapper
目标:i686-pc-linux-gnu
配置為:../configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --enable-shared --libexecdir=/usr/lib --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,fortran,lto,objc,obj-c++ --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --enable-checking=release --disable-bootstrap
線程模型:posix
gcc 版本 4.6.3 (GCC for StartOS)
百度雲有個linux用戶端版本,目前貌似是很簡單的雛形代碼,不過已經能夠正常使用了,
https://github.com/loujiayu/Baiduyun
安裝步驟如下
寫道 Dependencies
You may need following libraries:
Boost(Boost filesystem)
json-c(https://github.com/json-c/json-c)
openssl
cmake
libcurl
Installation
$ cd Baiduyun
$ mkdir build
$ cd build
$ cmake ..
$ make
我在本地安裝過程中,先安裝了 Boost庫,以及 json-c庫,在使用 cmake的時候告訴我找不到 jsonc的so檔案,諸如此類錯誤:
寫道 缺少動态連接配接庫.so--cannot open shared object file: No such file or directory
寫道 總結下來主要有3種方法:
1. 用ln将需要的so檔案連結到/usr/lib或者/lib這兩個預設的目錄下邊
ln -s /where/you/install/lib/*.so /usr/lib
sudo ldconfig
2.修改LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/where/you/install/lib:$LD_LIBRARY_PATH
sudo ldconfig
3.修改/etc/ld.so.conf,然後重新整理
vim /etc/ld.so.conf
add /where/you/install/lib
sudo ldconfig
此處我檢查了 确實在 /usr/local/lib下存在這個檔案,是以 執行了 sudo ldconfig 後再進行cmake 就可以正常生成makefile檔案了
接着運作 make 的時候爆出以下錯誤 -std=gnu++11 不能識别,這個選項應該是在gcc 4.8之後才加入的,故全目錄搜尋了下,對這個做了下替換,換成 -std=c++0x
另外還有一個問題是 src/filesystem.cc 中頭聲明中少了 #include <fstream> 頭的聲明
關于這些bug,詳見我提的issue: https://github.com/loujiayu/Baiduyun/issues/1
make 之後在生成了如下檔案 baiduyun
這個就是生成的 程式檔案,你可以運作它,第一次運作時請使用 -a 參數來擷取一個授權碼,他會列印一個url,并在目前目錄下建立一個名為MyBaidu的目錄,你使用浏覽器打開這個url并把得到的授權碼輸入到終端輸入框中,回車得到授權,成功之後會在MyBaidu的目錄下建立一個.baiduyun 的隐藏檔案,此處放置 授權的令牌資訊
使用 -h 參數檢視支援的選項,目前支援
寫道 [email protected]:~/softken/yunbaidu$ ./baiduyun -h
Usage: baiduyun [option]
options:
-a authenicate: authenticate your account with access token
-d download: download files from /apps/ldrive
-u upload: upload files from ./Baidu_Yun
-s synchronise: detect files need to be downloaded or uploaded and do it
-h help: help message
當你使用 -d 參數時,确實會建立一個名為 Baidu_Yun 的目錄,其對應着 你百度雲中的我的應用資料->ldrive
之後 要上傳下載下傳的檔案都會放在這裡,比如 你把本地一個檔案傳到百度雲,隻需要
寫道 [email protected]:~/softken/yunbaidu$ ls Baidu_Yun/
kenvim.tar.gz vim-note.txt
[email protected]:~/softken/yunbaidu$ ./baiduyun -u kenvim.tar.gz
運作成功之後,稍作等待,然後你在你的百度雲中就能看到
可以建一個軟鍊,把這個檔案夾映射到某個地方,呵呵
附件是我從 github 上撿下來的代碼