2018年1月23日 星期二

 如果沒有build server root 權限且缺少執行檔, 可以直接用下面方法產生執行檔

export PKG_CONFIG_PATH=<your local installation path>/lib/pkgconfig
autoreconf -f -i
./configure –prefix=<your local installation path>
make
make install
     export PATH=[execution file path]:$PATH

2017年12月22日 星期五

GCC: the --start-group and --end-group command line options

https://stackoverflow.com/questions/5651869/gcc-what-are-the-start-group-and-end-group-command-line-options

https://linux.die.net/man/1/ld

-( archives -) or --start-group archives --end-group
The archives should be a list of archive files. They may be either explicit file names, or -l options.
The specified archives are searched repeatedly until no new undefined references are created. Normally, an archive is searched only once in the order that it is specified on the command line. If a symbol in that archive is needed to resolve an undefined symbol referred to by an object in an archive that appears later on the command line, the linker would not be able to resolve that reference. By grouping the archives, they all be searched repeatedly until all possible references are resolved.
Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives.

2017年12月11日 星期一

[轉] [C/C++] 靜態函式 (static function) 2011

static function is a function whose scope is limited to the current source file.  Scope refers to the visibility of a function or variable. If the function or variable is visible outside of the current source file, it is said to have global, or externalscope. If the function or variable is not visible outside of the current source file, it is said to have local, or static scope.
意思是說靜態函式只能被該檔案所看見,其它檔案無法得知該檔案是否有其靜態函式。
有一些 C 的語法,在 C++ 的程序員相對少用。但就是因為這個原因,有時就會忽略了。
假設我們有一個Header檔 Foo.h
static void f1(){
cout << “f1()" << endl;
}
void f2(){
cout << “f2()" << endl;
}
f1 和 f2 的差別在於 static 這個 keyword 。在這裡的 f1 被宣告和定義為 static ,是指它只在這個 Compilation Unit 中生效。而 f2 沒有被定義為 static ,亦即是它可以被其他 Compilation Unit 訪問。
但到底什麼是 Compilation Unit 呢?首先,一個程式編譯過程如下:
compliation_process這裡的 a.cpp , b.cpp 和 c.cpp 也 引入了 Foo.h 這個檔案,經過前處理器後,Foo.h 的內容會被加入到 a.cpp, b.cpp 和 c.cpp 中,再經過編譯器,變成為 a.o , b.o 和 c.o 這些目的碼,最後經過連結器,變成執行檔
要留意的地方是,每個經過前處理器處理後的.cpp 檔,和它的目的檔是一一對應的,而Compilation Unit,就是這些被處理後的.cpp 檔了。
若以Foo.h 的 f1 為例子,雖然在每個 .cpp 檔也被定義了,但經過編譯後,所有的f1 也會被隱藏在自己的目的檔中,連結器在找尋symbol的過程中,是會忽略的。
但f2 就不同了,所有的f2 在目的檔中,也是不會被隱藏,所以在連結器找尋symbol,會找到多份的f2,那連結就會有錯誤了。
所以在大部份的情況下,在Header檔中定義函數,也是需要 static 這個 keyword 的。就算加上了 inline,情況也是一樣的。
static inline void f3(){
cout << “f3()" << endl;
}

2017年12月6日 星期三

link unused library as needed

https://lists.ubuntu.com/archives/ubuntu-devel/2010-November/031991.html

There is a second change to the linking in natty; as announced in [1], 
--no-add-needed/--no-copy-dt-needed-entries is passed by default, with the 
current gcc in natty, --as-needed is passed as well.  Please see [2] for 
implications (runtime failures) and a list of packages which might be affected.

To revert this change on a per package basis, pass --no-as-needed to the linker 
(-Wl,--no-as-needed in LDFLAGS).  To add an explicit dependency on a library use 
--no-as-needed -lfoo --as-needed.
-Wl,--no-as-needed -lfoo -Wl,--as-needed
Please tag bug reports with `as-needed' if you see runtime failures caused by 
this change (mostly unresolvable symbols referenced by plugins and ldopened 
objects).

2017年12月5日 星期二

h.265 (hevc)

alignment=au means that each output buffer contains the NALs for a whole 
picture. alignment=nal just means that each output buffer contains 
complete NALs, but those do not need to represent a whole frame

https://www.kancloud.cn/digest/hevc-fred/181914

https://mp.weixin.qq.com/s/r5_gO-I0WM-1sv3_vyVBeg