Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing gem on Ubuntu Servor #7

Open
lmX2015 opened this issue Jun 20, 2017 · 10 comments
Open

Error installing gem on Ubuntu Servor #7

lmX2015 opened this issue Jun 20, 2017 · 10 comments

Comments

@lmX2015
Copy link

lmX2015 commented Jun 20, 2017

Hey,
I tried to install the gem on an Ubuntu server in order to run ethereum.rb.
But I got an error. This is the console report


sudo gem install digest-sha3
Building native extensions. This could take a while...
ERROR: Error installing digest-sha3:
ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/digest-sha3-1.1.0/ext/digest

/usr/bin/ruby2.3 -r ./siteconf20170620-36620-a9fw36.rb extconf.rb
checking for ruby/digest.h... yes
checking for rb_str_set_len()... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/digest-sha3-1.1.0/mkmf.log

current directory: /var/lib/gems/2.3.0/gems/digest-sha3-1.1.0/ext/digest
make "DESTDIR=" clean

current directory: /var/lib/gems/2.3.0/gems/digest-sha3-1.1.0/ext/digest
make "DESTDIR="
compiling KeccakF-1600-reference.c
compiling KeccakNISTInterface.c
compiling KeccakSponge.c
compiling displayIntermediateValues.c
displayIntermediateValues.c: In function ‘displayText’:
displayIntermediateValues.c:113:9: error: format not a string literal and no format arguments [-Werror=format-security]
fprintf(intermediateValueFile, text);
^
cc1: some warnings being treated as errors
Makefile:239: recipe for target 'displayIntermediateValues.o' failed
make: *** [displayIntermediateValues.o] Error 1

make failed, exit code 2

It seems the command fprintf(intermediateValueFile, text); in intermediateValues.c does not precise the type of text variable thus raises a warning and stops the compiler (Ubuntu has not been compiling with such warning since some recent update).

Would simply remplace fprintf(intermediateValueFile, "%s", text) fix the issue ?

@Eugenpaul
Copy link

@lmX2015 Hello
I'm currently facing the same issue. Have you been able to resolve it?

@se3000
Copy link

se3000 commented Oct 24, 2017

@lmX2015 have you tested your proposed fix?

@jezhiggins
Copy link

Hi, I hit this error today and confirm @lmX2015's fix is correct.

I pulled down the gem, unpacked it all, applied the fix, repacked the gem, and then installed that. Everything went through, and all appears to be working correctly.

@jezhiggins
Copy link

I was going to bash together a pull request, but somebody's already done it - PR 8
#8
has this fix.

izetex pushed a commit to izetex/digest-sha3-ruby that referenced this issue Dec 6, 2017
@xorgnak
Copy link

xorgnak commented Dec 6, 2017

same error.

@alex-kampa
Copy link

alex-kampa commented Feb 26, 2018

Added this to my Gemfile and it worked on ubuntu:

git "https://github.com/izetex/digest-sha3-ruby" do
gem 'digest-sha3'
end

Thanks @izetex !

@mtomov
Copy link

mtomov commented Mar 14, 2018

Thank you @alex-kampa !

@hardywu
Copy link

hardywu commented Jan 6, 2019

bundle config build.digest-sha3 --with-cflags="-Wno-format-security"

before bundle install

@nbsamar
Copy link

nbsamar commented Nov 22, 2021

If @hardywu answer did not work, and you still face cc1 (tigerlake) error, try updating gcc and g++
sudo apt install gcc-10 g++-10

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10

sudo update-alternatives --config gcc

@q9f
Copy link

q9f commented Nov 23, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants