I'm trying to compile a video driver on Ubuntu 10.04 LTS, here's the error:
**************************************************************************
* Building Techwell TW686x driver... *
* Type "make help" for a list of available targets. *
**************************************************************************
make -C /lib/modules/`uname -r`/build M="/home/v4/driver-686x-0.1.1" clean
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-43-generic'
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-43-generic'
make -C /lib/modules/`uname -r`/build M="/home/v4/driver-686x-0.1.1" modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-43-generic'
CC [M] /home/v4/driver-686x-0.1.1/tw686x-core.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-video.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-i2c.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-device.o
CC [M] /home/v4/driver-686x-0.1.1/i2c-sw.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-alsa.o
CC [M] /home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.o
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:341: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:343: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: error: unknown field ‘vaddr’ specified in initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: excess elements in struct initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: (near initialization for ‘qops’)
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c: In function ‘videobuf_queue_dma_contig_init_tw’:
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:357: warning: passing argument 2 of ‘videobuf_queue_core_init’ discards qualifiers from pointer target type
include/media/videobuf-core.h:197: note: expected ‘struct videobuf_queue_ops *’ but argument is of type ‘const struct videobuf_queue_ops *’
make[2]: *** [/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.o] Error 1
make[1]: *** [_module_/home/v4/driver-686x-0.1.1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-43-generic'
make: *** [modules] Error 2
My kernel is 2.6.32-43. My C is very rusty, so I'm asking the gurus.
From what I can see, the problem refers to variable videobuf_queue_ops in file videobuf-core.h, which i found in these locations:
/usr/src/linux-headers-2.6.24-24/include/media/videobuf-core.h
/usr/src/linux-headers-2.6.32-43/include/media/videobuf-core.h
/usr/src/linux-headers-2.6.24-32/include/media/videobuf-core.h
Here's the offending file (extract) videobuf-dma-contig-tw.c:
static struct videobuf_qtype_ops qops = {
.magic = MAGIC_QTYPE_OPS,
.alloc = __videobuf_alloc,
.iolock = __videobuf_iolock,
.mmap_mapper = __videobuf_mmap_mapper,
.vaddr = __videobuf_to_vaddr,
};
The definition of videobuf_qtype_ops in the header file looks like this :
struct videobuf_queue_ops {
int (*buf_setup)(struct videobuf_queue *q,
unsigned int *count, unsigned int *size);
int (*buf_prepare)(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field);
void (*buf_queue)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
void (*buf_release)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
};
#define MAGIC_QTYPE_OPS 0x12261003
/* Helper operations - device type dependent */
struct videobuf_qtype_ops {
u32 magic;
void *(*alloc) (size_t size);
void *(*vmalloc) (struct videobuf_buffer *buf);
int (*iolock) (struct videobuf_queue* q,
struct videobuf_buffer *vb,
struct v4l2_framebuffer *fbuf);
int (*mmap) (struct videobuf_queue *q,
unsigned int *count,
unsigned int *size,
enum v4l2_memory memory);
int (*sync) (struct videobuf_queue* q,
struct videobuf_buffer *buf);
int (*video_copy_to_user)(struct videobuf_queue *q,
char __user *data,
size_t count,
int nonblocking);
int (*copy_stream) (struct videobuf_queue *q,
char __user *data,
size_t count,
size_t pos,
int vbihack,
int nonblocking);
int (*mmap_free) (struct videobuf_queue *q);
int (*mmap_mapper) (struct videobuf_queue *q,
struct vm_area_struct *vma);
};
Should I change this header file? I'm not sure what the fix is, or whether I should even be changing Linux files - scary stuff!
Thanks for your help.
This part alone
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:343: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: error: unknown field ‘vaddr’ specified in initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: excess elements in struct initializer
tells us that the initializer and the struct are using different types, different field names, and different number of elements.
Definitely not the correct include file. :-)
You will have to figure out what version you should use, and make sure that one is in the include path (and not the others).
For some reason the compiler doesn't like this part:
static struct videobuf_qtype_ops qops = {
.magic = MAGIC_QTYPE_OPS,
.alloc = __videobuf_alloc,
.iolock = __videobuf_iolock,
.mmap_mapper = __videobuf_mmap_mapper,
.vaddr = __videobuf_to_vaddr,
};
The compiler told you the line number where the error had occurred:
videobuf-dma-contig-tw.c:344: error: unknown field ‘vaddr’ specified in initializer
Now the question is why there isn't a vaddr member in struct videobuf_qtype_ops. It could be under #if, but I don't know for sure. struct videobuf_qtype_ops isn't defined in this file.
You should've looked at this yourself. Posting lots of irrelevant code isn't a good use of people's time.
Related
file tools.h:
//some macro definitions
struct name;
//other function prototypes
file tools.c:
#include "tools.h"
struct name
{
FILE *src;
int value;
}
//definitions of functions declared in tools.h
file main.c:
#include <stdio.h>
#include "tools.h"
int main()
{
struct name *ptr;
ptr = malloc(sizeof(struct name));
ptr->FILE = fopen(filename, "r");
ptr->value = 12;
...
}
At first, I built tools.o by using:
$ gcc tools.c -c
Without any error or warning, tools.o was built in the current directory.
Now, I tried to build executable by using:
$ gcc main.c tools.o -o exe
and I got errors of same type (all the errors were of same type, caused due to accessing the struct element). Here's the sample of that error I got:
main.c: In function ‘main’:
main.c:17:22: error: invalid use of undefined type ‘struct name’
17 | buffer = malloc(ptr->value+1);
Please explain why this happened and what wrong I did while linking or in my code.
tools.h file
#ifndef TOOLS_H
#define TOOLS_H
#include <stdio.h>
struct name
{
FILE *src;
int value;
};
int foo(struct name*);
struct name *bar(double, FILE*, const char *); //prototypes of functions defined in tools.c
#endif
tools.c
#include "tools.h"
int foo(struct name*)
{
/* ... */
}
struct name *bar(double, FILE*, const char *)
{
/* ... */
}
Looks like you have some confusion with regards to forward declaration of a structure and a structure declaration (which defines a type).
From Forward declaration:
a forward declaration is a declaration of an identifier (denoting an entity such as a type, a variable, a constant, or a function) for which the programmer has not yet given a complete definition.
In tools.h, this
struct name;
is forward declaration of structure struct name. Note that, it declares an incomplete type because the specification [list defining the content] of struct name is unknown at this time.
You have included the tools.h in main.c and when compiling main.c compiler does not find the specification of struct name and hence, throwing error on the statements using it.
In tools.c, you are declaring the struct name (which defines a type):
struct name
{
FILE *src;
int value;
};
when compiling tools.c, compiler knows about the specification of structure struct name and hence, it's compilation is successful.
The other post [by #0___________] gives the appropriate way to solve this problem.
/*This is a simple try to create a File System in UserSpace
The pre_init function just initializes the filesystem */
#include<linux/fuse.h>
#include<stdio.h>
#include<stdlib.h>
#include<fuse_lowlevel.h>
static void* pre_init(struct fuse_conn_info *conn, struct fuse_config *cfg){
printf("[init] called\n");
(void) conn;
return NULL;
}
static struct fuse_operations opr = {
.init = pre_init,
};
int main(int argc, char *argv[]){
return fuse_main(argc, argv, &opr, NULL);
}
I am trying to compile the code using gcc sample.c -o sample `pkg-config fuse --cflags --libs` And I'm getting a whole lot of errors in the code as i have shown
sample.c:7:59: warning: ‘struct fuse_config’ declared inside parameter list will not be visible outside of this definition or declaration
static void* pre_init(struct fuse_conn_info *conn, struct fuse_config *cfg){
^~~~~~~~~~~
sample.c:12:15: error: variable ‘opr’ has initializer but incomplete type
static struct fuse_operations opr = {
^~~~~~~~~~~~~~~
sample.c:13:3: error: ‘struct fuse_operations’ has no member named ‘init’
.init = pre_init,
^~~~
sample.c:13:10: warning: excess elements in struct initializer
.init = pre_init,
^~~~~~~~
sample.c:13:10: note: (near initialization for ‘opr’)
sample.c: In function ‘main’:
sample.c:16:9: warning: implicit declaration of function ‘fuse_main’; did you mean ‘fuse_mount’? [-Wimplicit-function-declaration]
return fuse_main(argc, argv, &opr, NULL);
^~~~~~~~~
fuse_mount
sample.c: At top level:
sample.c:12:31: error: storage size of ‘opr’ isn’t known
static struct fuse_operations opr = {
^~~
I have also checked that fuse is installed properly as the header files have been included without any issues. But why am I not able to compile this simple code?
There are two "fuse" versions, sometimes coexistent with each other: fuse2 and fuse3. And they differ. In my Archlinux there are two fuse packages: fuse2 and fuse3. On my system, file /usr/include/fuse.h just includes fuse/fuse.h and fuse/fuse.h comes from fuse2 packages. Header fuse3/fuse.h comes from fuse3.
Anyway, you want to use fuse3 api here as you use struct fuse_config. fuse3 defines struct fuse_config.
But, thirst of all, define FUSE_USE_VERSION macro before including any of the fuse header files, as specified in the beginning in fuse.h from fuse2 and in the fuse.h from fuse3:
IMPORTANT: you should define FUSE_USE_VERSION before including this header.
The following compiles with no warnings/errors using gcc -Wall -pedantic -lfuse3 1.c on my platform:
#define FUSE_USE_VERSION 31
#include <fuse3/fuse.h>
#include <stdio.h>
#include <stdlib.h>
static void* pre_init(struct fuse_conn_info *conn, struct fuse_config *cfg){
printf("[init] called\n");
(void) conn;
return NULL;
}
static struct fuse_operations opr = {
.init = pre_init,
};
int main(int argc, char *argv[]){
return fuse_main(argc, argv, &opr, NULL);
}
i have next simple code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/libevent.h"
void onMessage(redisAsyncContext *c, void *reply, void *privdata) {
redisReply *r = reply;
if (reply == NULL) return;
int j;
if (r->type == REDIS_REPLY_ARRAY) {
for (j = 0; j < r->elements; j++) {
printf("%u) %s\n", j, r->element[j]->str);
}
}*/
}
int main (int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);
struct event_base *base = event_base_new();
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
if (c->err) {
printf("error: %s\n", c->errstr);
return 1;
}
redisLibeventAttach(c, base);
redisAsyncCommand(c, onMessage, NULL, "SUBSCRIBE messages");
event_base_dispatch(base);
return 0;
}
program compiles and runs well. but it returns error "Segmentation fault" when executes. if i comment redisAsyncCommand() function error disappears.
where is the error in my code?
added:
when i compile my code i have warnings:
make all
'Building file: ../src/redis.c'
'Invoking: Cross GCC Compiler'
arm-linux-gnueabihf-gcc -I"C:\SysGCC\Raspberry\include" -I"C:\SysGCC\Raspberry\include\hiredis" -I"C:\SysGCC\Raspberry\include\event2" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/redis.d" -MT"src/redis.o" -o "src/redis.o" "../src/redis.c"
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventAddRead':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:56:15: warning: passing argument 1 of 'event_add' from incompatible pointer type
event_add(&e->rev,NULL);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:937:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_add(struct event *ev, const struct timeval *timeout);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventDelRead':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:61:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->rev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventAddWrite':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:66:15: warning: passing argument 1 of 'event_add' from incompatible pointer type
event_add(&e->wev,NULL);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:937:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_add(struct event *ev, const struct timeval *timeout);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventDelWrite':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:71:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->wev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventCleanup':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:76:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->rev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:77:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->wev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventAttach':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:102:5: warning: implicit declaration of function 'event_set' [-Wimplicit-function-declaration]
event_set(&e->rev,c->fd,EV_READ,redisLibeventReadEvent,e);
^
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:104:25: warning: passing argument 2 of 'event_base_set' from incompatible pointer type
event_base_set(base,&e->rev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:627:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_base_set(struct event_base *, struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:105:25: warning: passing argument 2 of 'event_base_set' from incompatible pointer type
event_base_set(base,&e->wev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:627:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_base_set(struct event_base *, struct event *);
^
'Finished building: ../src/redis.c'
' '
'Building target: redis'
'Invoking: Cross GCC Linker'
arm-linux-gnueabihf-gcc -L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\usr\local\lib" -L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\lib" -o "redis" ./src/redis.o -lhiredis -levent_core -lpthread
'Finished building target: redis'
' '
00:20:55 Build Finished (took 1s.130ms)
EDIT
It seems the main issue was in the included adapter file.
The issue I pointed towards was unrelated.
Here is just one quick issue I noticed:
if (r->type == REDIS_REPLY_ARRAY) {
for (j = 0; j < r->elements; j++) {
printf("%u) %s\n", j, r->element[j]->str);
}
}
Your code assumes that the reply is an array of Strings.
This is incorrect.
The Subscribe command also returns an Array response and the last member of that response is a NUMBER (not a string).
Hence, the assumption that it's an array of strings will fail.
I'm not sure if that's the cause, but it is likely to be an important issue.
Good Luck!
P.S.
I might be shamelessly promoting my own project here, but you might enjoy using facil.io's integrated Redis Pub/Sub engine. If you need Websocket or HTTP support, it might save you a lot of coding.
When I compile the program, outlined below, I am getting the following error(s) back
[igor#localhost ~/I2C]$ make i2c_VIPER DEFINE=-DVIPER
gcc -g -Wall -D__USE_FIXED_PROTOTYPES__ -DVIPER -ansi -lusb -c -o i2c.o i2c.c
In file included from i2c.c:9:
viperboard.h:120: error: expected ‘)’ before ‘*’ token
i2c.c: In function ‘main’:
i2c.c:32: error: ‘usb_dev’ undeclared (first use in this function)
i2c.c:32: error: (Each undeclared identifier is reported only once
i2c.c:32: error: for each function it appears in.)
i2c.c:33: warning: implicit declaration of function ‘i2c_VIPER’
make: *** [i2c.o] Error 1
I've tried many things, more or less semi-blindly, to make it working. The struct parsed_CLI_I2C_t defined by me, works flawlessly. No compilation errors. But, when I try to use struct usb_device from <usb.h> in equivalent way, the compiler is not happy.
What I am doing wrong ?
Relatively detailed description follows.
Let's start with a code snippet from the standard #include < usb.h > <-- link to the full header file
/* Data types */
struct usb_device;
struct usb_bus;
struct usb_device {
struct usb_device *next, *prev;
char filename[PATH_MAX + 1];
struct usb_bus *bus;
struct usb_device_descriptor descriptor;
struct usb_config_descriptor *config;
void *dev; /* Darwin support */
u_int8_t devnum;
unsigned char num_children;
struct usb_device **children;
};
Here is the first local header file #include "viperboard.h"
struct parsed_CLI_I2C_t;
extern int i2c_VIPER (struct usb_device **usb_dev, struct parsed_CLI_I2C_t **CLI_I2C_options);
extern bool OpenDevice(void);
This is the second local header file #include "I2C.h"
typedef struct
{
char *USB_board;
int query;
int write_type;
} parsed_CLI_I2C_t;
extern int parse_CLI_I2C_options (int argc, char *argv[], parsed_CLI_I2C_t **CLI_I2C_options);
The main program looks like this
/* all other standard include stuff skipped for brevity */
#include <usb.h>
#include "viperboard.h"
#include <stdbool.h>
#include "I2C.h"
int main(int argc, char *argv[])
{
parsed_CLI_I2C_t *CLI_I2C_options;
parse_CLI_I2C_options (argc, argv, &CLI_I2C_options);
struct usb_device *usb_dev;
i2c_VIPER (&usb_dev, &CLI_I2C_options);
}
and, finally, this is the external module
i2c_VIPER.c
/* all other standard include stuff skipped for brevity */
#include <usb.h>
#include "viperboard.h"
#include <stdbool.h>
#include "I2C.h"
int i2c_VIPER (struct usb_device **usb_dev, struct parsed_CLI_I2C_t **CLI_I2C_options )
{
bool connected; /* True if the ViperBoard is connected */
connected = OpenDevice();
return(0);
}
This is
OpenDevice.c
#include <stdbool.h>
#include <usb.h>
bool OpenDevice() /* <---- this is line 11 */
{
usb_set_debug( 0 );
/* Initialize USB library */
usb_init( );
etc etc etc
return true;
}
========================================================
30 minutes later: all suggested changes implemented
Another type of error appeared.
OpenDevice.c:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OpenDevice’
make: *** [OpenDevice.o] Error 1
This line
usb_device *usb_dev; /* this is line 32 */
will not work as you're compiling a C program, not a C++ program. In C structures are not automatically types like they are in C++. You need to use the struct keyword to declare structures:
struct usb_device *usb_dev; /* this is line 32 */
This change you have to do for every place where you use structures, for example like the declaration and definition of the i2c_VIPER function.
Also note that for the bool type to work, you need to include <stdbool.h>.
I'm trying to compile a program that includes liboss's file, but when I compile I get the following error.
In file included from test.c:1:
/opt/local/include/liboss/soundcard.h:342: error: static declaration of ‘ioctl’ follows non-static declaration
/usr/include/sys/ioctl.h:97: error: previous declaration of ‘ioctl’ was here
/opt/local/include/liboss/soundcard.h:353: error: static declaration of ‘open’ follows non-static declaration
/usr/include/sys/fcntl.h:464: error: previous declaration of ‘open’ was here
/opt/local/include/liboss/soundcard.h:363: error: static declaration of ‘close’ follows non-static declaration
/usr/include/unistd.h:476: error: previous declaration of ‘close’ was here
/opt/local/include/liboss/soundcard.h:366: error: conflicting types for ‘write’
/usr/include/unistd.h:535: error: previous declaration of ‘write’ was here
The line where the first error occurs is this one.
# soundcard.h
static inline int LIBOSS_IOCTL (int x, unsigned long y,...)
{
int result;
va_list l;
va_start(l,y);
result = liboss_ioctl(x,y,l);
va_end (l);
return result;
}
# ioctl.h
__BEGIN_DECLS
int ioctl(int, unsigned long, ...);
__END_DECLS
Is there any way in which I can monkey-patch soundcard.h so that this won't be an issue?
Thnx! A.
Specs: Mac OSX 10.7.4, gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1
It sounds like liboss is trying to provide an oss-compatible soundcard interface on a system where that's non-native by redefining the ioctl function to provide the OSS ioctl operations without the kernel having support for them. If this is the case, you need to make sure sys/ioctl.h (or any header that might include it) does not get included in the same source files that use soundcard.h.
Just add static to /usr/include/sys/ioctl.h:97, /usr/include/sys/fcntl.h:464, /usr/include/unistd.h:476 and /usr/include/unistd.h:535 (and undo those changes again after compilation).
In /opt/local/include/liboss/soundcard.h:366 replace int by ssize_t.
# add static
sudo nano +97 /usr/include/sys/ioctl.h
- int ioctl(int, unsigned long, ...);
+ static int ioctl(int, unsigned long, ...);
# replace int by ssize_t
sudo nano +366 /opt/local/include/liboss/soundcard.h
- static inline int LIBOSS_WRITE (int x, const void *y, size_t l)
+ static inline ssize_t LIBOSS_WRITE (int x, const void *y, size_t l)