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

How can I compile in mac os .a library #4

Open
lingdf opened this issue Apr 9, 2014 · 54 comments
Open

How can I compile in mac os .a library #4

lingdf opened this issue Apr 9, 2014 · 54 comments

Comments

@lingdf
Copy link

lingdf commented Apr 9, 2014

How can I compile in mac os .a library and Which is what I need the source files

@nstoilov
Copy link

nstoilov commented Apr 9, 2014

Hello lingdf,

To build the MIRACL library, please follow the steps from manual.doc:

1.Compile and run config.c on the target processor.

2.Rename the generated file mirdef.tst to mirdef.h

3.If so advised by the config program, extract a suitable mrmuldv.c file from mrmuldv.any (or copy the standard C version mrmuldv.ccc to mrmuldv.c and use this). If it is pure assembly language it may be appropriate to name it mrmuldv.s or mrmuldv.asm.

4.If the fast KCM or Comba methods for modular multiplication were selected (see below), compile and run the mex.c utility on any workstation. Use it to automatically generate either the module mrcomba.c or mrkcm.c. This will require a processor/compiler-specific xxx.mcs file. The compiler must support inline assembly.

5.Make sure that all the MIRACL header files are accessible to the compiler. Typically the flag –I. or /I. allows these headers to be accessed from the current directory.

6.Compile the MIRACL modules listed in the generated file miracl.lst and create a library file, typically miracl.a or miracl.lib. This might be achieved by editing miracl.lst into a suitable batch or make file. On UNIX it might be as simple as:-

gcc –I. –c –O2 mr_.c
ar rc miracl.a mr_.o

7.If using the C++ MIRACL wrapper, compile the required modules, for example zzn.cpp and/or big.cpp etc.

8.Compile and link your application code to any C++ modules it requires and to the MIRACL library.

You can find the manual.doc file here:

https://github.com/CertiVox/MIRACL/blob/master/manual.doc

@gungorbasa
Copy link

I did the same steps but I still get some errors about _asm. Any idea why I am getting this error?? Mac OS X 10.10.

mrmuldv.c:12:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:24:9: error: use of undeclared identifier '_asm'
ASM mov edx,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:34:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:46:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
4 errors generated.

@mcarrickscott
Copy link
Contributor

Hello Gungor,

Unfortunately I know nothing about Macs.

Have a look around line 1422 of miracl.h - it looks like this #define is
active

#define ASM _asm

which should only happen for the Microsoft compiler (??)

So I am assuming you are using the Microsoft C compiler.

If so, then maybe try changing this line to

#define ASM asm

If that fails try __asm, or check your compiler documentation to find out
what keyword the compiler accepts.

On Windows boxes, _asm works fine.

Mike

On Sun, Oct 19, 2014 at 8:37 AM, Güngör notifications@github.com wrote:

I did the same steps but I still get some errors about _asm. Any idea why
I am getting this error?? Mac OS X 10.10.

mrmuldv.c:12:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a

^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:24:9: error: use of undeclared identifier '_asm'
ASM mov edx,DWORD PTR a

^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:34:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a

^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:46:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a

^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
4 errors generated.


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

@gungorbasa
Copy link

Hello,

When I try to compile, it could not find the one header file in the source folder. Probably it was "miracle.h". Then I copied that file from the include folder. That might be the reason for my problem then. By the way, I am definitely not using microsoft compiler. I am using gcc.

@coliban
Copy link

coliban commented Feb 11, 2015

I took the "linux64" compile script on Mac OSX 10.10 and ran it with "bash linux64". That was flawless and no problem, miracle.a was build.

But afterwards, when trying to use it, the gcc (or g++ or clang++, etc.) always complaining about "ld: symbol(s) not found for architecture x86_64"

@mcarrickscott
Copy link
Contributor

More information required. What symbol is not found?

Mike

On Wed, Feb 11, 2015 at 9:28 PM, coliban notifications@github.com wrote:

I took the "linux64" compile script on Mac OSX 10.10 and ran it with "bash
linux64". That was flawless and no problem, miracle.a was build.

But afterwards, when trying to use it, the gcc (or g++ or clang++, etc.)
always complaining about "ld: symbol(s) not found for architecture x86_64"


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

@coliban
Copy link

coliban commented Feb 12, 2015

Thank you, mcarrickscott,

on the mac (Yosemite, 10.10.2) , there has to be set an environment variable:

MACOSX_DEPLOYMENT_TARGET=10.9

and then it is compiling with no problem

@mcarrickscott
Copy link
Contributor

Great!

Mike

On Thu, Feb 12, 2015 at 7:26 PM, coliban notifications@github.com wrote:

Thank you, mcarrickscott,

on the mac (Yosemite, 10.10.2) , there has to be set an environment
variable:

MACOSX_DEPLOYMENT_TARGET=10.9

and then it is compiling with no problem


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

@sumproxy
Copy link

sumproxy commented Jul 2, 2015

I followed the steps in #4 (comment) to compile on 64bit Mac OS X (10.9) but after I run

gcc -I../include -c -O2 mr*.c 

I end up getting errors as shown in gist https://gist.github.com/sumproxy/81cce102c175b8ec1e10#file-output
bash linux64 from CLI doesn't work either

@mcarrickscott
Copy link
Contributor

Show me mirdef.h file that you are using

Mike

On Thursday, July 2, 2015, Sum Proxy notifications@github.com wrote:

I followed the steps in #4 (comment)
#4 (comment) to
compile on 64bit Mac OS X (10.9) but after I run

gcc -I../include -c -O2 mr*.c

I end up getting errors as shown in gist
https://gist.github.com/sumproxy/81cce102c175b8ec1e10#file-output
bash linux64 from CLI doesn't work either


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

"Those who give up essential security to purchase a slightly better user
experience, deserve to get hacked."

@sumproxy
Copy link

sumproxy commented Jul 2, 2015

@mcarrickscott
Copy link
Contributor

That's the header for a 32 bit build.
Also use long long instead of __int64

Mike

On Thu, Jul 2, 2015 at 11:22 AM, Sum Proxy notifications@github.com wrote:

sure:
https://gist.github.com/sumproxy/bb8124eb723600e5bbbb#file-gistfile1-txt


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

"Those who give up essential security to purchase a slightly better user
experience, deserve to get hacked."

@sumproxy
Copy link

sumproxy commented Jul 2, 2015

@sumproxy
Copy link

sumproxy commented Jul 2, 2015

btw thanks for all your help so far

@mcarrickscott
Copy link
Contributor

Just downloaded miracl.zip to a clean directory on my mini-mac, executed "unzip -j -L -aa miracl.zip” and followed that with “bash linux64”. This worked fine and built a 64-bit version of the miracl library - miracl.a

mike https://cvx.slack.com/team/mike[6:54 PM]
Is this what you wanted? It then runs into a problem with the C++ code - there is a well-known bug in the mac port of g++ - but even that could be worked around quite easily.

Mike

On 2 Jul 2015, at 14:57, Sum Proxy notifications@github.com wrote:

btw thanks for all your help so far


Reply to this email directly or view it on GitHub #4 (comment).

@mcarrickscott
Copy link
Contributor

In fact the C++ work-around is quite simple. Substitute the attached files for a clean "bash linux64" build

Mike

On 2 Jul 2015, at 18:57, Michael Scott mike.scott@certivox.com wrote:

Just downloaded miracl.zip to a clean directory on my mini-mac, executed "unzip -j -L -aa miracl.zip” and followed that with “bash linux64”. This worked fine and built a 64-bit version of the miracl library - miracl.a

mike https://cvx.slack.com/team/mike[6:54 PM]
Is this what you wanted? It then runs into a problem with the C++ code - there is a well-known bug in the mac port of g++ - but even that could be worked around quite easily.

Mike

On 2 Jul 2015, at 14:57, Sum Proxy <notifications@github.com mailto:notifications@github.com> wrote:

btw thanks for all your help so far


Reply to this email directly or view it on GitHub #4 (comment).

@sumproxy
Copy link

sumproxy commented Jul 3, 2015

I followed the instructions in linux.txt but still got errors: https://gist.github.com/sumproxy/3e34e60395c3b87a124c#file-gistfile1-txt
I used bash linux64 to build it

@mcarrickscott
Copy link
Contributor

You didn't substitute the files big.h big.cpp zzn.h and zzn.cpp that I sent
you(?) So I am not surprised you got errors.

These files have the work-around for the gcc issue on macs

Mike

On Fri, Jul 3, 2015 at 10:41 AM, Sum Proxy notifications@github.com wrote:

I followed the instructions in linux.txt but still got errors:
https://gist.github.com/sumproxy/3e34e60395c3b87a124c#file-gistfile1-txt


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

"Those who give up essential security to purchase a slightly better user
experience, deserve to get hacked."

@sumproxy
Copy link

sumproxy commented Jul 3, 2015

It's funny but I don't get confirmation email from certivox.com, tried a number of times

@mcarrickscott
Copy link
Contributor

I don't understand..

Mike

On Fri, Jul 3, 2015 at 11:09 AM, Sum Proxy notifications@github.com wrote:

It's funny but I don't get confirmation email from certivox.com, tried a
number of times


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

"Those who give up essential security to purchase a slightly better user
experience, deserve to get hacked."

@sumproxy
Copy link

sumproxy commented Jul 3, 2015

You mean this https://cvx.slack.com/team/mike?
can't access without registration, which doesn't send a confirmation letter

@sumproxy
Copy link

sumproxy commented Jul 3, 2015

I was trying to register a certivox account, which probably not where the files you sent are. Can't figure out where I can find them. Sorry for the confusion. Can't find the files in github either

@mcarrickscott
Copy link
Contributor

You tell me where to send them…

Mike

On 3 Jul 2015, at 11:36, Sum Proxy notifications@github.com wrote:

I was trying to register a certivox account, which probably not where the files you sent are. Can't figure out where I can find them


Reply to this email directly or view it on GitHub #4 (comment).

@sumproxy
Copy link

sumproxy commented Jul 3, 2015

sure: sumproxy(at)gmail(dot)com

@lesyk
Copy link

lesyk commented Aug 6, 2015

hej,

mac

on stage of running
gcc -I../include -c -O2 mr*.c
getting "same" errors: https://gist.github.com/lesyk/1f10497a7fe2cbe5db4b
my mirdef.h is: https://gist.github.com/lesyk/1365919137c55ff1d5e9

linux64

bash linux64
produces same errors, as @sumproxy wrote about

@mcarrickscott, is not quite clear about life saving files? May you please write something in README, clarify in discussion?

@mcarrickscott
Copy link
Contributor

I think the attached files fixed the problem.

In gcc on a mac a member function in for example big.h like

friend int to_binary(const Big& b,int max,char *ptr,BOOL justify=FALSE)

{ return big_to_bytes(max,b.fn,ptr,justify);}

which has a default parameter ("justify=FALSE") must be be inlined like this

So do a clean download of MIRACL, and substitute these files, then do bash
linux64

Mike

On Thu, Aug 6, 2015 at 2:11 PM, lesyk notifications@github.com wrote:

hej,
mac

on stage of running
gcc -I../include -c -O2 mr*.c
getting "same" errors: https://gist.github.com/lesyk/1f10497a7fe2cbe5db4b
my mirdef.h is: https://gist.github.com/lesyk/1365919137c55ff1d5e9
linux64

bash linux64
produces same errors, as @sumproxy https://github.com/sumproxy wrote
about

@mcarrickscott https://github.com/mcarrickscott, is not quite clear
about life saving files? May you please write something in README, clarify
in discussion?


Reply to this email directly or view it on GitHub
#4 (comment).

Michael Scott
Chief Cryptographer
CertiVox Ltd
Tel (353) 86 3888746

"Those who give up essential security to purchase a slightly better user
experience, deserve to get hacked." (with apologies to Benjamin Franklin)

@lesyk
Copy link

lesyk commented Aug 6, 2015

@mcarrickscott, @sumproxy thx!

@RobTrifiletti
Copy link

@mcarrickscott I'm currently also having trouble building MIRACL on OSX. I tried going to https://cvx.slack.com/team/mike , but I cannot create an account to access these files on this site. Could you possibly make these available somewhere public?
This is greatly appreciated, thank you in advance!

@mcarrickscott
Copy link
Contributor

Can you give me more details of the problems you are having?

Installing MIRACL on OSX should just be a matter of

unzip -j -L -aa miracl.zip

followed by

bash linux64

There is also a known problem with the mac port of g++ involving friend
declarations in big.h and zzn.h

If this is your problem, try substituting the attached files

Mike

On Sat, Jan 23, 2016 at 8:53 PM, RobTrifiletti notifications@github.com
wrote:

@mcarrickscott https://github.com/mcarrickscott I'm currently also
having trouble building MIRACL on OSX. I tried going to
https://cvx.slack.com/team/mike , but I cannot create an account to
access these files on this site. Could you possibly make these available
somewhere public?
This is greatly appreciated, thank you in advance!


Reply to this email directly or view it on GitHub
#4 (comment).

@RobTrifiletti
Copy link

Dear Mike,
Yes, my problem is the friend declarations. You say I should substitute the attached files. I might be foolish here, but I dont see any attached files in this thread. I thought you meant at https://cvx.slack.com/team/mike, but as I said before I cannot access this area.
Thanks!

@mcarrickscott
Copy link
Contributor

I did attach the files to my email, but it seems they didn't get through to
you.

Give me an email address and I will send them directly to you. The changes
are minimal. Rather than

friend void foo() {}

in big .h (which should work - in-lining functions like this is OK)

change to

friend void foo();

and insert

void foo() {}

into big.cpp

Mike

On Mon, Jan 25, 2016 at 3:02 PM, RobTrifiletti notifications@github.com
wrote:

Dear Mike,
Yes, my problem is the friend declarations. You say I should substitute
the attached files. I might be foolish here, but I dont see any attached
files in this thread. I thought you meant at
https://cvx.slack.com/team/mike, but as I said before I cannot access
this area.
Thanks!


Reply to this email directly or view it on GitHub
#4 (comment).

@RobTrifiletti
Copy link

I see. I would greatly appreciate if you could send me the modified files though.
I sent an email already :)

Thank you for your help!

On 25 Jan 2016, at 16:08, Michael Scott notifications@github.com wrote:

I did attach the files to my email, but it seems they didn't get through to
you.

Give me an email address and I will send them directly to you. The changes
are minimal. Rather than

friend void foo() {}

in big .h (which should work - in-lining functions like this is OK)

change to

friend void foo();

and insert

void foo() {}

into big.cpp

Mike

On Mon, Jan 25, 2016 at 3:02 PM, RobTrifiletti notifications@github.com
wrote:

Dear Mike,
Yes, my problem is the friend declarations. You say I should substitute
the attached files. I might be foolish here, but I dont see any attached
files in this thread. I thought you meant at
https://cvx.slack.com/team/mike, but as I said before I cannot access
this area.
Thanks!


Reply to this email directly or view it on GitHub
#4 (comment).


Reply to this email directly or view it on GitHub #4 (comment).

@Otrshen
Copy link

Otrshen commented Jun 21, 2016

@mcarrickscott

I tried to build Miracl on Mac 10.11.3 recently and also met the same friend declarations problems as RobTrifiletti

I will appreciate if you could send me those modified files by email.

My email is iosdev@eetrust.com

@coliban
Copy link

coliban commented Jun 21, 2016

Long time. When I am home I will see what I will find and send it.

Mit freundlichen Grüßen

Am 21.06.2016 um 08:26 schrieb LarkNan notifications@github.com:

@mcarrickscott

I tried to build Miracl on Mac 10.11.3 recently and also met the same friend declarations problems as RobTrifiletti

I will appreciate if you could send me those modified files by email.

My email is iosdev@eetrust.com


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@mcarrickscott
Copy link
Contributor

Here they are..

Mike

On Tue, Jun 21, 2016 at 7:26 AM, LarkNan notifications@github.com wrote:

@mcarrickscott https://github.com/mcarrickscott

I tried to build Miracl on Mac 10.11.3 recently and also met the same
friend declarations problems as RobTrifiletti

I will appreciate if you could send me those modified files by email.

My email is iosdev@eetrust.com


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#4 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ACm8jvR6ZykmCzNh3XjXJtqe4f45xx57ks5qN4QhgaJpZM4Bw147
.

@Otrshen
Copy link

Otrshen commented Jun 21, 2016

@mcarrickscott
I couldn't find those modified files in this thread.
Could you please send them to my mailbox? thanks a lot!

@Otrshen
Copy link

Otrshen commented Jun 22, 2016

@mcarrickscott @coliban
Ok, I received the mail,thank you.

@cygnusv
Copy link

cygnusv commented Feb 3, 2017

Hi, I just created a patch file that solves the compilation issue:

https://gist.github.com/cygnusv/a1710ed5c1e74ac77ea0643266f0a15f

@HLin00
Copy link

HLin00 commented Mar 9, 2017

@mcarrickscott
Would you please also send me the modified files since I am also trying to compile the Miracl library on Mac? Thanks a lot. My email is linhuangsame@gmail.com. Thank you in advance.

@mcarrickscott
Copy link
Contributor

mcarrickscott commented Mar 9, 2017 via email

@HLin00
Copy link

HLin00 commented Mar 9, 2017 via email

@npj008
Copy link

npj008 commented Mar 31, 2017

@mcarrickscott Can you please send me files which I need to replace, to solve friend function error in OSX?

My mail id is
joshinikunj008 at gmail dot com

Thanks.

@Atbnsanw
Copy link

I did attach the files to my email, but it seems they didn't get through to
you.

Give me an email address and I will send them directly to you. The changes
are minimal. Rather than

friend void foo() {}

in big .h (which should work - in-lining functions like this is OK)

change to

friend void foo();

and insert

void foo() {}

into big.cpp

Mike

On Mon, Jan 25, 2016 at 3:02 PM, RobTrifiletti notifications@github.com
wrote:

Dear Mike,
Yes, my problem is the friend declarations. You say I should substitute
the attached files. I might be foolish here, but I dont see any attached
files in this thread. I thought you meant at
https://cvx.slack.com/team/mike, but as I said before I cannot access
this area.
Thanks!

Reply to this email directly or view it on GitHub
#4 (comment).

Dear Michael Scott
I have installed Miracl and I can linked it by gcc command ,but I can't use it in Xcode.Xcode always says "Conflicting types for 'instr'". It happens in miracl.h,"extern int instr(MIPT flash,char *);",this line.I don't know how to deal it.Would you please help me?

@mcarrickscott
Copy link
Contributor

mcarrickscott commented Nov 14, 2018 via email

@Atbnsanw
Copy link

Sorry, just not enough information there to enable me to help. For example which parameter is causing the conflict? And what is the declaration in miracl.h conflicting with? Mike

On Wed, Nov 14, 2018 at 10:45 AM Atbnsanw @.> wrote: I did attach the files to my email, but it seems they didn't get through to you. Give me an email address and I will send them directly to you. The changes are minimal. Rather than friend void foo() {} in big .h (which should work - in-lining functions like this is OK) change to friend void foo(); and insert void foo() {} into big.cpp Mike On Mon, Jan 25, 2016 at 3:02 PM, RobTrifiletti @. wrote: Dear Mike, Yes, my problem is the friend declarations. You say I should substitute the attached files. I might be foolish here, but I dont see any attached files in this thread. I thought you meant at https://cvx.slack.com/team/mike, but as I said before I cannot access this area. Thanks! — Reply to this email directly or view it on GitHub #4 (comment) <#4 (comment)>. Dear Michael Scott I have installed Miracl and I can linked it by gcc command ,but I can't use it in Xcode.Xcode always says "Conflicting types for 'instr'". It happens in miracl.h,"extern int instr(MIPT flash,char *);",this line.I don't know how to deal it.Would you please help me? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ACm8jpopQ0XgmDuZgPslkQylR4mkKU3dks5uu_RUgaJpZM4Bw147 .

This:
image
image
And all files in folder are:
image
And I can use command:"gcc -o main main.c -I.. libmiracl.a ",compilie successfully.

@Atbnsanw
Copy link

Sorry, just not enough information there to enable me to help. For example which parameter is causing the conflict? And what is the declaration in miracl.h conflicting with? Mike

My miracl.h:https://github.com/Atbnsanw/error_miracl_headfile/blob/master/error_miracl_headfile.
Thank you very much.

@mcarrickscott
Copy link
Contributor

mcarrickscott commented Nov 14, 2018 via email

@Atbnsanw
Copy link

Since miracl.h already includes mirdef.h, try removing line 3 #include "mirdef.h" from main.c It is not needed. Mike

I tried, and still failed.
image
image
This two place all announced "instr" function. Should I change one of them?

@mcarrickscott
Copy link
Contributor

mcarrickscott commented Nov 14, 2018 via email

@Atbnsanw
Copy link

Ah, OK. That's always a potential problem with C - a function name clash with another library. I suggest that you edit ALL of the miracl library files and replace instr(..) everywhere with (for example) mr_instr(..) That should fix it. Mike

Thanks for your help, now I have fixed it.This function appears only once in ‘miracl.h'.Now I can use Miracl properly.Thank you very much.

@Atbnsanw
Copy link

Ah, OK. That's always a potential problem with C - a function name clash with another library. I suggest that you edit ALL of the miracl library files and replace instr(..) everywhere with (for example) mr_instr(..) That should fix it. Mike

Hello Mike,
I meet a new problem and I spent the whole day trying to solve it,but i failed. Will you do me a favour?
When i use epoint_set() funcition ,first time it runs normally, then runs some other code , then when I call this function for the second time, the error appears:
" MIRACL error from routine nres
called from epoint_set
called from your program
No modulus defined"
I looked it up in the manual, and it said so:
" Message: No modulus defined
Diagnosis: No modulus has been specified, yet a function which needs it has been called.
Response: Set a modulus for use internally "
I don't know how to set this function right,because first time this function can work normally.
I would appreciate it very much if you could help me

@mcarrickscott
Copy link
Contributor

mcarrickscott commented Dec 21, 2018 via email

@Atbnsanw
Copy link

Hello, Not really enough details, but I suspect the problem arises because of the "runs some other code". MIRACL is not natively multi-threaded, and by default curve constants such as the modulus are stored as elements of the single global instance of the miracl structure defined in miracl.h. The single instance of this structure is pointed to be mr_mip. Basically when you "run some other code" I suspect that the value of mr_mip has been forgotten, or gone out of scope. Maybe you could copy it and restore it after running the "other code"? Or maybe you could just re-initialise the miracl code after the "other code"? Mike

Thank you very much for taking the time to help me.I add extra mirsys() functions to solve the problem. I use mirsys() in a separate function ,and perhaps this is the cause of the problem.My understanding is when i use mirsys in a separate function, it will overwrite the original settings, and after the separate function ended, all miracl setting and memory space are also released? So i have to add extra mirsys() functions every time after using mirsys() in a separate function.

@Cynthia-777
Copy link

Hello,dear friends.
I also did the same steps but I met a lot of mistakes in step 6.Any idea why I am getting this error?? Mac OS X 10.15.

mrarth1.c:56:10: fatal error: 'ieeefp.h' file not found
#include <ieeefp.h>
^~~~~~~~~~
1 error generated.
mrecn2.c:2114:6: error: conflicting types for 'ecn2_setxyz'
void ecn2_setxyz(zzn2 *x,zzn2 *y,zzn2 *z,ecn2 *e)
^
./include/miracl.h:1311:13: note: previous declaration is here
extern void ecn2_setxyz(MIPT zzn2 *,zzn2 *,zzn2 *,ecn2 *);
^
1 error generated.
mrkcm.c:150:3: error: use of undeclared identifier 'extra'
extra=0;
^
mrkcm.c:151:3: error: use of undeclared identifier 'sum'
sum=0;
^
mrkcm.c:152:3: error: use of undeclared identifier 'pp1'
pp1=(mr_large)a[0]*b[0];
^
mrkcm.c:153:3: error: use of undeclared identifier 'sum'
sum+=pp1;
^
mrkcm.c:153:8: error: use of undeclared identifier 'pp1'
sum+=pp1;
^
mrkcm.c:154:3: error: use of undeclared identifier 'extra'
extra+=(sum<pp1);
^
mrkcm.c:154:11: error: use of undeclared identifier 'sum'
extra+=(sum<pp1);
^
mrkcm.c:154:15: error: use of undeclared identifier 'pp1'
extra+=(sum<pp1);
^
mrkcm.c:155:18: error: use of undeclared identifier 'sum'
c[0]=(mr_small)sum;
^
mrkcm.c:156:3: error: use of undeclared identifier 'sum'
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^
mrkcm.c:156:8: error: use of undeclared identifier 'sum'
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^
mrkcm.c:156:32: error: use of undeclared identifier 'extra'; did you mean
'extern'?
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^~~~~
extern
mrkcm.c:156:32: error: expected expression
mrkcm.c:157:3: error: use of undeclared identifier 'extra'
extra=0;
^
mrkcm.c:158:3: error: use of undeclared identifier 'pp1'
pp1=(mr_large)a[0]*b[1];
^
mrkcm.c:159:3: error: use of undeclared identifier 'pp2'
pp2=(mr_large)a[1]*b[0];
^
mrkcm.c:160:3: error: use of undeclared identifier 'sum'
sum+=pp1;
^
mrkcm.c:160:8: error: use of undeclared identifier 'pp1'
sum+=pp1;
^
mrkcm.c:161:3: error: use of undeclared identifier 'extra'
extra+=(sum<pp1);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
mrmonty.c:145:20: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'int')
if (n->w[n->len-1]>>M4 < 5) mr_mip->NO_CARRY=TRUE;
~~~~~~~~~~~~~~^ ~~
1 error generated.
mrmuldv.c:12:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:24:9: error: use of undeclared identifier '_asm'
ASM mov edx,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:34:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:46:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
4 errors generated.
mrstrong.c:164:11: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'int')
r = (r << 8) ^ ran;
~ ^ ~
mrstrong.c:167:49: error: implicitly declaring library function 'modf' with type
'double (double, double *)' [-Werror,-Wimplicit-function-declaration]
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:27: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
mrstrong.c:167:49: note: include the header <math.h> or explicitly provide a
declaration for 'modf'
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:27: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
mrstrong.c:167:49: error: use of undeclared identifier 'dres'; did you mean
'nres'?
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:41: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
./include/miracl.h:1029:14: note: 'nres' declared here
extern void nres(MIPT big,big);
^
mrstrong.c:167:49: error: use of undeclared identifier 'dres'; did you mean
'nres'?
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)MR_DIV((a),(b)))
^
./include/miracl.h:264:47: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
./include/miracl.h:1029:14: note: 'nres' declared here
extern void nres(MIPT big,big);
^
mrstrong.c:167:49: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'void (
)(miracl , big, big)' (aka 'void ()(miracl *,
struct bigtype *, struct bigtype *)'))
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/miracl.h:275:34: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)MR_DIV((a),(b)))
~~~^~~~~~~~~~~~~~~~
5 errors generated.
yujiarui@yujiaruideMacBook-Air miracl_list % gcc -I ./include -c -O2 mr
.c
mrarth1.c:56:10: fatal error: 'ieeefp.h' file not found
#include <ieeefp.h>
^~~~~~~~~~
1 error generated.
mrecn2.c:2114:6: error: conflicting types for 'ecn2_setxyz'
void ecn2_setxyz(zzn2 *x,zzn2 *y,zzn2 *z,ecn2 *e)
^
./include/miracl.h:1311:13: note: previous declaration is here
extern void ecn2_setxyz(MIPT zzn2 *,zzn2 *,zzn2 *,ecn2 *);
^
1 error generated.
mrkcm.c:150:3: error: use of undeclared identifier 'extra'
extra=0;
^
mrkcm.c:151:3: error: use of undeclared identifier 'sum'
sum=0;
^
mrkcm.c:152:3: error: use of undeclared identifier 'pp1'
pp1=(mr_large)a[0]*b[0];
^
mrkcm.c:153:3: error: use of undeclared identifier 'sum'
sum+=pp1;
^
mrkcm.c:153:8: error: use of undeclared identifier 'pp1'
sum+=pp1;
^
mrkcm.c:154:3: error: use of undeclared identifier 'extra'
extra+=(sum<pp1);
^
mrkcm.c:154:11: error: use of undeclared identifier 'sum'
extra+=(sum<pp1);
^
mrkcm.c:154:15: error: use of undeclared identifier 'pp1'
extra+=(sum<pp1);
^
mrkcm.c:155:18: error: use of undeclared identifier 'sum'
c[0]=(mr_small)sum;
^
mrkcm.c:156:3: error: use of undeclared identifier 'sum'
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^
mrkcm.c:156:8: error: use of undeclared identifier 'sum'
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^
mrkcm.c:156:32: error: use of undeclared identifier 'extra'; did you mean
'extern'?
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^~~~~
extern
mrkcm.c:156:32: error: expected expression
mrkcm.c:157:3: error: use of undeclared identifier 'extra'
extra=0;
^
mrkcm.c:158:3: error: use of undeclared identifier 'pp1'
pp1=(mr_large)a[0]*b[1];
^
mrkcm.c:159:3: error: use of undeclared identifier 'pp2'
pp2=(mr_large)a[1]*b[0];
^
mrkcm.c:160:3: error: use of undeclared identifier 'sum'
sum+=pp1;
^
mrkcm.c:160:8: error: use of undeclared identifier 'pp1'
sum+=pp1;
^
mrkcm.c:161:3: error: use of undeclared identifier 'extra'
extra+=(sum<pp1);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
mrmonty.c:145:20: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'int')
if (n->w[n->len-1]>>M4 < 5) mr_mip->NO_CARRY=TRUE;
~~~~~~~~~~~~~~^ ~~
1 error generated.
mrstrong.c:164:11: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'int')
r = (r << 8) ^ ran;
~ ^ ~
mrstrong.c:167:49: error: implicitly declaring library function 'modf' with type
'double (double, double *)' [-Werror,-Wimplicit-function-declaration]
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:27: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
mrstrong.c:167:49: note: include the header <math.h> or explicitly provide a
declaration for 'modf'
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:27: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
mrstrong.c:167:49: error: use of undeclared identifier 'dres'; did you mean
'nres'?
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:41: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
./include/miracl.h:1029:14: note: 'nres' declared here
extern void nres(MIPT big,big);
^
mrstrong.c:167:49: error: use of undeclared identifier 'dres'; did you mean
'nres'?
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)MR_DIV((a),(b)))
^
./include/miracl.h:264:47: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
./include/miracl.h:1029:14: note: 'nres' declared here
extern void nres(MIPT big,big);
^
mrstrong.c:167:49: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'void (
)(miracl , big, big)' (aka 'void ()(miracl *,
struct bigtype *, struct bigtype *)'))
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/miracl.h:275:34: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)MR_DIV((a),(b)))
~~~^~~~~~~~~~~~~~~~
5 errors generated.
yujiarui@yujiaruideMacBook-Air miracl_list % gcc -I ./include -c -O2 mr
.c
mrarth1.c:56:10: fatal error: 'ieeefp.h' file not found
#include <ieeefp.h>
^~~~~~~~~~
1 error generated.
mrecn2.c:2114:6: error: conflicting types for 'ecn2_setxyz'
void ecn2_setxyz(zzn2 *x,zzn2 *y,zzn2 *z,ecn2 *e)
^
./include/miracl.h:1311:13: note: previous declaration is here
extern void ecn2_setxyz(MIPT zzn2 *,zzn2 *,zzn2 *,ecn2 *);
^
1 error generated.
mrkcm.c:150:3: error: use of undeclared identifier 'extra'
extra=0;
^
mrkcm.c:151:3: error: use of undeclared identifier 'sum'
sum=0;
^
mrkcm.c:152:3: error: use of undeclared identifier 'pp1'
pp1=(mr_large)a[0]*b[0];
^
mrkcm.c:153:3: error: use of undeclared identifier 'sum'
sum+=pp1;
^
mrkcm.c:153:8: error: use of undeclared identifier 'pp1'
sum+=pp1;
^
mrkcm.c:154:3: error: use of undeclared identifier 'extra'
extra+=(sum<pp1);
^
mrkcm.c:154:11: error: use of undeclared identifier 'sum'
extra+=(sum<pp1);
^
mrkcm.c:154:15: error: use of undeclared identifier 'pp1'
extra+=(sum<pp1);
^
mrkcm.c:155:18: error: use of undeclared identifier 'sum'
c[0]=(mr_small)sum;
^
mrkcm.c:156:3: error: use of undeclared identifier 'sum'
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^
mrkcm.c:156:8: error: use of undeclared identifier 'sum'
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^
mrkcm.c:156:32: error: use of undeclared identifier 'extra'; did you mean
'extern'?
sum=(sum>>MIRACL)|((mr_large)extra<<MIRACL);
^~~~~
extern
mrkcm.c:156:32: error: expected expression
mrkcm.c:157:3: error: use of undeclared identifier 'extra'
extra=0;
^
mrkcm.c:158:3: error: use of undeclared identifier 'pp1'
pp1=(mr_large)a[0]*b[1];
^
mrkcm.c:159:3: error: use of undeclared identifier 'pp2'
pp2=(mr_large)a[1]*b[0];
^
mrkcm.c:160:3: error: use of undeclared identifier 'sum'
sum+=pp1;
^
mrkcm.c:160:8: error: use of undeclared identifier 'pp1'
sum+=pp1;
^
mrkcm.c:161:3: error: use of undeclared identifier 'extra'
extra+=(sum<pp1);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
mrmonty.c:145:20: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'int')
if (n->w[n->len-1]>>M4 < 5) mr_mip->NO_CARRY=TRUE;
~~~~~~~~~~~~~~^ ~~
1 error generated.
mrmuldv.c:12:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:24:9: error: use of undeclared identifier '_asm'
ASM mov edx,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:34:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
mrmuldv.c:46:9: error: use of undeclared identifier '_asm'
ASM mov eax,DWORD PTR a
^
mrmuldv.c:7:13: note: expanded from macro 'ASM'
#define ASM _asm
^
4 errors generated.
mrstrong.c:164:11: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'int')
r = (r << 8) ^ ran;
~ ^ ~
mrstrong.c:167:49: error: implicitly declaring library function 'modf' with type
'double (double, double *)' [-Werror,-Wimplicit-function-declaration]
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:27: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
mrstrong.c:167:49: note: include the header <math.h> or explicitly provide a
declaration for 'modf'
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:27: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
mrstrong.c:167:49: error: use of undeclared identifier 'dres'; did you mean
'nres'?
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
^
./include/miracl.h:264:41: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
./include/miracl.h:1029:14: note: 'nres' declared here
extern void nres(MIPT big,big);
^
mrstrong.c:167:49: error: use of undeclared identifier 'dres'; did you mean
'nres'?
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^
./include/miracl.h:275:35: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)MR_DIV((a),(b)))
^
./include/miracl.h:264:47: note: expanded from macro 'MR_DIV'
#define MR_DIV(a,b) (modf((a)/(b),&dres),dres)
^
./include/miracl.h:1029:14: note: 'nres' declared here
extern void nres(MIPT big,big);
^
mrstrong.c:167:49: error: invalid operands to binary expression ('mr_small'
(aka 'double') and 'void (
)(miracl , big, big)' (aka 'void ()(miracl *,
struct bigtype *, struct bigtype *)'))
else mr_mip->w1->w[m-1]=MR_REMAIN(r,mr_mip->base);
^~~~~~~~~~~~~~~~~~~~~~~~~
./include/miracl.h:275:34: note: expanded from macro 'MR_REMAIN'
#define MR_REMAIN(a,b) ((a)-(b)*MR_DIV((a),(b)))
~~~^~~~~~~~~~~~~~~~
5 errors generated.

Could you please tell me why I am getting those error?Or could you please let me use your miracl library that you have compiled?Nowadays I have an assignment that required the miracl library. Thank you very much.

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