I was messing around with sockets, and I wanted to test out using the SCTP protocol on my mac.
However, when I try to include the file netinet/sctp.h the compiler gives me a 'file not found' error.
So I did some digging, and sure enough, there is no include file for netinet/sctp.h on Mac OSX Lion. Why is that, when I can set up a socket with IPPROTO_SCTP, and it builds fine?
So, in summary, I have two questions:
Where are the headers for SCTP on Mac OSX?
Can I still set up a SCTP server without the proper headers? If so, how?
On Lion IPPROTO_SCTP is defined in netinet/in.h - that's why it worked just fine since you probably included netinet/in.h directly or indirectly. However, it is only present in Lion, not in any earlier OS X versions. (Note that netinet/sctp.h is not part of POSIX an I don't think it's portable)
Looks like you could do
brew install libusrsctp
And you will see the installed header here, although it is probably a different implementation with a different name:
cat /usr/local/Cellar/libusrsctp/0.9.5.0/include/usrsctp.h
Related
I am trying to stark work with OpenCl framework on my MacBook, and Mac OS has the framework installed, but there is no needed header cl.hpp I want to work with. I have downloaded the header from Khronos OpenCL Registry, but now I do not know where to paste it since there is no Headers folder in /System/Library/Frameworks/OpenCL.framework/, I've tried to find present headers (cl.h) with find in Terminal, but unsuccessful. What can I do?
Now I fixed the problem, I noticed that cmake finds OpenCL at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenCL.framework. There is folder Headers.
I am in the process of installing SDL 2 on Mac OSX 10.9 via macports, and for reference I have been following the official documentation as well as any sdl-specific information I can find.
https://guide.macports.org/ is straight-forward, as is:
https://guide.macports.org/#using.variants.invoking
I see that sdl2lib is available...
libsdl2 has the variants:
universal: Build for multiple architectures
x11: Enable X11 support
but despite having looked through pages at the above links and having searched for documentation for "SDL with X11", I can't seem to find information about whether I need X11 (and/or universal AKA powerpc) support. I wouldn't want to install SDL only to find that something is broken or missing.
Then again, there were some issues with X11 being enabled by default back when Mac OSX 10.1 was new:
https://forums.libsdl.org/viewtopic.php?t=2871&sid=52ca72a72c285196dd25fd8619715ae9
(That is another problem: much of the information I discover applies to outdated operating systems.)
Apparently SDL wasn't thread-safe at one point unless you used X11, but this was mentioned when SDL verson 1 was the main version:
http://forum.freegamedev.net/viewtopic.php?f=3&t=1078
How am I meant to proceed (Which flags, if any, are usually chosen?)
port install libsdl2 <???>
I would appreciate any help and follow-up warnings for the next stepsinstallation steps.
Thank you in advance.
Most people have moved to Homebrew as their package system, but Macports should work just fine.
Universal does not mean PowerPC necessarily. In fact almost no one needs it anymore. Universal means a fat binary, which architectures this defines is set in your Macports configuration.
SDL2 should work just fine under Quartz, no need to have X11 - as also makes deployment annoying and difficult as you need to have XQuartz installed.
Also don't be afraid to reinstall SDL2 with other options if you miss something, it shouldn't take to long.
TL;DR Just install it without any additional flags unless you discover you need something special.
Where is the file syscall_sw.h in Mac OS X?
I'm using it to program the classes found within in assembly, but I can only find the file on the Internet. I want to find it on my actual operating system filesystem. I've downloaded all of XCode and installed the Components and Documentation, but I still can't find the file.
It is not a public* header -- it can, however, be found in the kernel source code:
http://www.opensource.apple.com/source/xnu/xnu-2050.9.2/osfmk/kern/syscall_sw.h
*: Indicating that you should not need it unless you're working in the kernel.
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)
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.