[Haskell-cafe] video for linux two (v4l2) bindings

Christopher Done chrisdone at googlemail.com
Tue Jul 5 11:19:57 CEST 2011


On 3 July 2011 21:46, Daniel Fischer <daniel.is.fischer at googlemail.com> wrote:
> On Sunday 03 July 2011, 21:34:17, Christopher Done wrote:
>> I just had a quick try with cabal-install and got the below. I'm not
>> sure where linux/posix_types is supposed to come from. Is this error
>> obvious to you?
>
> glibc-devel or the equivalent package for your distro, I think.

It turned out that I needed the linux development files from
linux-libc-dev. FWIW to anyone, I'm on Ubuntu. The packages I
installed were:

sudo apt-get install linux-libc-dev
sudo apt-get install libv4l-dev

Then I got this problem:

/home/chris/Programs/bin/ghc --make -o
dist/build/v4l2-capture/v4l2-capture -hide-all-packages
-fbuilding-cabal-package -package-conf dist/package.conf.inplace -i
-idist/build/v4l2-capture/v4l2-capture-tmp -i. -idist/build/autogen
-Idist/build/autogen -Idist/build/v4l2-capture/v4l2-capture-tmp
-optP-include -optPdist/build/autogen/cabal_macros.h -odir
dist/build/v4l2-capture/v4l2-capture-tmp -hidir
dist/build/v4l2-capture/v4l2-capture-tmp -stubdir
dist/build/v4l2-capture/v4l2-capture-tmp -package-id
base-4.2.0.2-5fc3ebcb886ceae9a06b0bab7e8d4680 -package-id
bindings-libv4l2-0.1-8dde216a9ec82cb90bbe93e20783ff8c -package-id
bindings-linux-videodev2-0.1-7a032e0014085bf53e381d004d794b50
-package-id bindings-mmap-0.1-3144f93204d922458a3be21650b85f1f
-package-id bindings-posix-1.2.2-00b879b119996c2d3acc7989dde2ba63
-package-id c-io-0.1.0-dcc629f98d0e4b2e0d55acbaaa6262b6 -package-id
ioctl-0.0.1-60f1d8091a07bb23f1736fec7d2b4dd8 -O -Wall
./src/v4l2-capture.hs
[1 of 1] Compiling Main             ( src/v4l2-capture.hs,
dist/build/v4l2-capture/v4l2-capture-tmp/Main.o )
Linking dist/build/v4l2-capture/v4l2-capture ...
/usr/bin/ld: /home/chris/.cabal/lib/bindings-posix-1.2.2/ghc-6.12.3/libHSbindings-posix-1.2.2.a(Signal.o):(.text+0x5dfb):
error: undefined reference to 'pthread_kill'
/usr/bin/ld: /home/chris/.cabal/lib/bindings-posix-1.2.2/ghc-6.12.3/libHSbindings-posix-1.2.2.a(Signal.o):(.text+0x5ee2):
error: undefined reference to 'pthread_kill'
/usr/bin/ld: /home/chris/.cabal/lib/bindings-posix-1.2.2/ghc-6.12.3/libHSbindings-posix-1.2.2.a(Signal.o):(.text+0x5f87):
error: undefined reference to 'pthread_sigmask'
/usr/bin/ld: /home/chris/.cabal/lib/bindings-posix-1.2.2/ghc-6.12.3/libHSbindings-posix-1.2.2.a(Signal.o):(.text+0x6092):
error: undefined reference to 'pthread_sigmask'
collect2: ld returned 1 exit status
cabal: Error: some packages failed to install:
v4l2-examples-0.1 failed during the building phase. The exception was:
ExitFailure 1
chris at cn-done:~/v4l2-examples-0.1$

But I solved it by adding -lpthread:

chris at cn-done:~/v4l2-examples-0.1$ /home/chris/Programs/bin/ghc --make
-o dist/build/v4l2-capture/v4l2-capture -hide-all-packages
-fbuilding-cabal-package -package-conf dist/package.conf.inplace -i
-idist/build/v4l2-capture/v4l2-capture-tmp -i. -idist/build/autogen
-Idist/build/autogen -Idist/build/v4l2-capture/v4l2-capture-tmp
-optP-include -optPdist/build/autogen/cabal_macros.h -odir
dist/build/v4l2-capture/v4l2-capture-tmp -hidir
dist/build/v4l2-capture/v4l2-capture-tmp -stubdir
dist/build/v4l2-capture/v4l2-capture-tmp -package-id
base-4.2.0.2-5fc3ebcb886ceae9a06b0bab7e8d4680 -package-id
bindings-libv4l2-0.1-8dde216a9ec82cb90bbe93e20783ff8c -package-id
bindings-linux-videodev2-0.1-7a032e0014085bf53e381d004d794b50
-package-id bindings-mmap-0.1-3144f93204d922458a3be21650b85f1f
-package-id bindings-posix-1.2.2-00b879b119996c2d3acc7989dde2ba63
-package-id c-io-0.1.0-dcc629f98d0e4b2e0d55acbaaa6262b6 -package-id
ioctl-0.0.1-60f1d8091a07bb23f1736fec7d2b4dd8 -O -Wall
./src/v4l2-capture.hs -lpthread
Linking dist/build/v4l2-capture/v4l2-capture ...
chris at cn-done:~/v4l2-examples-0.1$

I guess on Claude's system it's linked to by default. So for guys
trying the examples with that error I'd recommend the following
commandline:

  cabal install v4l2-examples --ghc-option=-lpthread

Can't really play about with the webcam right now but I'd had a small
but cool project I've had in mind for a while that v4l is perfectly
suited for, so I'll get back to you with my experiences. Thanks for
releasing it, Claude. :-)

Ciao!



More information about the Haskell-Cafe mailing list