I tried to clone the below project and run it in my computer.
https://github.com/samvrlewis/cmocka-embedded-example
But got the below error. I checked the cmocka is already installed in my computer. When I run another project with cmocka test, I faced the same clang error and could not execute the make command. Is it because the cmocka setting in my computer? How can I fix it?
(base) XXX@iMac test % make ../src/i2c.c cc -I../src -Icmocka/include -c ../src/i2c.c -o obj/i2c.o ../src/tmp101.c cc -I../src -Icmocka/include -c ../src/tmp101.c -o obj/tmp101.o mock_i2c.c cc -I../src -Icmocka/include -c mock_i2c.c -o obj/mock_i2c.o test_tmp101.c cc -I../src -Icmocka/include -c test_tmp101.c -o obj/test_tmp101.o cc -o test_tmp101 obj/i2c.o obj/tmp101.o obj/mock_i2c.o obj/test_tmp101.o -Lcmocka/build/src -Wl,-rpath=cmocka/build/src -Wl,--wrap=i2c_read_blocking -Wl,--wrap=i2c_transmit_blocking -lcmocka ld: unknown options: -rpath=cmocka/build/src --wrap=i2c_read_blocking --wrap=i2c_transmit_blocking clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [test_tmp101] Error 1
(base) XXXXX@iMac test % pkg-config --modversion cmocka
1.1.5
The cmocka lib file in my computer.
(base) iMac:lib XXXX$ ls cmake libcmocka.0.dylib libcmocka.dylib libcmocka.0.8.0.dylib libcmocka.1.0.0.dylib pkgconfig
Execute the make command and run the cmocka unit test.