Author

Topic: Need help for compiling cgminer for icarus ASICs (USB Block Erupter) (Read 213 times)

jr. member
Activity: 48
Merit: 37
The problem is that the latest RPiOS uses a buggy gcc version.

As tested with gcc 12.3.0 if you use the latest ubuntu (and any version in the last few years) on RPi it works fine.

Someone has already come to my pool #gekko channel with this error and verified that even the earlier versions
of the RPiOS compile OK also.

The error is clearly false.
If you check further up in your error output you will see that it is a bug in gcc, since it effectively claims

(TMPBUFSIZ / 2 - 1) is greater than TMPBUFSIZ
(which is obviously not correct)

api.c:5061 is:
Code:
n = recv(c, &buf[0], TMPBUFSIZ / 2 - 1, 0);

However buf defined above that is:
Code:
char buf[TMPBUFSIZ];

So I can only guess there are rather blatant bugs in the version of gcc on the RPiOS
since obviously (TMPBUFSIZ / 2 - 1) is NOT greater than TMPBUFSIZ

Thanks for the info Kano,

I'd tried this on a Raspberry PI 5 a few times and ran into the same issues. I even tried downgrading GCC to 11 but that appears to have the same problem. There's no package for the PI5 distro for earlier versions of GCC than 11.

I've succesfully built CGMiner using GCC 10.2.1 on the PI3B and PI-Zero-2W and that is my main driver for my set-ups. While I can get the executable running on the PI5 it'd be nice to be able to build it there too.

I'm wondering if I can build GCC 10 from source, but thats giving me a headache just thinking about it.

Anyway, thanks for your help on this topic.





legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
The problem is that the latest RPiOS uses a buggy gcc version.

As tested with gcc 12.3.0 if you use the latest ubuntu (and any version in the last few years) on RPi it works fine.

Someone has already come to my pool #gekko channel with this error and verified that even the earlier versions
of the RPiOS compile OK also.

The error is clearly false.
If you check further up in your error output you will see that it is a bug in gcc, since it effectively claims

(TMPBUFSIZ / 2 - 1) is greater than TMPBUFSIZ
(which is obviously not correct)

api.c:5061 is:
Code:
n = recv(c, &buf[0], TMPBUFSIZ / 2 - 1, 0);

However buf defined above that is:
Code:
char buf[TMPBUFSIZ];

So I can only guess there are rather blatant bugs in the version of gcc on the RPiOS
since obviously (TMPBUFSIZ / 2 - 1) is NOT greater than TMPBUFSIZ
hero member
Activity: 504
Merit: 1065
Crypto Swap Exchange
Did you tried with fcommon?

Code:
-fcommon


...

/usr/bin/ld: cgminer-driver-gekko.o:(.bss+0xd48): multiple definition of `modminer_drv'; cgminer-cgminer.o:(.bss+0x2078): first defined here
/usr/bin/ld: cgminer-driver-gekko.o:(.bss+0xdd0): multiple definition of `bitforce_drv'; cgminer-cgminer.o:(.bss+0x1ff0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:893: cgminer] Fehler 1
make[2]: Verzeichnis „/home/pi/mining/newpac/cgminer“ wird verlassen
make[1]: *** [Makefile:1837: all-recursive] ERROR 1
make[1]: Verzeichnis „/home/pi/mining/newpac/cgminer“ wird verlassen
make: *** [Makefile:796: all] ERROR 2

STILL THE SAME ERROR...



My updated version includes a README build comment that may fix this...

-fcommon

https://github.com/kanoi/cgminer/blob/master/README#L153

Alas you are compiling someone else's version, so no idea if that is the fix.
I had to 'fix' a large number of compile warnings and a few errors when I pulled the code into the master cgminer

Read here for 4.12.0:
https://bitcointalksearch.org/topic/m.58200639

-j has no effect on if it will compile
newbie
Activity: 3
Merit: 0
I tried it, same problem Sad

Code:
In function ‘recv’,
    inlined from ‘api’ at api.c:5061:8:
/usr/include/arm-linux-gnueabihf/bits/socket2.h:40:12: warning: call to ‘__recv_chk_warn’ declared with attribute warning: recv called with bigger length than size of destination buffer [-Wattribute-warning]
   40 |     return __recv_chk_warn (__fd, __buf, __n, sz, __flags);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       cgminer-logging.o
  CC       cgminer-klist.o
  CC       cgminer-noncedup.o
  CC       cgminer-usbutils.o
  CC       cgminer-driver-blockerupter.o
  CCLD     cgminer
/usr/bin/ld: cgminer-api.o: in function `mcast':
api.c:(.text+0x822): undefined reference to `__glibc_safe_or_unknown_len'
/usr/bin/ld: api.c:(.text+0x838): undefined reference to `__glibc_unsafe_len'
/usr/bin/ld: cgminer-api.o: in function `api':
api.c:(.text+0x757c): undefined reference to `__glibc_safe_or_unknown_len'
/usr/bin/ld: api.c:(.text+0x7592): undefined reference to `__glibc_unsafe_len'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:907: cgminer] Error 1
make[2]: Leaving directory '/home/pi/cgminer'
make[1]: *** [Makefile:1896: all-recursive] Error 1
make[1]: Leaving directory '/home/pi/cgminer'
make: *** [Makefile:810: all] Error 2
pi@bananapim2zero:~/cgminer$
legendary
Activity: 3234
Merit: 2943
Block halving is coming.
Hello BitMaxz,

I tried with your commands, but unfortunately it's still the same:
~snip~

I also checked and I don't have any previous version to remove. It's a clean box...

Ok I found a similar issue and it seems he solved the issue but the device is undetectable.

Can you try the command provided by IDontModLobbies from the link below?
- https://github.com/luke-jr/bfgminer/issues/816#issuecomment-1098654521
newbie
Activity: 3
Merit: 0
Hello BitMaxz,

I tried with your commands, but unfortunately it's still the same:

Code:
In function ‘recv’,
    inlined from ‘api’ at api.c:5061:8:
/usr/include/arm-linux-gnueabihf/bits/socket2.h:40:12: warning: call to ‘__recv_chk_warn’ declared with attribute warning: recv called with bigger length than size of destination buffer [-Wattribute-warning]
   40 |     return __recv_chk_warn (__fd, __buf, __n, sz, __flags);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       cgminer-logging.o
  CC       cgminer-klist.o
  CC       cgminer-noncedup.o
  CC       cgminer-usbutils.o
  CC       cgminer-crc16.o
  CC       cgminer-driver-icarus.o
  CC       cgminer-driver-gekko.o
  CCLD     cgminer
/usr/bin/ld: cgminer-api.o: in function `mcast':
api.c:(.text+0x822): undefined reference to `__glibc_safe_or_unknown_len'
/usr/bin/ld: api.c:(.text+0x838): undefined reference to `__glibc_unsafe_len'
/usr/bin/ld: cgminer-api.o: in function `api':
api.c:(.text+0x757c): undefined reference to `__glibc_safe_or_unknown_len'
/usr/bin/ld: api.c:(.text+0x7592): undefined reference to `__glibc_unsafe_len'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:907: cgminer] Error 1
make[2]: Leaving directory '/home/pi/cgminer'
make[1]: *** [Makefile:1896: all-recursive] Error 1
make[1]: Leaving directory '/home/pi/cgminer'
make: *** [Makefile:810: all] Error 2
pi@bananapim2zero:~/cgminer$

I also checked and I don't have any previous version to remove. It's a clean box...
legendary
Activity: 3234
Merit: 2943
Block halving is coming.
All guides and solution for cgminer is on the Kano Gekko page which you can find in the link below.

- https://kano.is/gekko.php

Also, scroll down to the bottom and read under "Remove pre-installed hack linux".

Would you mind to try this command below and update here if the error will be the  same.

Code:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y build-essential autoconf automake libtool pkg-config libcurl4-openssl-dev libudev-dev libusb-1.0-0-dev libncurses5-dev zlib1g-dev git
cd
git clone https://github.com/kanoi/cgminer.git
cd cgminer
CFLAGS="-O2 -march=native -fcommon" ./autogen.sh --enable-gekko --enable-icarus
make
sudo apt-get install -y openjdk-8-jre-headless
newbie
Activity: 3
Merit: 0
Hi guys, newbie here,

I'm just trying to have some fun with an old USB Block Erupter, but I can't compile cg-miner.
I'm compiling on armbian (banana pi zero board), basically the same as raspbian for raspberry pi.

I tried 3 different repos and it's always the same error when I reach "make"

Steps:

sudo apt-get update -y
sudo apt-get install build-essential autoconf automake libtool pkg-config libcurl4-openssl-dev libudev-dev \
libjansson-dev libncurses5-dev libusb-1.0-0-dev zlib1g-dev git -y

git clone https://github.com/kanoi/cgminer.git   (tried also https://github.com/wareck/cgminer-gekko.git and the original http://ck.kolivas.org/apps/cgminer/)

cd cgminer
CFLAGS="-O2 -fcommon" ./autogen.sh --enable-icarus
make

and it fails with this:
Code:
In function ‘recv’,
    inlined from ‘api’ at api.c:5061:8:
/usr/include/arm-linux-gnueabihf/bits/socket2.h:40:12: warning: call to ‘__recv_chk_warn’ declared with attribute warning: recv called with bigger length than size of destination buffer [-Wattribute-warning]
   40 |     return __recv_chk_warn (__fd, __buf, __n, sz, __flags);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       cgminer-logging.o
  CC       cgminer-klist.o
  CC       cgminer-noncedup.o
  CC       cgminer-usbutils.o
  CC       cgminer-driver-icarus.o
  CCLD     cgminer
/usr/bin/ld: cgminer-api.o: in function `mcast':
api.c:(.text+0x814): undefined reference to `__glibc_safe_or_unknown_len'
/usr/bin/ld: api.c:(.text+0x82a): undefined reference to `__glibc_unsafe_len'
/usr/bin/ld: cgminer-api.o: in function `api':
api.c:(.text+0x7596): undefined reference to `__glibc_safe_or_unknown_len'
/usr/bin/ld: api.c:(.text+0x75ac): undefined reference to `__glibc_unsafe_len'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:907: cgminer] Error 1
make[2]: Leaving directory '/home/pi/cgminer'
make[1]: *** [Makefile:1896: all-recursive] Error 1
make[1]: Leaving directory '/home/pi/cgminer'
make: *** [Makefile:810: all] Error 2
pi@bananapim2zero:~/cgminer$

Can anyone point me what could be the problem here?

Thanks!
Jump to: