limneos / MobileMiner

CPU Miner for ARM64 iOS Devices
GNU General Public License v2.0
429 stars 116 forks source link

Error while compiling cpu miner #2

Open mooseDev opened 6 years ago

mooseDev commented 6 years ago

Hi,

got the following errors when trying to compile the cpu miner files. Thank you for your help.

Steps:

/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive Making all in compat make[3]: Nothing to be done forall-am'. gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -Ofast -flto -fuse-linker-plugin -g -O2 -MT minerd-cpu-miner.o -MD -MP -MF .deps/minerd-cpu-miner.Tpo -c -o minerd-cpu-miner.o test -f 'cpu-miner.c' || echo './'cpu-miner.c clang: warning: optimization flag '-fuse-linker-plugin' is not supported [-Wignored-optimization-argument] cpu-miner.c:221:27: error: unknown type name 'CFNotificationCenterRef' void notificationCallback(CFNotificationCenterRef center, void observer, CFStringRef name, const void object, CFDictionaryRef userInfo){ ^ cpu-miner.c:221:75: error: unknown type name 'CFStringRef' void notificationCallback(CFNotificationCenterRef center, void observer, CFStringRef name, const void object, CFDictionaryRef userInfo){ ^ cpu-miner.c:221:113: error: unknown type name 'CFDictionaryRef' void notificationCallback(CFNotificationCenterRef center, void observer, CFStringRef name, const void object, CFDictionaryRef userInfo){ ^ cpu-miner.c:223:24: warning: implicit declaration of function 'CFStringGetCStringPtr' is invalid in C99 [-Wimplicit-function-declaration] const char namechr = CFStringGetCStringPtr( name, 4 /30/ ) ; ^ cpu-miner.c:242:25: error: expected expression connectedToInternet=[[objc_getClass("PCPersistentInterfaceManager") sharedInstance] isInternetReachable]; ^ cpu-miner.c:470:22: warning: passing 'char ' to parameter of type 'unsigned char ' converts between pointers to integer types with different sign [-Wpointer-sign] if (!hex2bin(blob, hexblob, blobLen / 2)) { ^~~~ ./miner.h:263:36: note: passing argument to parameter 'p' here extern bool hex2bin(unsigned char p, const char hexstr, size_t len); ^ cpu-miner.c:664:30: warning: implicit declaration of function 'CFAbsoluteTimeGetCurrent' is invalid in C99 [-Wimplicit-function-declaration] if (lastSubmissionTime>0 && CFAbsoluteTimeGetCurrent()-lastSubmissionTime<0.8){ ^ cpu-miner.c:675:7: warning: implicit declaration of function 'CFNotificationCenterPostNotification' is invalid in C99 [-Wimplicit-function-declaration] CFNotificationCenterPostNotification(CFNotificationCenterGetLocalCenter(), CFSTR("thread.exit"), "workio", NULL, 0); ^ cpu-miner.c:675:44: warning: implicit declaration of function 'CFNotificationCenterGetLocalCenter' is invalid in C99 [-Wimplicit-function-declaration] CFNotificationCenterPostNotification(CFNotificationCenterGetLocalCenter(), CFSTR("thread.exit"), "workio", NULL, 0); ^ cpu-miner.c:675:82: warning: implicit declaration of function 'CFSTR' is invalid in C99 [-Wimplicit-function-declaration] CFNotificationCenterPostNotification(CFNotificationCenterGetLocalCenter(), CFSTR("thread.exit"), "workio", NULL, 0); ^ cpu-miner.c:702:37: warning: passing 'char [32]' to parameter of type 'const unsigned char ' converts between pointers to integer types with different sign [-Wpointer-sign] char hashhex = bin2hex(hash, 32); ^~~~ ./miner.h:262:43: note: passing argument to parameter 'p' here extern char bin2hex(const unsigned char p, size_t len); ^ cpu-miner.c:736:37: warning: passing 'char [32]' to parameter of type 'const unsigned char ' converts between pointers to integer types with different sign [-Wpointer-sign] char hashhex = bin2hex(hash, 32); ^~~~ ./miner.h:262:43: note: passing argument to parameter 'p' here extern char bin2hex(const unsigned char p, size_t len); ^ cpu-miner.c:1697:8: error: unknown type name 'NSDictionary' static NSDictionary devDict=NULL; ^ cpu-miner.c:1761:6: error: use of undeclared identifier 'NSString' NSString ndURL=NULL; ^ cpu-miner.c:1761:16: error: use of undeclared identifier 'ndURL' NSString ndURL=NULL; ^ cpu-miner.c:1762:6: error: use of undeclared identifier 'NSString' NSString ndUSER=NULL; ^ cpu-miner.c:1762:16: error: use of undeclared identifier 'ndUSER' NSString ndUSER=NULL; ^ cpu-miner.c:1763:6: error: use of undeclared identifier 'NSString' NSString ndPASS=NULL; ^ cpu-miner.c:1763:16: error: use of undeclared identifier 'ndPASS' NSString ndPASS=NULL; ^ cpu-miner.c:1766:7: error: use of undeclared identifier 'NSUserDefaults' NSUserDefaults defaults=[NSUserDefaults standardUserDefaults]; ^ cpu-miner.c:1766:23: error: use of undeclared identifier 'defaults' NSUserDefaults defaults=[NSUserDefaults standardUserDefaults]; ^ cpu-miner.c:1766:32: error: expected expression NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults]; ^ cpu-miner.c:1767:7: error: expected expression [defaults synchronize]; ^ cpu-miner.c:1768:15: error: expected expression devDict=[defaults objectForKey:@"dev"] ? [[defaults objectForKey:@"dev"] retain] : [[NSDictionary alloc] init]; ^ cpu-miner.c:1771:10: error: expected expression if ([devDict objectForKey:@"url"]){ ^ cpu-miner.c:1772:7: error: use of undeclared identifier 'ndURL' ndURL=[devDict objectForKey:@"url"]; ^ cpu-miner.c:1772:13: error: expected expression ndURL=[devDict objectForKey:@"url"]; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 8 warnings and 20 errors generated. make[2]: [minerd-cpu-miner.o] Error 1 make[1]: [all-recursive] Error 1 make: *** [all] Error 2 `

limneos commented 6 years ago

Inside miner.h:

#ifdef __OBJC__
#include <Foundation/Foundation.h>

the ifdef probably doesn't fire. It doesn't recognise any objective-c calls in the code.

In the Makefile where is says DEFS = DHAVE_CONFIG_H ...

try changing it to:

DEFS = -x objective-c -isystem /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ -DHAVE_CONFIG_H ...

mooseDev commented 6 years ago

Thank you for your help. Here the result:

sha2-x64.S:18:2: error: expected identifier or '(' .data ^

sha2-x64.S:928:32: error: expected parameter declarator sha256_avx_extend_doubleround(0) ^

sha2-x64.S:928:32: error: expected ')'

sha2-x64.S:928:2: note: to match this '(' sha256_avx_extend_doubleround(0) ^

sha2-x64.S:454:10: note: expanded from macro 'sha256_avx_extend_doubleround' vmovdqa (i-14)*16(%rax), %xmm4; \ ^

sha2-x64.S:928:2: error: expected function body after function declarator sha256_avx_extend_doubleround(0) ^

sha2-x64.S:454:16: note: expanded from macro 'sha256_avx_extend_doubleround' vmovdqa (i-14)*16(%rax), %xmm4; \ ^

sha2-x64.S:928:2: error: unknown type name 'vpslld'

sha2-x64.S:455:2: note: expanded from macro 'sha256_avx_extend_doubleround' vpslld $14, %xmm0, %xmm2; \ ^

sha2-x64.S:928:2: error: expected identifier or '('

sha2-x64.S:455:14: note: expanded from macro 'sha256_avx_extend_doubleround' vpslld $14, %xmm0, %xmm2; \ ^

sha2-x64.S:928:2: error: expected ';' after top level declarator

sha2-x64.S:455:14: note: expanded from macro 'sha256_avx_extend_doubleround' vpslld $14, %xmm0, %xmm2; \ ^

sha2-x64.S:928:2: error: unknown type name 'vpslld'

sha2-x64.S:456:2: note: expanded from macro 'sha256_avx_extend_doubleround' vpslld $14, %xmm4, %xmm6; \ ^

sha2-x64.S:928:2: error: expected identifier or '('

sha2-x64.S:456:14: note: expanded from macro 'sha256_avx_extend_doubleround' vpslld $14, %xmm4, %xmm6; \ ^ sha2-x64.S:928:2: error: expected ';' after top level declarator sha2-x64.S:456:14: note: expanded from macro 'sha256_avx_extend_doubleround' vpslld $14, %xmm4, %xmm6; \ ^ sha2-x64.S:928:2: error: unknown type name 'vpsrld' sha2-x64.S:457:2: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $3, %xmm0, %xmm8; \ ^

sha2-x64.S:928:2: error: expected identifier or '('

sha2-x64.S:457:13: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $3, %xmm0, %xmm8; \ ^ sha2-x64.S:928:2: error: expected ';' after top level declarator

sha2-x64.S:457:13: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $3, %xmm0, %xmm8; \ ^ sha2-x64.S:928:2: error: unknown type name 'vpsrld'

sha2-x64.S:458:2: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $3, %xmm4, %xmm4; \ ^ sha2-x64.S:928:2: error: expected identifier or '(' sha2-x64.S:458:13: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $3, %xmm4, %xmm4; \ ^ sha2-x64.S:928:2: error: expected ';' after top level declarator

sha2-x64.S:458:13: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $3, %xmm4, %xmm4; \ ^ sha2-x64.S:928:2: error: unknown type name 'vpsrld'

sha2-x64.S:459:2: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $7, %xmm0, %xmm1; \ ^

sha2-x64.S:928:2: error: expected identifier or '('

sha2-x64.S:459:13: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $7, %xmm0, %xmm1; \ ^

sha2-x64.S:928:2: error: expected ';' after top level declarator

sha2-x64.S:459:13: note: expanded from macro 'sha256_avx_extend_doubleround' vpsrld $7, %xmm0, %xmm1; \ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make[2]: [minerd-sha2-x64.o] Error 1 make[1]: [all-recursive] Error 1 make: *** [all] Error 2`

limneos commented 6 years ago

have you set the target to arm64? Try : LDFLAGS = "arch=arm64" ./configure --build=arm64-apple-darwin --target=arm64-apple-darwin make clean; make;

mooseDev commented 6 years ago

yes changed LDFLAGS in the make file like you mentioned but same errors

mooseDev commented 6 years ago

Attached a new log: 20171223-log.txt

limneos commented 6 years ago

If you're having trouble compiling the cpuminer project, I'm including all dependencies and the minerd.a in Precompiled Binaries folder. You can just drag them in the Xcode project and it should work.