MATLAB compiler for LINUX - linux

I am looking to compile a .m file (program) from MATLAB to Linux. I have done it on Windows operating system using
mcc -mv FILENAME.m
I see on the MATLAB website that I can use GNU g++.
Does this work in a similar way to the MATLAB compiler by just writing one line of code in MATLAB or do I have to run it in the Linux terminal?
Also, does this compiler tend to have issues regarding getting the desired output?

What you want to do, is called crosscompiling. Here you want from a Windows computer cross compile a Matlab program to a native Linux executable. As of 2009, this was not possible and most likely isn't now either.

Perhaps you might try using Octave for Linux.
Download GNU Octave

Related

compile a fortran code under linux and make it run in windows

I have a simple gfrotran code.
Is it possible to compile it under linux in order to have a executable that runs in windows?
I have read that there are libraries such as "mingw32" for c\c++ here.
Is it possible to have the same thing for fortran, specifically gfortran?
Thnaks

Porting MSVC code to Gcc, alternative to _wfopen() on Linux?

I'm porting Windows MSVC code to Linux gcc.
_wfopen() seems to be a MSVC specific function to open file with name constructed of wchar_t (UTF-8).
Is there an alternative for _wfopen() on Linux?
Is there an alternative which could be used both on Windows and Linux for UTF-8?
What is the best way to solve this problem instead of putting OS specific #ifdefs?

MATLAB - from mexa64 to mexmaci64?

In MATLAB, I have a MEX file ending with .mexa64. That is, it is for Linux 64-bit.
Now, I wish to call the function in my Mac MATLAB, which requires .mexmaci64. How may I do the conversion? Is it possible?
It is impossible to do the conversion without recompilation.
Simply recompile the source code, e.g.,
mex sourceCode.c
It will automatically give you sourceCode.mexmaci64, if you are on OS X.

Compile linux gcc in windows - nvcc in windows

here is an interesting question that, if answered positively, would make cross compiling a whole lot easier.
Since gcc is written in C++, would it be possible to recompile the Linux gcc compiler on Windows MinGW G++ or VSC++ compiler, so that the resulting Windows executable would be able to compile c code to linux programs?
If so, what would be needed to do that?
So to simplify, here is what I want to do.
mingw32-g++ gcc.cpp -o gcc.exe
The command will probably not work because it would probably have been done before if it were that easy. What I ask is if this concept would be even possible.
Edit: thanks and expanding the question to NVCC
fvu was able to answer the question for the gcc compiler (please use the answer button next time), so if you had the same question you can thank him (or her) .
As an extention to the question, would it be possible to edit or recompile nvcc or the things it uses so that nvcc.exe can create a linux program from CUDA C code? I read that the windows variant of nvcc can only use the Visual Studio cl.exe and not MinGW or CygWin.
Is it possible to create linux programs with cl.exe? And if so, could that be used to generate linux programs with nvcc.exe?
Read the chapter on cross compiling in the gcc manual, gcc's architecture makes it quite easy to set up a toolchain where the target is different from the development machine.
I never went the exact route you describe, but I have built toolchains under Windows that target ARM9 embedded Linux machines, works like a charm - using cygwin btw. Look here for a gentle introduction. Also very useful info here.
I am not going to comment on what can be done with respect to nvcc, CUDA is somewhere on my (long) list of stuff to tinker with...
Now, can cl generate Linux binaries? The answer to this question is "sort of" : as long as the target processor is from a processor family that's supported by cl, the object files generated by it should probably not contain anything that would inhibit its execution on Linux, as they'll just contain machine code. That's the theory. However:
as Linux uses another executable format, you will need a Windows-hosted linker that understands Windows style object files (afaik, COFF), and links them together to a Linux style (ELF) executable. I never heard of such a beast, although in theory it could exist
the startup code (a tiny program that wraps around your main function) will also be different and needs to be written
and some more, eg library related issues
So, the practical answer is no, although it might be a nice summer project for a bored student :)

MASM under Linux?

Is there a way that I use MASM under Linux. Even tough NASM is quite popular under Linux, it still differs for some instruction style on code.
Wiki says
The MASM32 EULA does not allow its usage in the development of open source software, and only allows it to be run in Windows operating systems.
so it is a no.
I use DosBox and it does work fine for me.
Details here
You should be able to run MASM under Wine.
MASM dont run with WINE, im running MASM under Virtual Box
Personally I prefer the NASM style, but you can probably run MASM under Wine (or failing that, in a VM). After all it shouldn't need any exotic API calls.
I've been able to run the Win32 NASM binary under Wine on Linux without any problems [long story, no net connection].
If you want to convert Microsoft's OMF binary format to ELF then you should be able to do so using objcopy, but you may need to compile in support for the right object formats.
Run MASM under Wine or see at the wiki that MASM can only run at Windows.
Regards.
An alternative to MASM is UASM.
UASM is a free MASM-compatible assembler based on JWasm.
It works for creating general Linux binaries.
However, shared objects requiring the -fPIC option is not possible with UASM.

Resources