Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBacterius

Posted 22 December 2013 - 01:18 AM


So, this is not a C++ library but a C library. I believe there is a project setting in visual studio that allows you to 'compile as C'.
 
-Josh

 

Yes, it's /Tc (compared to /Tp for C++). Still, if the library was written in C, designed for GCC, and not written with portability to other compilers in mind, it's likely going to suck big time porting it over to MSVC. More cost-effective to just use mingw IMHO. It takes some setting up but once it works it behaves pretty much the same as if you were on Linux.

 

The bottom line is, C was designed to be portable, but it was determined shortly after that a C program using only the standard libraries was not always very useful. And not everyone ended up using cross-platform libraries to do the stuff not covered by the standard library. And if that is not the case, you are looking at either using an emulation layer (e.g. cygwin or mingw) or at a complete rewrite of all the parts that aren't offered by visual studio.

 

To start with, the assembly files (which are pretty much the heart of the cpuminer project) are a complete non-starter on MSVC. It cannot deal with them. You need to install NASM (or another assembler), convert these assembly files to NASM format (which doesn't look too hard in this situation, though) and then set up a custom build rule in Visual Studio to send those .S files to NASM, otherwise it will just ignore them. Or, of course, you could just use mingw, which handles it out of the box.

 

So overall it's up to you - do you want to jump through the hoops to make the code work using Microsoft's compiler (which may or may not even be possible in a reasonable timescale), or do you prefer to use the recommended and tested compiler and following the instructions on the project's readme file, and asking more specific questions if you get stuck on any of these steps?


#2Bacterius

Posted 22 December 2013 - 01:12 AM


So, this is not a C++ library but a C library. I believe there is a project setting in visual studio that allows you to 'compile as C'.
 
-Josh

 

Yes, it's /Tc (compared to /Tp for C++). Still, if the library was written in C, designed for Linux, and not written with portability in mind, it's likely going to suck big time porting it over to MSVC. More cost-effective to just use mingw IMHO. It takes some setting up but once it works it behaves pretty much the same as if you were on Linux.

 

The bottom line is, C was designed to be portable, but it was determined shortly after that a C program using only the standard libraries was not always very useful. And not everyone ended up using cross-platform libraries to do the stuff not covered by the standard library. And if that is not the case, you are looking at either using an emulation layer (e.g. cygwin or mingw) or at a complete rewrite of all the parts that aren't offered by visual studio.

 

To start with, the assembly files (which are pretty much the heart of the cpuminer project) are a complete non-starter on MSVC. It cannot deal with them. You need to install NASM (or another assembler), convert these assembly files to NASM format (which doesn't look too hard in this situation, though) and then set up a custom build rule in Visual Studio to send those .S files to NASM, otherwise it will just ignore them. Or, of course, you could just use mingw, which handles it out of the box.

 

So overall it's up to you - do you want to jump through the hoops to make the code work using Microsoft's compiler (which may or may not even be possible in a reasonable timescale), or do you prefer to use the recommended and tested compiler and following the instructions on the project's readme file, and asking more specific questions if you get stuck on any of these steps?


#1Bacterius

Posted 22 December 2013 - 01:11 AM


So, this is not a C++ library but a C library. I believe there is a project setting in visual studio that allows you to 'compile as C'.
 
-Josh

 

Yes, it's /Tc (compared to /Tp for C++). Still, if the library was written in C, designed for Linux, and not written with portability in mind, it's likely going to suck big time porting it over to MSVC. More cost-effective to just use mingw IMHO. It takes some setting up but once it works it behaves pretty much the same as if you were on Linux.

 

The bottom line is, C was designed to be portable, but it was determined shortly after that a C program using only the standard libraries was not always very useful. And not everyone ended up using cross-platform libraries to do the stuff not covered by the standard library. And if that is not the case, you are looking at either using an emulation layer (e.g. cygwin or mingw) or at a complete rewrite of all the parts that aren't offered by visual studio.

 

To start with, the assembly files (which are pretty much the heart of the cpuminer project) are a complete non-starter on MSVC. It cannot deal with them. You need to install NASM (or another assembler), convert these assembly files to NASM format (which doesn't look too hard in this situation, though) and then set up a custom build rule in Visual Studio to send those .S files to NASM, otherwise it will just ignore them. Or, of course, you could just use mingw, which handles it out of the box.

 

So overall it's up to you - do you want to jump through the hoops to make the code work using Microsoft's compiler (which may or may not even be possible in a reasonable timescale), or do you prefer to use the recommended and tested compiler and following the instructions on the project's readme file, and ask more specific questions if you get stuck on any of these steps?


PARTNERS