intel / icamerasrc

icamerasrc
24 stars 35 forks source link

Cannot build: camera_device_open() - too many arguments #32

Open edoardogiacomello opened 1 year ago

edoardogiacomello commented 1 year ago

Hello, I'm trying to build icamerasrc to make the webcam of my Lenovo X1 Carbon (gen 10) work in Ubuntu 22.04. I've installed all the other dependencies listed in the instructions with no errors (using ipu6ep), however then when i run make -j8 the build fails with this error:

gstcamerasrc.cpp: In function ‘gboolean gst_camerasrc_start(GstCamBaseSrc*)’:
gstcamerasrc.cpp:2839:27: error: too many arguments to function ‘int icamera::camera_device_open(int)’
 2839 |   ret = camera_device_open(camerasrc->device_id, camerasrc->num_vc);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gstcamerasrc.cpp:62:
/usr/include/libcamhal/api/ICamera.h:210:5: note: declared here
  210 | int camera_device_open(int camera_id);
      |     ^~~~~~~~~~~~~~~~~~
make[3]: *** [Makefile:623: libgsticamerasrc_la-gstcamerasrc.lo] Error 1
make[3]: Leaving directory '<redacted>/icamerasrc/src'
make[2]: *** [Makefile:684: all-recursive] Error 1
make[2]: Leaving directory '<redacted>/icamerasrc/src'
make[1]: *** [Makefile:519: all-recursive] Error 1
make[1]: Leaving directory '<redacted>/icamerasrc'
make: *** [Makefile:428: all] Error 2

Am I doing something wrong or is it just a bug?

Thanks, E.

gfarrell commented 1 year ago

I have this too on archlinux -- attempting to install gives me the exact same output as above.

brmarkus commented 1 year ago

For the engineering-team to have a chance to look into this, can you provide as many information, please? Which versions (name, branch, repo, commit) of which components of icamerasrc and its dependencies do you have installed (and how)? How does your environment (HW and SW) look like? How have you set-up your build environment, compiling "natively" or e.g. within a Docker container (or virtual-env)? Any local changes to source-code? Is this the first time you tried to build - or have you seen it building successfully using an older version or other HW?

HackXIt commented 1 year ago

I changed the line that is mentioned in the output of make to

//ret = camera_device_open(camerasrc->device_id, camerasrc->num_vc);
    ret = camera_device_open(camerasrc->device_id);

It then was able to compile, but I'm unsure if this will break something else further down the line.

Also it still doesn't work for me, because when running sudo -E gst-launch-1.0 icamerasrc buffer-count=7 ! video/x-raw,format=YUY2,width=1280,height=720 ! videoconvert ! ximagesink I get this output:

WARNING: erroneous pipeline: no element "icamerasrc"

I'm not sure what is going wrong here, but according to https://aur.archlinux.org/packages/icamerasrc-git I'm not alone with the problem.

I'm unsure on how to proceed, since I'm new to this type of scenario.

But generally I followed the guides of the ipu6 projects in order and everything worked up to the point of trying to compile this plugin.


version-info icamerasrc:

ipu6-camera-bins:

ipu6-camera-hal:

brmarkus commented 1 year ago

@HackXIt do you respond to @edoardogiacomello ?

In this case the IPU-camera-HAL version doesn't match to the used version of icamerasrc.

(Optional) Support for e.g. virtual-channels was considered in IPU6-Camera-HAL branch "iotg_ipu6", see e.g. here: "https://github.com/intel/ipu6-camera-hal/blob/iotg_ipu6/include/api/ICamera.h#L237".

Unfortunately I don't see a public documentation of what dependency in which version/branch/commit/release to use.

edoardogiacomello commented 1 year ago

Which versions (name, branch, repo, commit) of which components of icamerasrc and its dependencies do you have installed (and how)?

  1. ipu6-drivers - dfedab0

I followed instructions for point 3 (Build with DKMS)

  1. ipu6-camera-bins - 276859f

I set IPU_VER=ipu6ep and followed the instructions under "Deployment"

  1. ipu6-camera-hal - 884b81a

I followed the instructions without errors, then rebooted

  1. icamerasrc - 82cb8fc

I'm trying to follow build instructions but the make command fails. I've tried with older releases with different errors.

How does your environment (HW and SW) look like?

My HW is a Lenovo X1 Carbon (gen 10), running Ubuntu 22.04.

lspci

00:00.0 Host bridge: Intel Corporation Device 4601 (rev 04)
00:02.0 VGA compatible controller: Intel Corporation Device 46a8 (rev 0c)
00:04.0 Signal processing controller: Intel Corporation Alder Lake Innovation Platform Framework Processor Participant (rev 04)
00:05.0 Multimedia controller: Intel Corporation Device 465d (rev 04)
00:06.0 PCI bridge: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 (rev 04)
00:07.0 PCI bridge: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #0 (rev 04)
00:07.2 PCI bridge: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #2 (rev 04)
00:08.0 System peripheral: Intel Corporation 12th Gen Core Processor Gaussian & Neural Accelerator (rev 04)
00:0a.0 Signal processing controller: Intel Corporation Platform Monitoring Technology (rev 01)
00:0d.0 USB controller: Intel Corporation Alder Lake-P Thunderbolt 4 USB Controller (rev 04)
00:0d.2 USB controller: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #0 (rev 04)
00:0d.3 USB controller: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #1 (rev 04)
00:12.0 Serial controller: Intel Corporation Device 51fc (rev 01)
00:14.0 USB controller: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller (rev 01)
00:14.2 RAM memory: Intel Corporation Alder Lake PCH Shared SRAM (rev 01)
00:14.3 Network controller: Intel Corporation Alder Lake-P PCH CNVi WiFi (rev 01)
00:15.0 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 (rev 01)
00:16.0 Communication controller: Intel Corporation Alder Lake PCH HECI Controller (rev 01)
00:19.0 Serial bus controller: Intel Corporation Alder Lake-P Serial IO I2C Controller #0 (rev 01)
00:1c.0 PCI bridge: Intel Corporation Device 51b8 (rev 01)
00:1f.0 ISA bridge: Intel Corporation Alder Lake PCH eSPI Controller (rev 01)
00:1f.3 Audio device: Intel Corporation Alder Lake PCH-P High Definition Audio Controller (rev 01)
00:1f.4 SMBus: Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01)
00:1f.5 Serial bus controller: Intel Corporation Alder Lake-P PCH SPI Controller (rev 01)
04:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller PM9A1/PM9A3/980PRO
08:00.0 Wireless controller [0d40]: MEDIATEK Corp. Device 4d75 (rev 01)

lsusb

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 8086:0b63 Intel Corp. USB Bridge
Bus 003 Device 003: ID 06cb:00fc Synaptics, Inc.
Bus 003 Device 008: ID 291a:8365 Anker                   Anker USB-C Hub Device
Bus 003 Device 007: ID 046d:c332 Logitech, Inc. G502 Proteus Spectrum Optical Mouse
Bus 003 Device 005: ID 2516:017f Cooler Master Co., Ltd. CK352 Mechanlcal Keyboard
Bus 003 Device 002: ID 2109:2817 VIA Labs, Inc. USB2.0 Hub
Bus 003 Device 006: ID 8087:0033 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet
Bus 002 Device 002: ID 2109:0817 VIA Labs, Inc. USB3.0 Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

How have you set-up your build environment, compiling "natively" or e.g. within a Docker container (or virtual-env)?

I'm compiling natively.

Any local changes to source-code?

None

Is this the first time you tried to build - or have you seen it building successfully using an older version or other HW?

I've tried a couple of months ago without success, then cleaned everything and I'm retrying now based on the success from https://askubuntu.com/a/1461869 The webcam is working properly on Windows 10 which is installed alongside Ubuntu.

HackXIt commented 1 year ago

In this case the IPU-camera-HAL version doesn't match to the used version of icamerasrc. (Optional) Support for e.g. virtual-channels was considered in IPU6-Camera-HAL branch "iotg_ipu6", see e.g. here: "https://github.com/intel/ipu6-camera-hal/blob/iotg_ipu6/include/api/ICamera.h#L237". Unfortunately I don't see a public documentation of what dependency in which version/branch/commit/release to use.

I'll attempt to recompile using your suggested branch, maybe it will work.

But having read a bit more into it, it currently seems like, that the driver is still in active development and the problem with the MIPI driver is common to the users with those cameras on linux. I was trying to jump ahead (instead of waiting for the driver being generally distributed), by compiling the available driver as described in the repositories by myself.

@HackXIt do you respond to @edoardogiacomello ?

I thought if I add to this existing issue, that I'm having the same problem, it would help. In general, I only recently changed to Linux, so I'm not that well versed. I'm sorry, if it didn't provide more insight or information.

chdietrich commented 1 year ago

WARNING: erroneous pipeline: no element "icamerasrc"

Solved this by using 17841ab6249aaa69bd9b3959262bf182dee74111

Lenovo Thinkpad X1 Carbon G10 / BIOS 1.37 / Secure Boot disabled Ubuntu 22.04.2 x64 / Kernel 6.1 ipu6-drivers / master / dfedab03f3856010d37968cb384696038c73c984 ivsc-driver / main / c8db12b907e2e455d4d5586e5812d1ae0eebd571 ipu6-camera-hal / main / 884b81aae0ea19a974eb8ccdaeef93038136bdd4 ipu6-camera-bins / main / 276859fc6de83918a32727d676985ec40f31af2b icamerasrc / icamerasrc_slim_api / 17841ab6249aaa69bd9b3959262bf182dee74111

sudo -E gst-launch-1.0 icamerasrc buffer-count=7 device-name=ov2740-uf ! video/x-raw,format=NV12,width=1280,height=720 ! videoconvert ! ximagesink

almereyda commented 1 year ago

The internal refactoring as documented in the discussion at https://github.com/intel/icamerasrc/pull/31#discussion_r1184456155 still appears to be going on: The suggestion to checkout the tag 20230307_0904_rpl_plat does not result in this error to go away.

Did anyone have success in compiling icamerasrc against the current other ipu6 projects?


The tag that is suggested has the same syntax of the method call which causes the error as described in #32:

https://github.com/intel/icamerasrc/blob/17841ab6249aaa69bd9b3959262bf182dee74111/src/gstcamerasrc.cpp#L2840

As per the blame, this line is three years old

image

and also calls its alternative with less arguments, in case no virtual channels are to be stripped. Its configuration is disabled, yet the if is evaluated for the first case.

$ grep -A 1 STRIP_VIRTUAL_CHANNEL_CAMHAL config.log
configure:17570: checking check if STRIP_VIRTUAL_CHANNEL_CAMHAL is ON
configure:17577: result: no
--
USE_STRIP_VIRTUAL_CHANNEL_CAMHAL_FALSE=''
USE_STRIP_VIRTUAL_CHANNEL_CAMHAL_TRUE='#'

https://github.com/intel/icamerasrc/releases/tag/20230307_0904_rpl_plat has a different README than the branch https://github.com/intel/icamerasrc/tree/icamerasrc_slim_api, which does not mention export STRIP_VIRTUAL_CHANNEL_CAMHAL=ON anymore.

Checking out that tag and providing the additional export rule results in a successful build here.

Also everything below the comment in https://github.com/intel/icamerasrc/issues/28#issuecomment-1536801265 helped, plus the runcamera.sh script from https://askubuntu.com/a/1461869