warning: ld-linux.so.3, needed by libidontknow.so, not found (try using -rpath or -rpath-link)
정작 실행했을 경우 해결이 되지 않고 특정 라이브러리를 불러오는데 에러가 발생을 했다고만 간략하게 나온다.
./sample: error while loading shared libraries: libidontknow.so: internal error
무슨 문제가 있나 곰곰히 고민을 해보니 softfp와 hardfp의 차이인것 같아서 검색해보니
ABI가 달라서 두개를 혼용할 수 없는게 문제인 것으로 보이는데
그렇게 따지면.. ld-linux.so.3를 찾아서 넣는게 오히려 빠른 해결 책이 아닐까 생각이 된다.
좀 더 근원적으로는, 사용하려는 libidontknow.so를 softfp가 아닌 hardfp로 빌드하는게 가장 좋긴 하겠지만 말이다.
+
호출 규약이 다르다..
soft : floating-point 연산을 위한 라이브러리 콜을 포함하도록 gcc 가 컴파일 결과를 만들어낸다. softfp : hardware floating-point instruction 을 생성하도록 하지만, 여전히 soft-float 호출 규약(calling convention)을 사용한다. hard : floating-point instructions 을 생성하고 FPU 특화된 호출 규약(calling convention)을 사용한다.
Applications, which are built under “hardfp” option, cannot work under Linux, that was compiled under “softfp” – because different ABI conventions; function parameters transfer are different : the soft float conventions assume passing floats through general purpose (integer) registers, but “hardfp” uses the floating point register.
arm
hard-float ABI, BE32: /lib/ld-linux-armhf.so.3
hard-float ABI, BE8: /lib/ld-linux-armhf.so.3
hard-float ABI, LE: /lib/ld-linux-armhf.so.3
soft-float ABI, BE32: /lib/ld-linux.so.3
soft-float ABI, BE8: /lib/ld-linux.so.3
soft-float ABI, LE: /lib/ld-linux.so.3
(The ARM soft-float ABI can be used with both hard and soft-float code. ARM supports two variants of big-endian operation, (on newer processors) BE8 and (on older processors) BE32, which are the same at .o level but incompatible for linked executables and shared libraries.)
softfp는 hardware float point 를 사용하지만 함수 호출 방식은 soft 방식을 쓴다고 보면 될 듯?
-mfloat-abi=name Specifies which floating-point ABI to use. Permissible values are: ‘soft’, ‘softfp’ and ‘hard’.
Specifying ‘soft’ causes GCC to generate output containing library calls for floating-point operations. ‘softfp’ allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions. ‘hard’ allows generation of floating-point instructions and uses FPU-specific calling conventions.
The default depends on the specific target configuration. Note that the hard-float and soft-float ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries.
아무튼 컴파일러가 multilib을 지원하면 softfp를 쓰라는데 반대로 multilib을 지원하지 않으면 soft, hard만 지원한다는 건가?
If the compiler has multilib enabled (you can tell with -print-multi-lib) then you can use -mfloat-abi=softfp, but if not then that option won't help you much: gcc will happily generate softfp code, but then there'll be no compatible libgcc to link against.