質問

While I run snmpd daemon on powerpc board(a.p.) I am getting this error:

R_PPC_REL24: Compile shared libraries with -fPIC!
/usr/local/sbin/snmpd: symbol 'strlen': can't handle reloc type 0xa in lib
/lib/libnetsnmpmibs.so.15'
sh: you need to specify whom to kill

I googled and found that the -fPIC flag should be there while compiling and its place should be right after gcc, so I changed my Makefie accordingly. Here is a snippet of my makefile:

$(Q)cd $(PROJECT_BUILD_DIR)/$(NET_SNMP_PKG) && ./configure --target=$(TARGET_TRIPLET) \  
        --host=$(HOST_TRIPLET) \
        --build=$(BUILD_TRIPLET) \   
        --with-cc="$(CR_COMPLR)gcc -fPIC" \`  
        --with-cflags="-Os -I$(RFS)/lib -I$(NMS_DIR)/include" \`  
        --with-linkcc="$(CR_COMPLR)gcc -fPIC" \`    

As you can see I embedded -fPIC right after gcc, but I am still getting an error. I have cross compiled for powerpc platform and I am using latest buildroot-2011.11 and gcc 4.3.6 and uClibc version 0.9.32. What may be the cause of error?

P.S. When I do nm libnetsnmpmibs.so.15 | grep strlen then I get output as U strlen. Does this mean it is undefined?

役に立ちましたか?

解決

I got the problem. actually the main thing is to compile with -fPIC only.

In my case I was compiling snmp libraries with -fPIC correctly but some of the functions were dependent on libraries of other packages (nms). As I am working on firmware development there are more than 20 packages involved. So I compiled nms libraries with -fPIC and error is resolved.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top