Had to remove -ldl? It should be there. Also I just checked those errors on 'strndup', and all the requiered headers are in place. Maybe you got a solution, because I do not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've done some scooping around, and i found that strndup isn't supported, but strdup is. I'am not sure what the actual difference is, but doing a little search on google gave some hints as most of ( if not all ) results are related to BSD like systems not supporting strndup neither does solaris.
This is a small piece of patch file where they replace strndup:
{
static CosNaming_Name name = { 0, 0, NULL };
int i, n;
- char *t;
+ int t;
CORBA_free( name._buffer );
name._buffer = CORBA_sequence_CosNaming_NameComponent_allocbuf( n + 1 );
name._length = n + 1;
for(i = 0; i <= n; i++) {
- t = strchr(string, '/');
- name._buffer[ i ].id = strndup(string, t?(t - string):INT_MAX);
+ t = strcspn(string, "/\0");
+ name._buffer[ i ].id = /*g_*/malloc( t + 1 );
+ strncpy( name._buffer[ i ].id, string, t );
+ name._buffer[ i ].id[ t ] = 0;
name._buffer[ i ].kind = name._buffer[i].id;
- string = t + 1;
+ string += t + 1;
}
hope this helps
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'am having some problems configurering kma and building it ....
autoconf warning
seasoft# ./autogen.sh
configure.in:17: warning: AC_CANONICAL_BUILD invoked multiple times
some configure issues
seasoft# ./configure --with-dvdcss=/usr/local/libdvdcss --with-dvdread=/usr/local/libdvdread --prefix=/usr/local/kma
checking for dvdcss_read in -ldvdcss... gdk-pixbuf-config: not found
yes
checking for DVDOpen in -ldvdread... gdk-pixbuf-config: not found
yes
and finally the gmake error
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"kma\" -DVERSION=\"0.3.2CVS\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -O2 -Wall -ggdb -I.. -Wall -pthread -D_REENTRANT -D_PTHREADS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_LARGEFILE64 -D_LARGEFILE64_SOURCE -g -O2 -pthread -DFREEBSD -DDVDSUPPORT -I/usr/local/libdvdcss/include -I/usr/local/libdvdread/include -c `test -f xmalloc.c || echo './'`xmalloc.c
xmalloc.c:21: error: syntax error before '*' token
xmalloc.c:21: warning: type defaults to `int' in declaration of `mutex_malloc'
xmalloc.c:21: warning: data definition has no type or storage class
gmake[1]: *** [xmalloc.o] Error 1
gmake[1]: Leaving directory `/root/kma/src'
system running freebsd 5.2.1 latest kma cvs.
Anyone an idea ?
Thanks !
I guess an "#include <pthread.h>" is needed for BSD.. Next time I'll commit to CVS it's there. You can add it to xmalloc.c yourself if you cant wait.
You were right, i couldn't wait :-) I've added the #include to xmalloc and it seems to fix something, until the next errors came up ...
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"kma\" -DVERSION=\"0.3.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -O2 -Wall -ggdb -I.. -Wall -pthread -D_REENTRANT -D_PTHREADS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_LARGEFILE64 -D_LARGEFILE64_SOURCE -g -O2 -pthread -DFREEBSD -DDVDSUPPORT -MT cmd_action.o -MD -MP -MF ".deps/cmd_action.Tpo" -c -o cmd_action.o `test -f 'cmd_action.c' || echo './'`cmd_action.c; then mv ".deps/cmd_action.Tpo" ".deps/cmd_action.Po"; else rm -f ".deps/cmd_action.Tpo"; exit 1; fi
cmd_action.c: In function `cmd_action':
cmd_action.c:99: warning: implicit declaration of function `strndup'
cmd_action.c:99: warning: assignment makes pointer from integer without a cast
cmd_action.c:106: warning: assignment makes pointer from integer without a cast
cmd_action.c:110: warning: implicit declaration of function `string_replace'
cmd_action.c:110: warning: assignment makes pointer from integer without a cast
cmd_action.c:114: warning: assignment makes pointer from integer without a cast
cmd_action.c:273:2: warning: #warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cmd_action.c:274:2: warning: #warning (S)VCD SUPPORT NOT COMPILED INTO THIS BINARY. INSTALL VCDIMAGER AND RECOMPILE
cmd_action.c:275:2: warning: #warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cmd_action.c:80: warning: unused variable `masq_fd'
cmd_action.c:81: warning: unused variable `masq_path'
cmd_action.c:82: warning: unused variable `mpeg_temp_path'
cmd_action.c: At top level:
dvd_tools.h:64: warning: `lang_tbl' defined but not used
if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"kma\" -DVERSION=\"0.3.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -O2 -Wall -ggdb -I.. -Wall -pthread -D_REENTRANT -D_PTHREADS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_LARGEFILE64 -D_LARGEFILE64_SOURCE -g -O2 -pthread -DFREEBSD -DDVDSUPPORT -MT cmd_size.o -MD -MP -MF ".deps/cmd_size.Tpo" -c -o cmd_size.o `test -f 'cmd_size.c' || echo './'`cmd_size.c; then mv ".deps/cmd_size.Tpo" ".deps/cmd_size.Po"; else rm -f ".deps/cmd_size.Tpo"; exit 1; fi
cmd_size.c: In function `cmd_size':
cmd_size.c:39: error: syntax error before "size"
cmd_size.c:60: error: `size' undeclared (first use in this function)
cmd_size.c:60: error: (Each undeclared identifier is reported only once
cmd_size.c:60: error: for each function it appears in.)
cmd_size.c:135: error: `off64_t' undeclared (first use in this function)
cmd_size.c:135: error: syntax error before numeric constant
cmd_size.c:139: error: syntax error before "size"
*** Error code 1
I've done a little digging and the latest version i was able to compile successfully was 0.2. Whereas these lines do not exist ...
OK, current cvs should be OK now, fixes for both dlopen and off64_t.
grabbed the latest cvs version and added pthread.h but same errors came up ...
source='xmalloc.c' object='xmalloc.o' libtool=no depfile='.deps/xmalloc.Po' tmpdepfile='.deps/xmalloc.TPo' depmode=gcc3 /bin/sh ../depcomp gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"kma\" -DVERSION=\"0.3.2CVS\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -O2 -Wall -ggdb -I.. -Wall -pthread -D_REENTRANT -D_PTHREADS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_LARGEFILE64 -D_LARGEFILE64_SOURCE -g -O2 -pthread -DFREEBSD -DDVDSUPPORT -c `test -f xmalloc.c || echo './'`xmalloc.c
source='cmd_action.c' object='cmd_action.o' libtool=no depfile='.deps/cmd_action.Po' tmpdepfile='.deps/cmd_action.TPo' depmode=gcc3 /bin/sh ../depcomp gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"kma\" -DVERSION=\"0.3.2CVS\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -O2 -Wall -ggdb -I.. -Wall -pthread -D_REENTRANT -D_PTHREADS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_LARGEFILE64 -D_LARGEFILE64_SOURCE -g -O2 -pthread -DFREEBSD -DDVDSUPPORT -c `test -f cmd_action.c || echo './'`cmd_action.c
cmd_action.c: In function `cmd_action':
cmd_action.c:99: warning: implicit declaration of function `strndup'
cmd_action.c:99: warning: assignment makes pointer from integer without a cast
cmd_action.c:106: warning: assignment makes pointer from integer without a cast
cmd_action.c:110: warning: implicit declaration of function `string_replace'
cmd_action.c:110: warning: assignment makes pointer from integer without a cast
cmd_action.c:114: warning: assignment makes pointer from integer without a cast
cmd_action.c:273:2: warning: #warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cmd_action.c:274:2: warning: #warning (S)VCD SUPPORT NOT COMPILED INTO THIS BINARY. INSTALL VCDIMAGER AND RECOMPILE
cmd_action.c:275:2: warning: #warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cmd_action.c:80: warning: unused variable `masq_fd'
cmd_action.c:81: warning: unused variable `masq_path'
cmd_action.c:82: warning: unused variable `mpeg_temp_path'
cmd_action.c: At top level:
dvd_tools.h:64: warning: `lang_tbl' defined but not used
source='cmd_size.c' object='cmd_size.o' libtool=no depfile='.deps/cmd_size.Po' tmpdepfile='.deps/cmd_size.TPo' depmode=gcc3 /bin/sh ../depcomp gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"kma\" -DVERSION=\"0.3.2CVS\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I. -O2 -Wall -ggdb -I.. -Wall -pthread -D_REENTRANT -D_PTHREADS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_LARGEFILE64 -D_LARGEFILE64_SOURCE -g -O2 -pthread -DFREEBSD -DDVDSUPPORT -c `test -f cmd_size.c || echo './'`cmd_size.c
cmd_size.c: In function `cmd_size':
cmd_size.c:39: error: syntax error before "size"
cmd_size.c:60: error: `size' undeclared (first use in this function)
cmd_size.c:60: error: (Each undeclared identifier is reported only once
cmd_size.c:60: error: for each function it appears in.)
cmd_size.c:135: error: `off64_t' undeclared (first use in this function)
cmd_size.c:135: error: syntax error before numeric constant
cmd_size.c:139: error: syntax error before "size"
perhaps it has something to do with gcc ?
seasoft# gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.3.3 [FreeBSD] 20031106
I'am sorry i can't be of more assistance, my knowledge of C is almost completely nothing ...
was a bit hasty was grabbing the latest cvs as it wasn't updated yet, grabbed it again and it fixed those errors, but presented a new one ...
I had to remove ldl from makefile.in and .am after that this is what happend:
gcc -O2 -Wall -ggdb -I.. -Wall -pthread -D_REENTRANT -D_PTHREADS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_USE_LARGEFILE64 -D_LARGEFILE64_SOURCE -g -O2 -pthread -DFREEBSD -DDVDSUPPORT -o kma clients.o cmd_nothing.o disp_ip.o listen.o xlisten.o clients_tools.o cmd_quit.o exec_cmd.o main.o xmalloc.o cmd_action.o cmd_size.o files_tools.o send_msg.o xsocket.o cmd_get.o cmd_tab.o fix_line.o treat_event.o cmd_list.o config.o kill_server.o xbind.o logging.o avi_tools.o playlists.o streammp3.o stream_pls.o vcd_tools.o dvd_tools.o string_replace.o common_menu.o send_tools.o modules.o /usr/local/libdvdcss/lib/libdvdcss.so /usr/lib/libdvdread.so -Wl,--rpath -Wl,/usr/local/libdvdcss/lib -Wl,--rpath -Wl,/usr/local/libdvdcss/lib
cmd_action.o: In function `cmd_action':
/root/kma/src/cmd_action.c:106: undefined reference to `strndup'
/root/kma/src/cmd_action.c:99: undefined reference to `strndup'
dvd_tools.o: In function `dvd_to_mpeg_init':
/root/kma/src/dvd_tools.c:198: undefined reference to `strndup'
/root/kma/src/dvd_tools.c:203: undefined reference to `strndup'
*** Error code 1
Had to remove -ldl? It should be there. Also I just checked those errors on 'strndup', and all the requiered headers are in place. Maybe you got a solution, because I do not.
I've done some scooping around, and i found that strndup isn't supported, but strdup is. I'am not sure what the actual difference is, but doing a little search on google gave some hints as most of ( if not all ) results are related to BSD like systems not supporting strndup neither does solaris.
This is a small piece of patch file where they replace strndup:
{
static CosNaming_Name name = { 0, 0, NULL };
int i, n;
- char *t;
+ int t;
CORBA_free( name._buffer );
name._buffer = CORBA_sequence_CosNaming_NameComponent_allocbuf( n + 1 );
name._length = n + 1;
for(i = 0; i <= n; i++) {
- t = strchr(string, '/');
- name._buffer[ i ].id = strndup(string, t?(t - string):INT_MAX);
+ t = strcspn(string, "/\0");
+ name._buffer[ i ].id = /*g_*/malloc( t + 1 );
+ strncpy( name._buffer[ i ].id, string, t );
+ name._buffer[ i ].id[ t ] = 0;
name._buffer[ i ].kind = name._buffer[i].id;
- string = t + 1;
+ string += t + 1;
}
hope this helps
OK, no strndup on bsd, I'll replace them. The work you've done to fetch the code is appreciated.. but it's not quite right ;)
But wont be much of a problem to write some lines myself to replace strndup, thnx for helping out.
OK, I just commited code to CVS that has internal strndup functions. Could you test and let me know the results?