2014-06-05 4 views
1

현재 저는 Siemens PLC에서 데이터를 로그하는 프로젝트를 진행하고 있습니다. 이를 위해 저는 Snap7을 사용하고 있습니다. Snap7 (http://snap7.sourceforge.net/)은 통신 라이브러리입니다.OpenWrt를 OS로 사용하는 MIPS 용 Snap7을 크로스 컴파일

나는 내가 오브젝트 파일을 모두 연결할 때 약간의 오류가

오류가 발생 얻을 내 리눅스 데스크톱에서 작업을 얻을 수 있었다하지만 난하려고 할 때 snap7 라이브러리를 크로스 컴파일했습니다.

g++ -shared -fPIC -o ../bin/mips-openwrt-linux-g++/libsnap7.so @"filelist.txt" -L. -lpthread -lrt -O3 
/usr/bin/ld: ../temp/mips-openwrt-linux/sys_snap_msgsock.o: Relocations in generic ELF (EM: 8) 
./temp/mips-openwrt-linux/sys_snap_msgsock.o: could not read symbols: File in wrong format 
collect2: error: ld returned 1 exit status 
make: *** [../bin/mips-openwrt-linux-g++/libsnap7.so] Error 1 

나는 그것이 잘못된 링커를 사용하여 생각 올바른있어 경우에있는 툴체인의 링커 사용해야합니다 openwrt를/staging_dir/툴체인-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/빈/

나는 또한 mips-openwrt-linux-g ++로 소프트웨어를 컴파일하려고 시도했다. 는 이제 또 다른 오류가 주어진다 :

mips-openwrt-linux-g++ -shared -fPIC -o ../bin/mips-openwrt-linux-g++/libsnap7.so @"filelist.txt" -L. -lpthread -lrt -O3 
openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: ../temp/mips-openwrt-linux/sys_snap_msgsock.o: relocation R_MIPS_26 against `close' can not be used when making a shared object; recompile with -fPIC 
../temp/mips-openwrt-linux/sys_snap_msgsock.o: could not read symbols: Bad value 
collect2: error: ld returned 1 exit status 
make: *** [../bin/mips-openwrt-linux-g++/libsnap7.so] Error 1 

나는 사람이 오류에 익숙한 나를 도울 수 있기를 바랍니다.

미리 감사드립니다.

edit1 : 사전 컴파일 된 일부 바이너리가 있습니다. makefile에서 CC를 g ++ 디렉토리로 변경했습니다. LD 플래그가 없기 때문에 거기에 링커를 설정할 수 없습니다.

답변

0

"hello world"프로그램을 교차 컴파일 할 수 있습니까?

file ../temp/mips-openwrt-linux/sys_snap_msgsock.o의 출력은 무엇입니까?

+0

Hello markgz, 답변 해 주셔서 감사합니다. 몇 시간 후에 나는 그것을 크로스 컴파일했다. 링커가 잘못 설정되었습니다. LinkerName과 SharedObjectLinkerName은 올바른 g ++ 링커를 참조해야합니다. 또한 MIPS를 크로스 컴파일하면 "버스 오류"가 발생합니다. 아마도 액세스 할 수없는 메모리에 쓰는 분할 오류 때문일 수 있습니다. 해결책은 snap_sysutils.cpp에서 스왑 기능을 변경하는 것입니다. 비트 교환없이 값을 반환하십시오. – user3707349