2017年12月14日 星期四

tensorflow build_pip_package error

在build_pip_package時遇到問題:

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
四 12月 14 18:11:04 CST 2017 : === Using tmpdir: /tmp/tmp.cyP6dwC7mh
~/tensorflow/bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles ~/tensorflow
~/tensorflow
/tmp/tmp.cyP6dwC7mh ~/tensorflow
四 12月 14 18:11:06 CST 2017 : === Building wheel
error in tensorflow setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers

Solution:
sudo pip install -U setuptools

2017年11月2日 星期四

pthread operation not permitted error

出現這種錯誤, 看起來是因為Ubuntu基於安全性的考量, 在使用ptrace時有所限制.
而限制的設定檔在/etc/sysctl.d/10-ptrace.conf
預設內容為: kernel.yama.ptrace_scope = 1

A PTRACE scope of "0" is the more permissive mode.
A scope of "1" limits # PTRACE only to direct child processes.

只要把kernel.yama.ptrace_scope 改為0, 然後重新開機即可.

PS:如果你的帳號可以sudo的話, 那也可以用sudo 或root去執行你的程式, 這種情況下是不會被限制的.

2017年9月25日 星期一

GCC編譯錯誤: relocation truncated to fit: R_X86_64_32S against symbol `xxxxx` defined in `.bss' section in xxxxx



在GCC的編譯參數加入"-mcmodel=xxxx", 即可解決這個編譯錯誤的問題

-mcmodel=tiny
Generate code for the tiny code model. The program and its statically defined symbols must be within 1GB of each other. Pointers are 64 bits. Programs can be statically or dynamically linked. This model is not fully implemented and mostly treated as ‘small’.
-mcmodel=small
Generate code for the small code model. The program and its statically defined symbols must be within 4GB of each other. Pointers are 64 bits. Programs can be statically or dynamically linked. This is the default code model.
-mcmodel=large
Generate code for the large code model. This makes no assumptions about addresses and sizes of sections. Pointers are 64 bits. Programs can be statically linked only.

2017年3月15日 星期三

Beej's Guide to Network Programming

發現一本寫的還不錯的Linux socket 網路程式設計書, 對初學者而言是一份很好的開始

Beej's Guide to Network Programming
譯者:Aaron Liao(廖明沂),May, 2014

GitBook:Beej's Guide to Network Programming GitBook

繁體中文網頁版: http://beej-zhtw.netdpi.net/
英文官網: http://beej.us/guide/bgnet/

一個小故事讓我們明白資金流通的意義

“又是炎熱小鎮慵懶的一天。太陽高掛,街道無人,每個人都債台高築,靠信用度日。這時,從外地來了一位有錢的旅客,他進了一家旅館,拿出一張1000 元鈔票放在櫃檯,說想先看看房間,挑一間合適的過夜,就在此人上樓的時候---- 店主抓了這張1000 元鈔,跑到隔壁屠戶那裡支付了他欠的肉錢...