Last time I show you how to overcome the error and compile using 4.8gcc.
Now lets look again at the command we did used in previous example.
- #make static EXTRA_FLAGS="-fPIE -pie" LIB_RT= LIB_PTHREAD= CROSS=$TOOLCHAIN/bin/arm-linux-androideabi-
See how it reads "make static" . And read the output name of the binary:
"oscam-1.20_svn11431-arm-linux-androideabi-ssl-static"
But my friends that is all a lie...... when we check it show that infact it depends on
- NEEDED libm.so
- NEEDED libdl.so
- NEEDED libc.so
HEHEHEHE, see this is the problem of this world. We are all feed with constant lies. But all pass without mayor issues just because you only care if you have the latest IPhone.....Even when you had no idea what it is inside of it. Some do not even know how to used it.
In programing is the same. Lies every where. "They" tell you to be safe while in the net, but "they" leave all kind of back doors. Just to manage them-self from far away the latest IPhone you paid to show off. But you did not care to read the License Agreement. Well this problem is in Android too. As kernel.org has been compromised by new members(They) for security issues. Well reasons is real as many are using your phone for banking and even to pay the milk that you wife ask for by phone.
So who are THEY? Well I guess ALL. Originally where the intelligent agency of various countries. But now this day it is not only government but, google, facebook, iphone, samsung and even your mother whats to know what you are doing.
Now lets see how I look at it. This is totally fictitious. Please do not believe all this.
So if you had a program that is static it depends only on itself. But for Them it will be better if your "static" program still depends in the program they control for communications, etc. So Them convince the people that generate toolchains to stop allowing us to create REAL static builds. They will give you all kind of excuses as how you can not build real static programs. SURE....
Now, going back to the problem, lets see where we are at. At most we still need static builds of: libm.so, libdl.so & libc.so. In the other hand, I also wonder why: libpthread.so and librt.so did not show as needed too.
Lets see the last header when compiled,
make static EXTRA_FLAGS="-fPIE -pie" LIB_RT= LIB_PTHREAD= CROSS=$TOOLCHAIN/bin/arm-linux-androideabi-
make --no-print-directory \
EXTRA_FLAGS=-static \
EXTRA_TARGET=-static \
-- CROSS=$HOME/workspace/U5PVR/U5PVR_toolchain/android10d9gcc4.8/bin/arm-linux-androideabi- LIB_PTHREAD= LIB_RT= EXTRA_FLAGS=-fPIE\ -pie
+-------------------------------------------------------------------------------
| OSCam ver: 1.20_svn rev: 11431 target: arm-linux-androideabi-ssl-static
| Tools:
| CROSS = $HOME/workspace/U5PVR/U5PVR_toolchain/android10d9gcc4.8/bin/arm-linux-androideabi-
| CC = $HOME/workspace/U5PVR/U5PVR_toolchain/android10d9gcc4.8/bin/arm-linux-androideabi-gcc
| Settings:
| CONF_DIR = /usr/local/etc
| CC_OPTS = -O2 -ggdb -pipe -ffunction-sections -fdata-sections
| CC_WARN = -W -Wall -Wshadow -Wredundant-decls -Wstrict-prototypes -Wold-style-definition
| CFLAGS = -fexpensive-optimizations -DWITH_SSL=1 -DWITH_LIBCRYPTO=1 -fPIE -pie
| LDFLAGS = -Wl,--gc-sections -DWITH_SSL=1 -DWITH_LIBCRYPTO=1 -fPIE -pie
| LIBS = -lssl -lcrypto -lm -ldl
| UseFlags = USE_SSL=1 USE_LIBCRYPTO=1
| Config:
| Addons : WEBIF WEBIF_LIVELOG WEBIF_JQUERY TOUCH WITH_SSL HAVE_DVBAPI READ_SDT_CHARSETS IRDETO_GUESSING CS_ANTICASC WITH_DEBUG MODULE_MONITOR WITH_LB CS_CACHEEX CW_CYCLE_CHECK CLOCKFIX WITH_EMU
| Protocols: CAMD35 CAMD35_TCP NEWCAMD CCCAM CCCSHARE GBOX RADEGAST SCAM SERIAL CONSTCW PANDORA GHTTP
| Readers : NAGRA IRDETO CONAX CRYPTOWORKS SECA VIACCESS VIDEOGUARD DRE TONGFANG BULCRYPT GRIFFIN DGCRYPT
| CardRdrs : PHOENIX INTERNAL SC8IN1 MP35 SMARGO DB2COM STAPI STAPI5 STINGER DRECAS
| Compiler : arm-linux-androideabi-gcc (GCC) 4.8
| Config : build/arm-linux-androideabi-ssl-static/config.mak
| Binary : Distribution/oscam-1.20_svn11431-arm-linux-androideabi-ssl-static
+-------------------------------------------------------------------------------
Display More
See how oscam tell us that I did in fact try to configure with "EXTRA_FLAGS=-static". But if you look below "-static" never got to propagate into CFLAGS nor LDFLAGS. It was never used.
Lets try to add "-static" manually at make request by adding EXTRA_FLAGS="-static -fPIE -pie" instead of EXTRA_FLAGS="-fPIE -pie".
- #cd $HOME/workspace/U5PVR/oscam-svn
- #export TOOLCHAIN=$HOME/workspace/U5PVR/U5PVR_toolchain/android10d9gcc4.8
- #make distclean
- #make menuconfig
disable ssl as at the moment do not know how to build statically. Then save
- #make static EXTRA_FLAGS="-static -fPIE -pie" LIB_RT= LIB_PTHREAD= CROSS=$TOOLCHAIN/bin/arm-linux-androideabi-
Lets see the new header:
dragon@dragon-PC:~/workspace/U5PVR/oscam-svn$ make static EXTRA_FLAGS="-static -fPIE -pie" LIB_RT= LIB_PTHREAD= CROSS=$TOOLCHAIN/bin/arm-linux-androideabi-
make --no-print-directory \
EXTRA_FLAGS=-static \
EXTRA_TARGET=-static \
-- CROSS=$HOME/workspace/U5PVR/U5PVR_toolchain/android10d9gcc4.8/bin/arm-linux-androideabi- LIB_PTHREAD= LIB_RT= EXTRA_FLAGS=-static\ -fPIE\ -pie
+-------------------------------------------------------------------------------
| OSCam ver: 1.20_svn rev: 11431 target: arm-linux-androideabi-ssl-static
| Tools:
| CROSS = $HOME/workspace/U5PVR/U5PVR_toolchain/android10d9gcc4.8/bin/arm-linux-androideabi-
| CC = $HOME/workspace/U5PVR/U5PVR_toolchain/android10d9gcc4.8/bin/arm-linux-androideabi-gcc
| Settings:
| CONF_DIR = /usr/local/etc
| CC_OPTS = -O2 -ggdb -pipe -ffunction-sections -fdata-sections
| CC_WARN = -W -Wall -Wshadow -Wredundant-decls -Wstrict-prototypes -Wold-style-definition
| CFLAGS = -fexpensive-optimizations -DWITH_SSL=1 -DWITH_LIBCRYPTO=1 -static -fPIE -pie
| LDFLAGS = -Wl,--gc-sections -DWITH_SSL=1 -DWITH_LIBCRYPTO=1 -static -fPIE -pie
| LIBS = -lssl -lcrypto -lm -ldl
| UseFlags = USE_SSL=1 USE_LIBCRYPTO=1
| Config:
| Addons : WEBIF WEBIF_LIVELOG WEBIF_JQUERY TOUCH WITH_SSL HAVE_DVBAPI READ_SDT_CHARSETS IRDETO_GUESSING CS_ANTICASC WITH_DEBUG MODULE_MONITOR WITH_LB CS_CACHEEX CW_CYCLE_CHECK CLOCKFIX WITH_EMU
| Protocols: CAMD35 CAMD35_TCP NEWCAMD CCCAM CCCSHARE GBOX RADEGAST SCAM SERIAL CONSTCW PANDORA GHTTP
| Readers : NAGRA IRDETO CONAX CRYPTOWORKS SECA VIACCESS VIDEOGUARD DRE TONGFANG BULCRYPT GRIFFIN DGCRYPT
| CardRdrs : PHOENIX INTERNAL SC8IN1 MP35 SMARGO DB2COM STAPI STAPI5 STINGER DRECAS
| Compiler : arm-linux-androideabi-gcc (GCC) 4.8
| Config : build/arm-linux-androideabi-ssl-static/config.mak
| Binary : Distribution/oscam-1.20_svn11431-arm-linux-androideabi-ssl-static
+-------------------------------------------------------------------------------
Display More
see now "-static" did propaget to CFLAGS and LDFLAGS. But here we go what I was talking.
We generate errors.
error: undefined reference to 'dlopen'
error: undefined reference to 'dlsym'
error: undefined reference to 'dlclose'
error: undefined reference to 'dlerror'
Now we need a STATICALLY BUILD "libdl.so" or better known as "libdl.a". If you look in your android toolchains, there is no "libdl.a".
Hahaaaaa. But we can get one from HiOSCAM. Well as we stilling and breaking our toolchain by contaminating it with none official code from google lets add to the other too libpthread.a librt.a. My best guess is that this are all debian arm builds!! Who knows.
Now lest try one more time to compile do not forget to keep ssl disabled, as at the moment do not know how to build statically.
- #cd $HOME/workspace/U5PVR/oscam-svn
- #make distclean
-
#make static EXTRA_FLAGS="-static -fPIE -pie" LIB_RT= LIB_PTHREAD= CROSS=$TOOLCHAIN/bin/arm-linux-androideabi-
- #objdump -x Distribution/oscam-1.20_svn11431-arm-linux-androideabi-static | grep NEEDED
see this time our binary do not depends on any else.
Now what next.
- A truly statically binary is not essential. But if we do not have it statically we need to build it with same version of API/GCC that out Android have.
- At the moment I do not know how to build a truly statically SSL
- You guys need a patch for oscam, so that your U5PVR hardware gets recognized and used. Like the Card Reader.