Ask Your Question
1

Running a Sage file

asked 10 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I want to run the following program (DGHV crypto system) using Sage.

https://github.com/coron/fhe

I put all the files into a directory called the-master and ran the following commands. First,

sage: load_attach_path("/Users/my_name/Desktop/fhe-master/")

sage: load("dghv.sage")

But then it gives me the following error.


Compiling /Users/my_name/Desktop/fhe-master/scalprod.spyx... Error compiling cython file: Error compiling /Users/my_name/Desktop/fhe-master/scalprod.spyx: running build running build_ext building '_Users_my_name_Desktop_fhe_master_scalprod_spyx_24' extension gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include/csage -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include/pytho\ n2.7 -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python/si\ te-packages/numpy/core/include -I/Applications/Sage-6.3.app/Contents/Resources/sage/src/sage/ext -I/Applications/Sage-6.3.app/Contents/Resources/sage/src -I/Applications/Sage-6.3.app/Contents/Resources/sage/src/sage/gsl -I/Users/Sudharaka/Desktop/fhe-master -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include/pytho\ n2.7 -c _Users_my_name_Desktop_fhe_master_scalprod_spyx_24.c -o build/temp.macosx-10.7-x86_64-2.7/_Users_my_name_Desktop_fhe_master_sc\ alprod_spyx_24.o -w -O2

In file included from /Applications/Sage-6.3.app/Contents/Resources/sage/local/bin/../lib/gcc/\ x86_64-apple-darwin11.4.2/4.7.3/include-fixed/syslimits.h:7:0, from /Applications/Sage-6.3.app/Contents/Resources/sage/local/bin/../lib/gcc/\ x86_64-apple-darwin11.4.2/4.7.3/include-fixed/limits.h:34, from /Applications/Sage-6.3.app/Contents/Resources/sage/local/include/python2\ .7/Python.h:19, from _Users_my_name_Desktop_fhe_master_scalprod_spyx_24.c:16: /Applications/Sage-6.3.app/Contents/Resources/sage/local/bin/../lib/gcc/\ x86_64-apple-darwin11.4.2/4.7.3/include-fixed/limits.h:169:61: fatal error: limits.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1


Can anybody please prove me some insight on what is going wrong here?

Thank you.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 10 years ago

vdelecroix gravatar image

Hello,

There is an error in the file scalprod.spyx. Edit it and change the line

from libc.stdlib cimport calloc

with

from libc.stdlib cimport calloc, free

Then, I was able to compile the file and run the test.

Vincent

Preview: (hide)
link
0

answered 10 years ago

psedorandom gravatar image

Thanks much for your answer. I edited the file as you suggested but then I get the following error message. It seems to me that the error message says that the limits.h header file is missing. Probably it's not pointing to the correct C header files. I would really appreciate if you can give any suggestions to correct this error.

Compiling /Users/my_name/Desktop/fhe-master/scalprod.spyx... Error compiling cython file: Error compiling /Users/my_name/Desktop/fhe-master/scalprod.spyx: running build running build_ext building '_Users_my_name_Desktop_fhe_master_scalprod_spyx_0' extension creating build creating build/temp.macosx-10.7-x86_64-2.7 gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include/csage -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include/pytho\ n2.7 -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python/si\ te-packages/numpy/core/include -I/Applications/Sage-6.3.app/Contents/Resources/sage/src/sage/ext -I/Applications/Sage-6.3.app/Contents/Resources/sage/src -I/Applications/Sage-6.3.app/Contents/Resources/sage/src/sage/gsl -I/Users/Sudharaka/Desktop/fhe-master -I/Applications/Sage-6.3.app/Contents/Resources/sage/local/include/pytho\ n2.7 -c _Users_my_name_Desktop_fhe_master_scalprod_spyx_0.c -o build/temp.macosx-10.7-x86_64-2.7/_Users_my_name_Desktop_fhe_master_sc\ alprod_spyx_0.o -w -O2

In file included from /Applications/Sage-6.3.app/Contents/Resources/sage/local/bin/../lib/gcc/\ x86_64-apple-darwin11.4.2/4.7.3/include-fixed/syslimits.h:7:0, from /Applications/Sage-6.3.app/Contents/Resources/sage/local/bin/../lib/gcc/\ x86_64-apple-darwin11.4.2/4.7.3/include-fixed/limits.h:34, from /Applications/Sage-6.3.app/Contents/Resources/sage/local/include/python2\ .7/Python.h:19, from _Users_my_name_Desktop_fhe_master_scalprod_spyx_0.c:16: /Applications/Sage-6.3.app/Contents/Resources/sage/local/bin/../lib/gcc/\ x86_64-apple-darwin11.4.2/4.7.3/include-fixed/limits.h:169:61: fatal error: limits.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1

Preview: (hide)
link

Comments

Do not use an answer to ask a new question. It is better to reedit the question itself. To answer your question, I have no idea. How did you install Sage ? Did you compile from source ?

vdelecroix gravatar imagevdelecroix ( 10 years ago )

I am sorry, I don't know much about this forum and this is the first time I am using it. I will reedit the questions in the future. I didn't compile from source. I am using Sage 6.3 on a Mac and I used the Sage.app to instal it. What version of Sage did you use by the way?

psedorandom gravatar imagepsedorandom ( 10 years ago )

The fact that you did not compile from source can possibly be the problem. Did you try to run simpler cython code?

vdelecroix gravatar imagevdelecroix ( 10 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 10 years ago

Seen: 1,293 times

Last updated: Oct 21 '14