frida-core icon indicating copy to clipboard operation
frida-core copied to clipboard

"ld: library 'elf' not found" when compile frida-core-example.c on Mac

Open bakabird opened this issue 8 months ago • 0 comments

Environment: macOS 14.0 CPU: Apple M2 Model: MacBook Air

I downloaded the frida-core-devkit from frida-core-devkit-16.1.4-freebsd-arm64.tar.xz.

image

Within the frida-core-example.c file, I found the gcc command as follows:

/*
 * Compile with:
 *
 * gcc -ffunction-sections -fdata-sections frida-core-example.c -o frida-core-example -L. -lfrida-core -lelf -ldl -lm -pthread -Wl,--export-dynamic,--gc-sections
 *
 * Visit https://frida.re to learn more about Frida.
 */

I attempted to execute the provided gcc command: gcc -ffunction-sections -fdata-sections frida-core-example.c -o frida-core-example -L. -lfrida-core -lelf -ldl -lm -pthread -Wl,--export-dynamic,--gc-sections. However, I encountered an error:

ld: unknown options: --export-dynamic --gc-sections.

After conducting some research, I revised the command to gcc -ffunction-sections -fdata-sections frida-core-example.c -o frida-core-example -L. -lfrida-core -lelf -ldl -lm -pthread -Wl,-export_dynamic,-dead_strip.

Now, a new error has emerged:

ld: library 'elf' not found.

What should I do?

bakabird avatar Oct 16 '23 17:10 bakabird