Writing code for a Mac using Lazarus - windows

I have done a little work on lazarus' free pascal. So when a client asked me to write an application for a mac, after the initial, "it can't be done" stage. (followed by an asp.net maybe stage) i thought about writing it using lazarus.
Question is. I have only a virtual machine running mac OSX, this means that i do not really want to develop on the mac. However, i just cannot seem to get the applications that i have written in lazarus on windows to work on the mac. I have tried the deployment using the Lazarus Wiki and the MACOS folder is empty and so when i put it on the mac it doesn't run the application.
What is the best way of doing this or am i barking up the wrong tree?

It seems you want to do cross-compiling, which is theoretically possible, but may not be practical, for the reasons mentioned by Marco above.
As an alternative, you could install XCode, FreePascal, and Lazarus on a MacOX machine. You could still do your development and some testing on Windows/Linux. When you hit a certain milestone, you can copy your source code to the Mac and compile your application to test and give to the user.
Even if it were possible to easily cross-compile, there some minor differences between platforms, so (especially if it's a GUI app), you would want to test it on an actual MacOS box before giving it to the client.

I've taken the route described by Noah - and I was incredibly surprised that after about three weeks development on Windows, it took about 10 minutes to get the application running on the Mac.
My route was to install Xcode 4.3 on an old Mac Mini running snow leopard, then install Lazarus using the fink version as described here. This took a while but was done in an evening.
Then I just copied my folder across to the Mac, opened the lpi on the Mac, compiled it. It failed so I removed a windows references, recompiled, and it was working. I was truly amazed.

What linker and assembler do you use to generate binaries? To my best knowledge the linker for recent OS X versions is not available in source.
Afaik what you want (crosscompiling to Mac) is not possible for recent versions (and I've done it for PowerPC myself in the past).
The easiest is to use the Unix "file" command on the binary to see what is generated, and make sure it reads something with "MachO" in it. Easiest is if you have a Linux install (where this command is pretty standard), but versions can be found for windows too (cygwin, mingw and 3rd party)

Related

Creating a cross-compiler environment to build package binaries

I have the feeling that this would involve major nitty-gritty-details-stuff, nevertheless I'd like to give it a try:
Actual question
What do I need to do to set up an cross-compiler environment that allows me to build package binaries for platforms other than MS Windows (I guess at the moment this would only be Mac OS's tgz binaries) on MS Windows? The accepted answer in this post suggested that this is possible.
Background
I have quite a few mac users in my university's beginners R course that don't really know their way around the system specifics of Mac OS and therefore would be overextended with setting up the necessary development tools it takes to compile from source on Mac OS. Therefore, I'd like to offer them a tgz binary, but I need to compile on Windows as there's no apple hardware available to me.

How can I create an installation package for a Mac OS application without having a Mac?

I have a C# application that works great in Linux and Windows. Now I want to make an installation package for the Mac OS but I don't have anything running it in order to develop it / test it. The software is open source, so I don't want to put money into buying yet another laptop just to test it.
Is there a way to create some kind of installer / package for this C# application without actually needing to have a Mac? I even made a .deb package for Linux. Isn't it possible to somehow convert it?
It depends on how fancy you want to get with the installer. I'd start with something simple like building a package for Homebrew.
That's all command-line, though. If you think your Mac users would be unhappy installing an running from the command-line, you'll have to look into more sophisticated solutions. Mac GUI applications are traditionally built into .app bundles. Unfortunately for you, C# does not have lots of support for cross-compiling to the Mac. It's possible, but it's going to take a lot of trial and error, which will be way more frustrating without a test machine to see if you're doing it right.
You might try CPack (part of CMake). CMake doesn't really do C# (otherwise it'd be perfect for you), but you may be able to point CPack at the completed binaries and get it to bundle them up for the Mac for you. You could also use CMake/CPack to build a dummy Mac application and then you'd be able to swap out all the pieces for your own binaries.

Mac compiler on windows

Is it possible to develop cross-platform application on Windows and can also compile for Mac OS X from Windows? I have checked Qt but that requires one to compile from Mac using Xcode.
If this is your priority then one option would be Java as at least a jar file built on one platform can be run on another.
If however you're talking about C or C++...
If you are creating a small command line tool then you might be able to make this work with gcc and a cross compiler, but I think it would be a lot of work.
If however you are wanting to create a GUI application I would urge you to give up now. There are so many issues - you'd have to use Carbon or Cocoa APIs which you can't build for on any other platform, you'd have to link against frameworks which won't exist on your compilation host, you won't be able to easily generate .plist files. Qt won't help as you need to be able to build it, which relies on these same frameworks.
In short, there's no alternative to building on an actual mac.
Furthermore, when it comes to fixing bugs, you will absolutely have to do this on a mac (either physical or virtual).
From what I know , in general you do need a mac to make the executable , even for a simple ansi c program you need gcc for mac.
You can create MacPorts Portfile.(If your application is open source)
A MacPorts port is a set of specifications contained in a Portfile
that defines an application, its characteristics, and any files or
special instructions required to install it. This allows you to use a
single command to tell MacPorts to automatically download, compile,
and install applications and libraries.
Take a look at IMCROSS.
IMCROSS is a simple, scripted method of installing cross-compilers and
cross-compiled libraries on a Linux (or possibly other *nix) system,
so that you can develop programs targeted to run on Microsoft Windows
and Mac OS X at the same time and in the same environment as you
develop Linux versions of those programs.
You can certainly do this using Real Studio. It can create Mac OS X applications on Windows without any trouble.
It cross-compiles for Windows, OS X and Linux. And it does it from any platform. It also can create web apps.
Sounds like you should check it out.

compile lanshark on mac

I am trying to compile lanshark for mac, but do not know how to compile on mac. I am guessing that it is possible to compile linux source code on mac. if not how can i get this program to run?
A mac is, under the hood, a BSD 'darwin' box.
Go and take a look at the MacPorts webpage. You'll find lots of interesting information (like where to get a compiler etc ) there.
Another place to go for an apple development environment is apple (xcode) ...
It should be possible to get that to run, but it will be a bit of work. The source may need a small amount of modification, depending on exactly how the protocol works (if they're using raw ethernet, that is done quite differently). Also, the OS X linker (ld) works completely differently to the Linux linker, and so the build system will need a bit of tinkering.
However, the compilers and build utilities are in the XCode bundle on your install disk, or at the download link in the other answer, so install that and give it a go. If you're lucky, just following the Linux instructions will build it.

I have an exe setup file. I want to make it compatible with Mac OS

I have an exe setup file. I want to make it compatible with Mac OS. Is there is any way through which we can convert an EXE to DMG, APP or a Jar?
No, you cant, you need to recompile the application for the target platform.
Nope*.
Moreover, if the contained software is compiled for Windows, it won't work on Mac.
If may work only if it is script-based (like in ruby, python, etc.). But usually, you'll have a proper Mac installation package when it is compatible.
**Exception*: some EXE are extractible archives, but it won't change the incompatibility if it is compiled for Windows.
The simple answer is to install software on a Macintosh OS you must recompile it down to a .dmg file. I jumped on Google and this article Creating a Mac OS X App from a Jar File was the second choice. The default Mac OS Java version was 1.5 for Leopard. Target 1.4+ and you should cover systems from at least Leopard and upwards.
As an aside, this tutorial was recently updated for Snow Leopard and covers the same stuff. Best of luck in getting it ported.
There are different distribution for Mac with have java6 and below version, for java 7 and 8 you need to make another app to run and compatible with
I did it on my way:
Create exe/ setup for your jar.
follow the link ---> winebottler.kronenberg.org
download winebottler(GUI based tool) for your mac type and simply follow this link below
https://www.youtube.com/watch?v=imPGlqEuYBk
No extra burden for you to how.
Note: This will pack your setup in app but app size will increase.

Resources