orangepi-xunlong / wiringOP

wiringPi for Orange Pi
GNU Lesser General Public License v3.0
415 stars 192 forks source link

`libwiringPi.so` failed to link to required libraries #45

Closed kingsimba closed 1 year ago

kingsimba commented 2 years ago

For users of wiringPi, they should only link to libwiringPi.so, and be oblivious of indirect dependencies(-lrc -lpthread -lcrypt)

But libwiringPi.so are not correctly linked:

$ ldd libwiringPi.so
        linux-vdso.so.1 (0x0000007f96694000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f964b0000)
        /lib/ld-linux-aarch64.so.1 (0x0000007f96664000)

The error results from https://github.com/orangepi-xunlong/wiringOP/blob/c56902108e78fd5dfd4fdb9499488c2f83988de2/wiringPi/Makefile#L155

$(LIBS) should be placed after $(OBJ)

kingsimba commented 2 years ago

After fixing the issue. ldd shows correct dependency:

$ ldd libwiringPi.so
        linux-vdso.so.1 (0x0000007fa3c74000)
        libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007fa3b59000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007fa3b29000)
        librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000007fa3b11000)
        libcrypt.so.1 => /lib/aarch64-linux-gnu/libcrypt.so.1 (0x0000007fa3ac8000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fa3955000)
        /lib/ld-linux-aarch64.so.1 (0x0000007fa3c44000)