On Tue, Jan 22, 2013 at 4:43 PM, harryxiyou <harryxi...@gmail.com> wrote: > Hi all, > > We add new entries for qemu/configure(QEMU v1.3.0), which > can locate our libraries and header files to compile our driver > for QEMU. The new entries in qemu/configure are like following. > > [...] > 2828 ########################################## > 2829 # hlfs probe > 2830 echo "Entering HLFS probe..."; > 2831 sleep 2; > 2832 if test "$hlfs" != "no" ; then > 2833 cat > $TMPC <<EOF > 2834 #include <stdio.h> > 2835 #include <api/hlfs.h> > 2836 int main(void) { > 2837 return 0; > 2838 } > 2839 EOF > 2840 echo "come here"; > 2841 GLIB_DIR1_INC=/usr/lib/glib-2.0/include > 2842 GLIB_DIR2_INC=/usr/include/glib-2.0 > 2843 HLFS_DIR=/home/jiawei/workshop3/hlfs > 2844 LOG4C_DIR=$HLFS_DIR/3part/log > 2845 HDFS_DIR=$HLFS_DIR/3part/hadoop > 2832 if test "$hlfs" != "no" ; then > 2833 cat > $TMPC <<EOF > 2834 #include <stdio.h> > 2835 #include <api/hlfs.h> > 2836 int main(void) { > 2837 return 0; > 2838 } > 2839 EOF > 2840 echo "come here"; > 2841 GLIB_DIR1_INC=/usr/lib/glib-2.0/include > 2842 GLIB_DIR2_INC=/usr/include/glib-2.0 > 2843 HLFS_DIR=/home/jiawei/workshop3/hlfs > 2844 LOG4C_DIR=$HLFS_DIR/3part/log > 2845 HDFS_DIR=$HLFS_DIR/3part/hadoop > 2846 JVM_DIR=/usr/lib/jvm/java-6-openjdk > 2847 > 2848 if [ `getconf LONG_BIT` -eq "64" ];then > 2849 CLIBS="-L$LOG4C_DIR/lib64" > 2850 CLIBS="-L$HDFS_DIR/lib64 $CLIBS" > 2851 CLIBS="-L$HLFS_DIR/output/lib64 $CLIBS" > 2852 CLIBS="-L$JVM_DIR/jre/lib/amd64/server/ $CLIBS" > 2853 else if [ `getconf LONG_BIT` -eq "32" ];then > 2854 CLIBS="-L$LOG4C_DIR/lib32" > 2855 CLIBS="-L$HDFS_DIR/lib32 $CLIBS" > 2856 CLIBS="-L$JVM_DIR/jre/lib/i386/server $CLIBS" > 2857 CLIBS="-L$HLFS_DIR/output/lib32 $CLIBS" > 2858 fi > 2859 fi > 2860 echo "CLIBS is............"; > 2861 echo $CLIBS; > 2862 echo "CLIBS end..........."; > 2863 echo "$libs" > 2864 sleep 2; > 2865 CFLAGS="-I$GLIB_DIR1_INC" > 2866 CFLAGS="-I$GLIB_DIR2_INC $CFLAGS" > 2867 CFLAGS="-I$HLFS_DIR/src/include $CFLAGS" > 2868 CFLAGS="-I$LOG4C_DIR/include $CFLAGS" > 2869 echo "CFLAGS is............"; > 2870 echo $CFLAGS; > 2871 echo "CFLAGS end..........."; > 2872 sleep 2; > 2873 # removed '-llog4c' '-lhdfs' > 2874 hlfs_libs="$CLIBS -lhlfs -lglib-2.0 -lgthread-2.0 -lrt > -llog4c -lhdfs -ljvm" > 2875 if compile_prog "$CFLAGS" "$hlfs_libs" ; then > 2876 echo "run branch 1"; > 2877 hlfs=yes > 2878 libs_tools="$libs_tools $hlfs_libs" > 2879 libs_softmmu="$libs_softmmu $hlfs_libs" > 2880 # libs_softmmu="$libs_softmmu $hlfs_libs" > 2881 else > 2882 if test "$hlfs" = "yes" ; then > 2883 echo "run branch 2"; > 2884 feature_not_found "hlfs block device" > 2885 fi > 2886 hlfs=no > 2887 fi > 2888 fi > 2889 echo $hlfs_libs; > 2890 echo "Leave HLFS ..."; > 2891 sleep 2 > 2892 > 2893 ########################################## > [...] > > Unfortunately, it doesn't work. After i execute following commands, > it shows me libraries which are not pointed to what i set in file > qemu/configure. > > 1. git clone git://git.qemu.org/qemu.git > 2. cd qemu > 3, git reset --hard v1.3.0 > 4. cp ../hlfs/patches/hlfs_driver_for_qemu.patch ./ > 5. git apply hlfs_driver_for_qemu.patch > 6, Modify the dead path > 7, ./configure > 8, make > 9, ldd ./qemu-img > > Note: 1, Step 4 just move the patch to qemu dir for later patching. > 2, Step 6 just set the libraries in my OS. > > After up commands, i get > > $ ldd ./qemu-img > linux-gate.so.1 => (0x00355000) > librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0x003ca000) > libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x007cf000) > libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00110000) > libz.so.1 => /lib/libz.so.1 (0x002b3000) > libhlfs.so => /usr/lib/libhlfs.so (0x0021c000) > liblog4c.so.3 => /usr/lib/liblog4c.so.3 (0x00722000) > libhdfs.so.0 => /usr/lib/libhdfs.so.0 (0x00297000) > libjvm.so => /usr/lib/libjvm.so (0x00daa000) > libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x002c8000) > libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x0041b000) > /lib/ld-linux.so.2 (0x0074f000) > libsnappy.so.1 => > /home/jiawei/workshop3/hlfs/build/../3part/snappy/lib32/libsnappy.so.1 > (0x00364000) > libexpat.so.1 => /lib/libexpat.so.1 (0x002e1000) > libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x002a1000) > libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0057a000) > libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00309000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0032f000) > > I set libhlfs.so point to /home/jiawei/workshop3/hlfs/output/lib32 but, > in fact, it points to /usr/lib. The same as libhdfs.so and liblog4c.so. > I guess i have configured qemu/configure not correctly but i am not > clear about how i should configure? Could anyone give me some > suggestions? Thanks in advance. >
It seems that i confused the option '-L' of gcc command and 'ldd' command. The option '-L' of gcc command just works during compiling but 'ldd' command shows the dependency libraries during runtime, which can be configured by 'ldconfig' or 'LD_LIBRARY_PATH' but qemu/configure file. Does anyone has any other ideas? -- Thanks Harry Wei