Skip to contentSkip to conversation

package/libcamera: link with atomic when needed

PATCH New Fabrice Fontaine 4 participants 10 messages Sep 5, 2019 – Sep 26, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

 ...son.build-link-with-atomic-when-need.patch | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch
package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch new file +28 -0
new file mode 100644
index 0000000000..8c34497db4
@@ -0,0 +1,28 @@
+From 85b7aeef3c7765c5ba7e525c63a4c0f807f0bfc8 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Thu, 5 Sep 2019 10:24:31 +0200
+Subject: [PATCH] src/libcamera/meson.build: link with atomic when needed
+
+Fixes:
+ - http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/libcamera/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
+index c5d8f11..0706a08 100644
+--- a/src/libcamera/meson.build
++++ b/src/libcamera/meson.build
+@@ -99,6 +99,7 @@ version_cpp = vcs_tag(command : [gen_version, meson.build_root()],
+ libcamera_sources += version_cpp
+ 
+ libcamera_deps = [
++    cc.find_library('atomic', required: false),
+     cc.find_library('dl'),
+     libudev,
+     dependency('threads'),
+-- 
+2.23.0.rc1
+
Signature · 1 line
2.23.0.rc1
#1 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Hi Fabrice,

Thank you for the updated patch, This looks like a good workable upstream solution.

Quoted 18 lines · Fabrice Fontaine

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

 ...son.build-link-with-atomic-when-need.patch | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch
package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch new file +0 -0
new file mode 100644
index 0000000000..8c34497db4

package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch line 5

Quoted 5 lines
package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch new file +5 -0
@@ -0,0 +1,28 @@
+From 85b7aeef3c7765c5ba7e525c63a4c0f807f0bfc8 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Thu, 5 Sep 2019 10:24:31 +0200
+Subject: [PATCH] src/libcamera/meson.build: link with atomic when needed
+

How about something a bit more descriptive here, something like:

"Sparc and MIPS compilers use an external library to provide atomic functionality. Detect and link against libatomic when needed."

Then if you could instead post it to:
libcamera-devel at lists.libcamera.org

we can get it integrated upstream and update the version sha on this package instead.

Quoted 7 lines
package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch new file +7 -0
+Fixes:
+ - http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/libcamera/meson.build | 1 +
+ 1 file changed, 1 insertion(+)

package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch line 22

Quoted 10 lines
package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch new file +10 -0
+
+diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
+index c5d8f11..0706a08 100644
+--- a/src/libcamera/meson.build
++++ b/src/libcamera/meson.build
+@@ -99,6 +99,7 @@ version_cpp = vcs_tag(command : [gen_version, meson.build_root()],
+ libcamera_sources += version_cpp
+ 
+ libcamera_deps = [
++    cc.find_library('atomic', required: false),

Great - this works out to be quite elegant and simple.

--
Kieran

Quoted 7 lines
package/libcamera/0001-src-libcamera-meson.build-link-with-atomic-when-need.patch new file +6 -0
+     cc.find_library('dl'),
+     libudev,
+     dependency('threads'),
+-- 
+2.23.0.rc1
+
Signature · 3 lines
Regards
--
Kieran
#2 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

In reply to Fabrice Fontaine
Quoted 7 lines · On Thu, 5 Sep 2019 18:53:06 +0200 Fabrice Fontaine…

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

Applied to master, thanks. Could you send the patch upstream, after taking into account the comments from Kieran ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Hi Thomas,

Quoted 6 lines · Thomas Petazzoni
Quoted 3 lines · On Thu, 5 Sep 2019 18:53:06 +0200 Fabrice Fontaine…

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

Quoted 6 lines
Quoted 4 lines

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

Applied to master, thanks.

Great, thanks for collecting this.

Quoted 2 lines

Could you send the patch upstream, after
taking into account the comments from Kieran ?

This fix has already been integrated into libcamera master :

https://git.linuxtv.org/libcamera.git/commit/?id=5d05418d9b53e1838692f687a6dc373dad45355c

I haven't sent a version-bump patch yet, because we've got usages of O_TMPFILE in our tests, which even with making our build depend on kernel headers > 3.11 - I still saw failures in some toolchains.

Do you know of a 'failsafe' way to build on all (or skip) toolchains when we make use of O_TMPFILE?

I've tried adding:

+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_10
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 # Still 6 failures
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11

But I still get failures related to the O_TMPFILE usage.

(Yes, I know each HEADERS_AT_LEAST brings in the older dependencies as well, but I started at 3_11)

Cheers

Kieran

Quoted 4 lines

Thanks!

Thomas

Signature · 3 lines
Regards
--
Kieran
#4 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Hi Kieran,
Le dim. 15 sept. 2019 ? 22:45, Kieran Bingham
<[email protected]> a ?crit :

Quoted 27 lines

Hi Thomas,

Quoted 6 lines · Thomas Petazzoni
Quoted 3 lines · On Thu, 5 Sep 2019 18:53:06 +0200 Fabrice Fontaine…

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

Quoted 6 lines
Quoted 4 lines

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

Applied to master, thanks.

Great, thanks for collecting this.

Quoted 2 lines

Could you send the patch upstream, after
taking into account the comments from Kieran ?

This fix has already been integrated into libcamera master :

https://git.linuxtv.org/libcamera.git/commit/?id=5d05418d9b53e1838692f687a6dc373dad45355c

Quoted 6 lines

I haven't sent a version-bump patch yet, because we've got usages of O_TMPFILE in our tests, which even with making our build depend on kernel headers > 3.11 - I still saw failures in some toolchains.

Do you know of a 'failsafe' way to build on all (or skip) toolchains when we make use of O_TMPFILE?

There is a pretty long thread about O_TMPFILE in the context of runc
here: https://patchwork.ozlabs.org/patch/1044933.
You can also find the commit log for runc's patch here:
https://git.buildroot.net/buildroot/commit/package/runc/?id=905e976a6af224b3ed015c46fcea2d717c155f55

Quoted 19 lines

I've tried adding:

(quoted diff) +3 -0
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_10
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 # Still 6 failures
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11

But I still get failures related to the O_TMPFILE usage.

(Yes, I know each HEADERS_AT_LEAST brings in the older dependencies as well, but I started at 3_11)

Cheers

Kieran

Quoted 2 lines

Thanks!

Quoted 7 lines
Quoted 2 lines

Thomas

--
Regards
--
Kieran

Best Regards,

Fabrice

#5 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Hi Fabrice,

Thank you for the references, at least it wasn't me doing something distinctly wrong!

Quoted 34 lines · Fabrice Fontaine

Hi Kieran,
Le dim. 15 sept. 2019 ? 22:45, Kieran Bingham
<[email protected]> a ?crit :

Quoted 31 lines

Hi Thomas,

Quoted 6 lines · Thomas Petazzoni
Quoted 3 lines · On Thu, 5 Sep 2019 18:53:06 +0200 Fabrice Fontaine…

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

Quoted 6 lines
Quoted 4 lines

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

Applied to master, thanks.

Great, thanks for collecting this.

Quoted 2 lines

Could you send the patch upstream, after
taking into account the comments from Kieran ?

This fix has already been integrated into libcamera master :

https://git.linuxtv.org/libcamera.git/commit/?id=5d05418d9b53e1838692f687a6dc373dad45355c

I haven't sent a version-bump patch yet, because we've got usages of O_TMPFILE in our tests, which even with making our build depend on kernel headers > 3.11 - I still saw failures in some toolchains.

Quoted 6 lines
Quoted 2 lines

Do you know of a 'failsafe' way to build on all (or skip) toolchains when we make use of O_TMPFILE?

There is a pretty long thread about O_TMPFILE in the context of runc
here: https://patchwork.ozlabs.org/patch/1044933.
You can also find the commit log for runc's patch here:
https://git.buildroot.net/buildroot/commit/package/runc/?id=905e976a6af224b3ed015c46fcea2d717c155f55

I don't really see a resolution in there except for adding a whole bunch of architecture specific definitions (and a hacky workaround for non-support) of O_TMPFILE into libcamera.

Is that the expected resolution here?

I really doubt libcamera could be used on old toolchains without O_TMPFILE support, as it requires media specific features from new kernels anyway.

Is there a clean way to mark libcamera as not supported on /really/ old toolchains?

Quoted 29 lines
Quoted 18 lines

I've tried adding:

(quoted diff) +3 -0
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_10
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 # Still 6 failures
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11

But I still get failures related to the O_TMPFILE usage.

(Yes, I know each HEADERS_AT_LEAST brings in the older dependencies as well, but I started at 3_11)

Cheers

Kieran

Quoted 2 lines

Thanks!

Quoted 7 lines
Quoted 2 lines

Thomas

--
Regards
--
Kieran

Best Regards,

Fabrice

Signature · 3 lines
Regards
--
Kieran
#6 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Le lun. 16 sept. 2019 ? 13:40, Kieran Bingham
<[email protected]> a ?crit :

Quoted 53 lines

Hi Fabrice,

Thank you for the references, at least it wasn't me doing something distinctly wrong!

Quoted 34 lines · Fabrice Fontaine

Hi Kieran,
Le dim. 15 sept. 2019 ? 22:45, Kieran Bingham
<[email protected]> a ?crit :

Quoted 31 lines

Hi Thomas,

Quoted 6 lines · Thomas Petazzoni
Quoted 3 lines · On Thu, 5 Sep 2019 18:53:06 +0200 Fabrice Fontaine…

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

Quoted 6 lines
Quoted 4 lines

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

Applied to master, thanks.

Great, thanks for collecting this.

Quoted 2 lines

Could you send the patch upstream, after
taking into account the comments from Kieran ?

This fix has already been integrated into libcamera master :

https://git.linuxtv.org/libcamera.git/commit/?id=5d05418d9b53e1838692f687a6dc373dad45355c

I haven't sent a version-bump patch yet, because we've got usages of O_TMPFILE in our tests, which even with making our build depend on kernel headers > 3.11 - I still saw failures in some toolchains.

Quoted 6 lines
Quoted 2 lines

Do you know of a 'failsafe' way to build on all (or skip) toolchains when we make use of O_TMPFILE?

There is a pretty long thread about O_TMPFILE in the context of runc
here: https://patchwork.ozlabs.org/patch/1044933.
You can also find the commit log for runc's patch here:
https://git.buildroot.net/buildroot/commit/package/runc/?id=905e976a6af224b3ed015c46fcea2d717c155f55

I don't really see a resolution in there except for adding a whole bunch of architecture specific definitions (and a hacky workaround for non-support) of O_TMPFILE into libcamera.

Quoted 8 lines

Is that the expected resolution here?

I really doubt libcamera could be used on old toolchains without O_TMPFILE support, as it requires media specific features from new kernels anyway.

Is there a clean way to mark libcamera as not supported on /really/ old toolchains?

From my understanding, there is no clean way to check for the availability of O_TMPFILE.
However, O_TMPFILE is only used by tests and tests can be disabled through -Dtest=false.

Quoted 29 lines
Quoted 29 lines
Quoted 20 lines

I've tried adding:

(quoted diff) +3 -0
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_10
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_0 # Still 6 failures
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11

But I still get failures related to the O_TMPFILE usage.

(Yes, I know each HEADERS_AT_LEAST brings in the older dependencies as well, but I started at 3_11)

Cheers

Kieran

Quoted 2 lines

Thanks!

Quoted 7 lines
Quoted 2 lines

Thomas

--
Regards
--
Kieran

Best Regards,

Quoted 7 lines
Quoted 2 lines

Fabrice

--
Regards
--
Kieran

Best Regards,

Fabrice

#7 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Hi Fabrice,

Quoted 4 lines · Fabrice Fontaine

Le lun. 16 sept. 2019 ? 13:40, Kieran Bingham
<[email protected]> a ?crit :

Quoted 2 lines

Hi Fabrice,

<snip>

Quoted 6 lines
Quoted 2 lines

Is there a clean way to mark libcamera as not supported on /really/ old toolchains?

From my understanding, there is no clean way to check for the availability of O_TMPFILE.
However, O_TMPFILE is only used by tests and tests can be disabled through -Dtest=false.

You're right. Disabling tests was renamed from -Dtests=false to -Dtest=false.

The buildroot package was already disabling tests through -Dtests=false, so if we fix this up - then the tests will no longer be built again, and we won't have any issue with O_TMPFILE ...

Problem (well two problems) solved :-D

Thanks I should have remembered to fix up the -Dtests issue when I knew it was being changed!

Do you want to update the buildroot package and bump the version? or shall I do it?

Signature · 3 lines
Regards
--
Kieran
#8 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

Le lun. 16 sept. 2019 ? 14:01, Kieran Bingham
<[email protected]> a ?crit :

Quoted 25 lines

Hi Fabrice,

Quoted 4 lines · Fabrice Fontaine

Le lun. 16 sept. 2019 ? 13:40, Kieran Bingham
<[email protected]> a ?crit :

Quoted 2 lines

Hi Fabrice,

<snip>

Quoted 6 lines
Quoted 2 lines

Is there a clean way to mark libcamera as not supported on /really/ old toolchains?

From my understanding, there is no clean way to check for the availability of O_TMPFILE.
However, O_TMPFILE is only used by tests and tests can be disabled through -Dtest=false.

You're right. Disabling tests was renamed from -Dtests=false to -Dtest=false.

The buildroot package was already disabling tests through -Dtests=false, so if we fix this up - then the tests will no longer be built again, and we won't have any issue with O_TMPFILE ...

Quoted 7 lines

Problem (well two problems) solved :-D

Thanks I should have remembered to fix up the -Dtests issue when I knew it was being changed!

Do you want to update the buildroot package and bump the version? or shall I do it?

I think it's better if you do it.

Quoted 4 lines

--
Regards
--
Kieran

Best Regards,

Fabrice

#9 lore raw

PATCH v2 1/1 package/libcamera: link with atomic when needed

In reply to Fabrice Fontaine
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Fixes:
- http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84

---
Changes v1 -> v2 (after review of Kieran Bingham):
- Use an upstreamable solution

Committed to 2019.05.x and 2019.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard