segmentation fault

View: New views
1 Messages — Rating Filter:   Alert me  

segmentation fault

by bcch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,
I was following the capture.c program here : http://lecs.cs.ucla.edu/wiki/index.php/Capture_Prog
and my Makefile is like this:
ifeq ($(DEBUG),y)
        CFLAGS += -O -g # -O is need to expand inlines
else
        CFLAGS += -O2
endif

TARGET = capture

PWD     := $(shell pwd)

GUMSTIX_BUILDROOT   = $(PWD)/../gumstix-buildroot
BUILD_ARM           = $(wildcard $(GUMSTIX_BUILDROOT)/build_arm*)
CROSS_COMPILE       = $(patsubst %gcc, %, $(wildcard $(BUILD_ARM)/staging_dir/bin/arm-linux-uclibc*-gcc))

ifeq ($(strip $(CROSS_COMPILE)),)
$(error Unable to detect Cross Compiler)
endif

TARGET_ARCH=-Os -march=armv5te -mtune=xscale -Wa,-mcpu=xscale
CC = $(CROSS_COMPILE)gcc

#
# If you need additional serch paths for include files, then use the -I flag
# and add them to the CPPFLAGS variable
#

# CPPFLAGS += -I somedir

#
# If you need addional search paths for library files, then use the -L flag
# and add them to LDFLAGS.
#

# LDFLAGS += -L somedir

#
# If you need additional libraries, then use -lxxx to search for libxxx.a
#
 LDLIBS += -lasound
.PHONY: all

all: depend $(TARGET)

#
# You can change the $(TARGET).c if that's not your main file and you can
# add additional .o files to the end of the line
#

SRCS = $(TARGET).c
OBJS = $(SRCS:.c=.o)
                     
$(TARGET) : $(OBJS)

clean:
        rm -rf $(OBJS) core .depend $(TARGET)

depend .depend dep:
        $(CC) $(CFLAGS) $(CPPFLAGS) -M $(SRCS) > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif

After "make", it worked out fine, but this showed a segmentation fault on PuTTy connected with the gumstix.
Also using gcc -o capture capture.c, there are a number of errors showing like this:

capture.c:5:28: error: alsa/asoundlib.h: No such file or directory
capture.c: In function 'main':
capture.c:15: error: 'snd_pcm_t' undeclared (first use in this function)
capture.c:15: error: (Each undeclared identifier is reported only once
capture.c:15: error: for each function it appears in.)
capture.c:15: error: 'capture_handle' undeclared (first use in this function)
capture.c:16: error: 'snd_pcm_hw_params_t' undeclared (first use in this function)
capture.c:16: error: 'hw_params' undeclared (first use in this function)
capture.c:27: error: 'SND_PCM_STREAM_CAPTURE' undeclared (first use in this function)
capture.c:45: error: 'SND_PCM_ACCESS_RW_INTERLEAVED' undeclared (first use in this function)
capture.c:51: error: 'SND_PCM_FORMAT_S16_LE' undeclared (first use in this function)

Anybody can help me? Many thanks!


--
Cheers
Hilary, HU Ziyan
BEECE

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gumstix-users mailing list
gumstix-users@...
https://lists.sourceforge.net/lists/listinfo/gumstix-users
LightInTheBox - Buy quality products at wholesale price