lucasjones / cpuminer-multi

Multi-algo CPUMiner & Reference Cryptonote Miner (JSON-RPC 2.0)
Other
642 stars 1.5k forks source link

Unable to compile on ubuntu 14.04 32 bits #8

Open grm opened 10 years ago

grm commented 10 years ago

hello,

I have succes compiling this miner on several x86-64 ubuntu computers but i can't manage to compile it on a ubuntu 14.04 computer. It seems to fail at then end of the compilation process. with the following message. So i am trying to compile it on an ubuntu 14.04 32 bits.

mv -f .deps/minerd-x11.Tpo .deps/minerd-x11.Po
mv -f .deps/minerd-cryptonight.Tpo .deps/minerd-cryptonight.Po
mv -f .deps/minerd-sha2.Tpo .deps/minerd-sha2.Po
mv -f .deps/minerd-c_skein.Tpo .deps/minerd-c_skein.Po
gcc -std=gnu99  -O3 -pthread  -o minerd minerd-cpu-miner.o minerd-util.o minerd-sha2.o minerd-scrypt.o minerd-keccak.o minerd-heavy.o minerd-quark.o minerd-skein.o minerd-ink.o minerd-blake.o minerd-cryptonight.o minerd-x11.o minerd-sph_keccak.o minerd-sph_hefty1.o minerd-sph_groestl.o minerd-sph_skein.o minerd-sph_bmw.o minerd-sph_jh.o minerd-sph_shavite.o minerd-sph_blake.o minerd-sph_luffa.o minerd-sph_cubehash.o minerd-sph_simd.o minerd-sph_echo.o minerd-oaes_lib.o minerd-c_keccak.o minerd-c_groestl.o minerd-c_blake256.o minerd-c_jh.o minerd-c_skein.o minerd-hash.o minerd-aesb.o minerd-sha2-x86.o minerd-scrypt-x86.o   -L/usr/lib/i386-linux-gnu -lcurl compat/jansson/libjansson.a -lpthread  -lcrypto
minerd-cryptonight.o: In function `cryptonight_hash_ctx_aes_ni':
cryptonight.c:(.text+0xdb3): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0xdce): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0xde9): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0xe04): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0xe1f): undefined reference to `fast_aesb_pseudo_round_mut'
minerd-cryptonight.o:cryptonight.c:(.text+0xe3a): more undefined references to `fast_aesb_pseudo_round_mut' follow
minerd-cryptonight.o: In function `cryptonight_hash_ctx_aes_ni':
cryptonight.c:(.text+0xfa7): undefined reference to `fast_aesb_single_round'
cryptonight.c:(.text+0x119e): undefined reference to `fast_aesb_single_round'
cryptonight.c:(.text+0x140a): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0x1449): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0x1488): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0x14c7): undefined reference to `fast_aesb_pseudo_round_mut'
cryptonight.c:(.text+0x1506): undefined reference to `fast_aesb_pseudo_round_mut'
minerd-cryptonight.o:cryptonight.c:(.text+0x1545): more undefined references to `fast_aesb_pseudo_round_mut' follow
collect2: error: ld returned 1 exit status

The only reference to fast_aesb_single_round i could find is in the file aesb-x64.S file which looks like a file dedicated to X86-64 systems :

$ grep -ri fast_aesb_single_round .
./cryptonight.c:extern int fast_aesb_single_round(const uint8_t *in, uint8_t*out, const uint8_t *expandedKey);
./cryptonight.c:        fast_aesb_single_round(&ctx->long_state[j], ctx->c, ctx->a);
./cryptonight.c:        fast_aesb_single_round(&ctx->long_state[j], ctx->b, ctx->a);
./aesb-x64.S:    .globl fast_aesb_single_round
./aesb-x64.S:    .globl _fast_aesb_single_round
./aesb-x64.S:fast_aesb_single_round:
./aesb-x64.S:_fast_aesb_single_round:
Binary file ./minerd-cryptonight.o matches

I can provide any information you need. Thx for your help !

lucasjones commented 10 years ago

Hi, could you try recompiling with the latest version (after @36c5fec28e181c34984d9e0b57364d552c5ea4f5)? I've added function definitions for the missing functions in an x86-specific asm file, which might solve your compilation issues.

grm commented 10 years ago

Hello,

Thank you for your fast support !

The error has changed :

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson    -O3 -march=native -MT minerd-aesb-x86.o -MD -MP -MF .deps/minerd-aesb-x86.Tpo -c -o minerd-aesb-x86.o `test -f 'aesb-x86.S' || echo './'`aesb-x86.S
aesb-x86.S: Assembler messages:
aesb-x86.S:33: Error: bad register name `%rdx'
aesb-x86.S:34: Error: bad register name `%rdi'
aesb-x86.S:35: Error: bad register name `%rsi'
aesb-x86.S:36: Error: bad register name `%rdx'
make[2]: *** [minerd-aesb-x86.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Thank you

lucasjones commented 10 years ago

I have moved the mul128 implementation into a separate C file with @d8cbd09ace8991d61c91e1b84c5287c8b7a76aba. Run autogen.sh and configure again with the latest version, and let me know if you still encounter an error while compiling.

grm commented 10 years ago

Another issue :

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson    -O3 -march=native -MT minerd-aesb-x86-impl.o -MD -MP -MF .deps/minerd-aesb-x86-impl.Tpo -c -o minerd-aesb-x86-impl.o `test -f 'crypto/aesb-x86-impl.c' || echo './'`crypto/aesb-x86-impl.c
crypto/aesb-x86-impl.c:1:9: warning: #pragma once in main file [enabled by default]
 #pragma once
         ^
crypto/aesb-x86-impl.c:3:1: error: unknown type name �uint64_t
 uint64_t mul128(uint64_t multiplier, uint64_t multiplicand, uint64_t* product_hi) {
 ^
crypto/aesb-x86-impl.c:3:17: error: unknown type name �uint64_t
 uint64_t mul128(uint64_t multiplier, uint64_t multiplicand, uint64_t* product_hi) {
                 ^
crypto/aesb-x86-impl.c:3:38: error: unknown type name �uint64_t
 uint64_t mul128(uint64_t multiplier, uint64_t multiplicand, uint64_t* product_hi) {
                                      ^
crypto/aesb-x86-impl.c:3:61: error: unknown type name �uint64_t
 uint64_t mul128(uint64_t multiplier, uint64_t multiplicand, uint64_t* product_hi) {
                                                             ^
make[2]: *** [minerd-aesb-x86-impl.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Tank you :)

grm commented 10 years ago

I ran make clean, autogen, and configure.

lucasjones commented 10 years ago

The errors given by the compiler should now be fixed with @d79ad43b9968eb205f5a36ce05de74256f696d59. I am currently unable to test compilation for x86 platforms, so forgive me if I have missed anything that might still be causing an issue.

grm commented 10 years ago

no, problem, thanks to you for your time and support ! :)

It compiles now but it segfaults before starting. Here is the end of the strace while running it if it can help you. Sorry I can't help you more ..

[2014-05-25 03:01:48] Starting Stratum on stratum+tcp://127.0.0.1:8888
mmap2(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xb4fff000
mprotect(0xb4fff000, 4096, PROT_NONE)   = 0
clone(child_stack=0xb57ff424, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, pare
nt_tidptr=0xb57ffba8, {entry_number:6, base_addr:0xb57ffb40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}
, child_tidptr=0xb57ffba8) = 30447
[2014-05-25 03:01:48] Binding thread 0 to cpu 0
mmap2(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xb43fe000
mprotect(0xb43fe000, 4096, PROT_NONE)   = 0
clone(child_stack=0xb4bfe424, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0xb4bfeba8, {entry_number:6, base_addr:0xb4bfeb40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb4bfeba8) = 30448
[2014-05-25 03:01:48] Binding thread 1 to cpu 1
mmap2(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xb37fe000
mprotect(0xb37fe000, 4096, PROT_NONE)   = 0
clone(child_stack=0xb3ffe424, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0xb3ffeba8, {entry_number:6, base_addr:0xb3ffeb40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb3ffeba8) = 30449
[2014-05-25 03:01:48] Binding thread 2 to cpu 2
mmap2(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0xb2bfe000
mprotect(0xb2bfe000, 4096, PROT_NONE)   = 0
clone(child_stack=0xb33fe424, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0xb33feba8, {entry_number:6, base_addr:0xb33feb40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0xb33feba8) = 30450
time(NULL)                              = 1400979708
futex(0x811aec0, FUTEX_WAIT_PRIVATE, 2, NULL[2014-05-25 03:01:48] Binding thread 3 to cpu 3
) = 0
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2945, ...}) = 0
futex(0x811aec0, FUTEX_WAKE_PRIVATE, 1) = 0
write(2, "[2014-05-25 03:01:48] 4 miner th"..., 78[2014-05-25 03:01:48] 4 miner threads started, using 'cryptonight' algorithm.
) = 78
futex(0xb6bc9ba8, FUTEX_WAIT, 30445, NULL <unfinished ...>
+++ killed by SIGSEGV +++
Segmentation fault
Sykh commented 10 years ago

Compiled fine on 14.04 x64 - any particular reason you are using 32 Bit? It usually decreases cpu mining performance by 50% anyway...