MythicAgents / poseidon

Poseidon is a Golang agent targeting Linux and macOS
Other
118 stars 32 forks source link

macos compilation error #53

Closed shinegod closed 7 months ago

shinegod commented 7 months ago

➜ poseidon.bin ranlib poseidon-darwin-10.12-amd64.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000001.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000002.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000003.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000012.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000013.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000014.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000020.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000035.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000038.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000047.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: poseidon-darwin-10.12-amd64.a(000051.o) has no symbols

➜ poseidon.bin clang -shared -framework Foundation -framework CoreGraphics -framework Security -framework ApplicationServices -framework OSAKit -framework AppKit -fpic sharedlib-darwin-linux.c poseidon-darwin-10.12-amd64.a -o poseidon.dylib sharedlib-darwin-linux.c:28:43: error: incompatible function pointer types passing 'void ()()' to parameter of type 'void _Nullable ( _Nonnull)(void _Nullable)' [-Wincompatible-function-pointer-types] pthread_create(&posixThreadID, &attr, &RunMain, NULL); ^~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:340:31: note: passing argument to parameter here void _Nullable ( _Nonnull)(void * _Nullable), ^ 1 error generated.

its-a-feature commented 7 months ago

currently working on a better fix, but for now:

  1. You downloaded a zip of files and extracted the zip
  2. In that zip, there's a .h file with the line extern void RunMain(); - change that to extern void RunMain;
  3. In your compile command (the clang -shared ... add in -framework OpenDirectory so that it looks like clang -shared -framework Foundation -framework CoreGraphics -framework Security -framework ApplicationServices -framework OSAKit -framework AppKit -framework OpenDirectory -fpic sharedlib-darwin-linux.c poseidon-darwin-10.12-amd64.a -o poseidon.dylib