C byteswap.h: no such file or directory

Hello guys,

compiling a program, gmake gives the error:

byteswap.h: no such file or directory

I use gcc46 compiler.

Please, can you tell me if is a solution ?
Is an equivalent byteswap.h file for freeBSD ?

Thanks in advance
 
$ mkdir -p ~/includes
$ cp /usr/ports/audio/alsa-lib/files/byteswap.h ~/includes/
$ gcc -I ~/includes [and the other compiler args]
 
What are you trying to accomplish?

Are you trying to port some software from another OS (Linux?) to FreeBSD?

Does that software have some prerequisites? Obsigna already gave the answer indirectly: Most likely, you are trying to port some desktop- oder audio software, which requires the ALSA sound system. In that case, your problem isn't just one compile, but the fact that you need to obtain all the other prerequisites; and I don't think a full ALSA implementation for FreeBSD even exists.

Or is this something completely unrelated? I bet there are several dozen versions of "byteswap.h" around, part of wildly different implementations of detecting byte order and byte swapping. If you want to make your code more standard compliant, it might be a good idea to find out what the "idiomatic" way of byte swapping is. Personally, I've always used the ntoh() and hton() family of functions, but I'm not really sure that this is the right thing. Posix seems silent on it.
 
Does that software have some prerequisites?
Or is this something completely unrelated?

Hello ralph !

what you wrote is perfect.

For personal training purpose, I was giving a look at a software package whose link I found on https://wiki.osdev.org/FAT.
It's a utility addressed managing of FAT12/32 images. It retrieves some info from the Boot Sector fields (BPB, EBPB, etc....).
So the original byteswap.h is probably related with the little endian format followed by the FAT filesystem.

Generally speaking, I'm agree with you about the "software prerequisites" and surely this utility has been written for the Linux environment.

I've compiled it with success on FreeBSD also if the byteswap.h used by ALSA audio drivers could be not completely related with the package in question.
I don't know in what measure at this moment. I'm evaluting it checking the results with the Boot Sector's fields shown by the Hexdecimal editor.

Before post the question, I've tried to search for a POSIX version of this file, but to me also Posix seems silent on it.

Again: thanks very much for your continuous tips !
Some times I avoid to disturbing you because I think that you are engaged in the work. But your replies are always welcome and great appreciated.

Bye.
 
Back
Top