Skip to contentSkip to conversation

package/libtomcrypt: add pkgconfig support

PATCH Superseded Peter Seiderer 4 participants 17 messages Apr 12, 2021 – May 7, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

---
 package/libtomcrypt/libtomcrypt.mk    |  3 +++
 package/libtomcrypt/libtomcrypt.pc.in | 10 ++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 package/libtomcrypt/libtomcrypt.pc.in
package/libtomcrypt/libtomcrypt.mk +3 -0
index fccd4b051c..fa6dde64cd 100644
@@ -27,6 +27,9 @@ define LIBTOMCRYPT_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" \
 		PREFIX=/usr NODOCS=1 INSTALL_USER=$(shell id -u) \
 		INSTALL_GROUP=$(shell id -g) install
+	$(INSTALL) -D -m 0644 package/libtomcrypt/libtomcrypt.pc.in \
+		$(STAGING_DIR)/usr/lib/pkgconfig/libtomcrypt.pc
+	$(SED) "s/@PACKAGE_VERSION@/${LIBTOMCRYPT_VERSION}/" $(STAGING_DIR)/usr/lib/pkgconfig/libtomcrypt.pc
 endef
 
 $(eval $(generic-package))
package/libtomcrypt/libtomcrypt.pc.in new file +10 -0
new file mode 100644
index 0000000000..14a010e216
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: LibTomCrypt
+Description: public domain open source cryptographic toolkit
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -ltomcrypt
+Cflags: -I${includedir}
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/3 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

Fixes:

.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

---
 package/libtomcrypt/libtomcrypt.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libtomcrypt/libtomcrypt.mk +1 -1
index fa6dde64cd..b6ad77daec 100644
@@ -17,7 +17,7 @@ LIBTOMCRYPT_DEPENDENCIES = libtommath
 # 0001-fix-CVE-2019-17362.patch
 LIBTOMCRYPT_IGNORE_CVES += CVE-2019-17362
 
-LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC
+LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -fPIC -DLTC_SOURCE -DLTM_DESC
 
 define LIBTOMCRYPT_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="$(LIBTOMCRYPT_CFLAGS)"
Signature · 1 line
2.31.1
#2 lore raw

PATCH 2/3 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

Quoted 5 lines · On Mon, 12 Apr 2021 21:55:26 +0200 Peter Seiderer <[email protected]> wrote:

Fixes:

.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

In which situations? Are there some autobuilder failures? If not, what configuration fails?

Thomas

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

PATCH 2/3 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

Hello Thomas,

Quoted 11 lines · Thomas Petazzoni
Quoted 5 lines · On Mon, 12 Apr 2021 21:55:26 +0200 Peter Seiderer <[email protected]> wrote:

Fixes:

.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

In which situations? Are there some autobuilder failures? If not, what configuration fails?

Failure with an custom project which links libtomcrpyt to/into a dynamic library (x86_64)...., sorry no autobuilder failure (there is only one libtomcrypt cosumer in buildroot until now, dopbear)...

Regards,
Peter

Quoted 2 lines

Thomas

#4 lore raw

PATCH 2/3 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

In reply to Peter Seiderer
Quoted 14 lines · Peter Seiderer

Fixes:

.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

---
 package/libtomcrypt/libtomcrypt.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libtomcrypt/libtomcrypt.mk +0 -0
index fa6dde64cd..b6ad77daec 100644

package/libtomcrypt/libtomcrypt.mk LIBTOMCRYPT_DEPENDENCIES = libtommath · line 20

Quoted 5 lines
package/libtomcrypt/libtomcrypt.mk +1 -1
@@ -17,7 +17,7 @@ LIBTOMCRYPT_DEPENDENCIES = libtommath
 # 0001-fix-CVE-2019-17362.patch
 LIBTOMCRYPT_IGNORE_CVES += CVE-2019-17362
 
-LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC
+LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -fPIC -DLTC_SOURCE -DLTM_DESC

On some architectures, -fPIC is incompatible with static builds. So this should
probably only be done in non-static builds.

Marked as Changes Requested.

Regards,
Arnout

Quoted 4 lines
package/libtomcrypt/libtomcrypt.mk +0 -0
 define LIBTOMCRYPT_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="$(LIBTOMCRYPT_CFLAGS)"
 
#5 lore raw

PATCH 2/3 package/libtomcrypt: compile with -fPIC to enable linking to dynamic libraries/exectuables

Hello Arnout,

Quoted 18 lines · Arnout Vandecappelle
Quoted 17 lines · Peter Seiderer

Fixes:

.../x86_64-buildroot-linux-gnu/bin/ld: .../host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libtomcrypt.a(md5.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

---
 package/libtomcrypt/libtomcrypt.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libtomcrypt/libtomcrypt.mk +0 -0
index fa6dde64cd..b6ad77daec 100644
@@ -17,7 +17,7 @@ LIBTOMCRYPT_DEPENDENCIES = libtommath
 # 0001-fix-CVE-2019-17362.patch
 LIBTOMCRYPT_IGNORE_CVES += CVE-2019-17362
 
Quoted 5 lines

package/libtomcrypt/libtomcrypt.mk LIBTOMCRYPT_DEPENDENCIES = libtommath · line 20

Quoted 2 lines
package/libtomcrypt/libtomcrypt.mk +1 -1
-LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC
+LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -fPIC -DLTC_SOURCE -DLTM_DESC

On some architectures, -fPIC is incompatible with static builds. So this should
probably only be done in non-static builds.

O.k., will fix it...., thanks for review!

Regards,
Peter

Quoted 10 lines

Marked as Changes Requested.

Regards,
Arnout

Quoted 4 lines
package/libtomcrypt/libtomcrypt.mk +0 -0
 define LIBTOMCRYPT_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) CFLAGS="$(LIBTOMCRYPT_CFLAGS)"
 
#6 lore raw

PATCH 3/3 package/libtomcrypt: update home page URL to https

In reply to Peter Seiderer

- update home page URL to https

---
 package/libtomcrypt/Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libtomcrypt/Config.in +1 -1
index a7c5f50015..2459cd21e8 100644
@@ -8,4 +8,4 @@ config BR2_PACKAGE_LIBTOMCRYPT
 	  functions, chaining modes, pseudo-random number generators,
 	  public key cryptography and a plethora of other routines.
 
-	  http://www.libtom.net
+	  https://www.libtom.net
Signature · 1 line
2.31.1
#7 lore raw

PATCH 3/3 package/libtomcrypt: update home page URL to https

Quoted 3 lines · Peter Seiderer

- update home page URL to https

Applied to master, thanks.

Regards,
Arnout

Quoted 15 lines
---
 package/libtomcrypt/Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libtomcrypt/Config.in +1 -1
index a7c5f50015..2459cd21e8 100644
@@ -8,4 +8,4 @@ config BR2_PACKAGE_LIBTOMCRYPT
 	  functions, chaining modes, pseudo-random number generators,
 	  public key cryptography and a plethora of other routines.
 
-	  http://www.libtom.net
+	  https://www.libtom.net
#10 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

Hello Thomas,

Quoted 7 lines · Thomas Petazzoni
Quoted 1 line · On Mon, 12 Apr 2021 21:55:25 +0200 Peter Seiderer <[email protected]> wrote:

Is there any specific motivation? Does this had a chance of going upstream ?

For an custom project, previously developed on with cmake on ubuntu (which provides the pkgconfig file)....

Can try to suggest upstream...

Regards,
Peter

Quoted 4 lines

Thanks!

Thomas

#11 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

Quoted 9 lines · Peter Seiderer

Hello Thomas,

Quoted 5 lines · Thomas Petazzoni
Quoted 1 line · On Mon, 12 Apr 2021 21:55:25 +0200 Peter Seiderer <[email protected]> wrote:
Quoted 7 lines
Quoted 2 lines

Is there any specific motivation? Does this had a chance of going upstream ?

For an custom project, previously developed on with cmake on ubuntu (which provides the pkgconfig file)....

Can try to suggest upstream...

Adding a .pc file in Buildroot usually doesn't make much sense, because no
package that depends on it is going to use it. So yes, please organise this upstream.

Therefore, I've marked this patch as Rejected.

Regards,
Arnout

#12 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

Hello Arnout,

Quoted 13 lines · Arnout Vandecappelle
Quoted 12 lines · Peter Seiderer

Hello Thomas,

Quoted 7 lines · Thomas Petazzoni
Quoted 1 line · On Mon, 12 Apr 2021 21:55:25 +0200 Peter Seiderer <[email protected]> wrote:

Is there any specific motivation? Does this had a chance of going upstream ?

Quoted 8 lines
Quoted 4 lines

For an custom project, previously developed on with cmake on ubuntu (which provides the pkgconfig file)....

Can try to suggest upstream...

Adding a .pc file in Buildroot usually doesn't make much sense, because no
package that depends on it is going to use it. So yes, please organise this upstream.

But a buildroot provided library should be usable for buildroot packages AND out-of-tree/custom packages?

Nevertheless, did take a second look at the libtomcrypt sources, already providing a libtomcrypt.pc.in template (but only used/installed in case of 'makefile.shared'/'makefile.unix' and the buildroot compile uses the default 'makefile' one)...

Regards,
Peter

Quoted 5 lines

Therefore, I've marked this patch as Rejected.

Regards,
Arnout

#13 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

Quoted 20 lines · Peter Seiderer

Hello Arnout,

Quoted 16 lines · Arnout Vandecappelle
Quoted 15 lines · Peter Seiderer

Hello Thomas,

Quoted 7 lines · Thomas Petazzoni
Quoted 1 line · On Mon, 12 Apr 2021 21:55:25 +0200 Peter Seiderer <[email protected]> wrote:

Is there any specific motivation? Does this had a chance of going upstream ?

For an custom project, previously developed on with cmake on ubuntu (which provides the pkgconfig file)....

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Can try to suggest upstream...

Adding a .pc file in Buildroot usually doesn't make much sense, because no
package that depends on it is going to use it. So yes, please organise this upstream.

But a buildroot provided library should be usable for buildroot packages AND out-of-tree/custom packages?

What I mean is the following. A .pc file is useless unless a package that uses
libtomcrypt actually uses pkg-config to configure it. If the .pc file is not provided by libtomcrypt itself, but only by buildroot, then no package that depends on libtomcrypt is going to use pkg-config, because they "think" there is no .pc file for libtomcrypt. So we would have to patch each and every user of libtomcrypt to use pkg-config instead of whatever discovery mechanism they have. And none of these patches are upstreamable, because there is no .pc file outside of buildroot.

Quoted 4 lines

Nevertheless, did take a second look at the libtomcrypt sources, already providing a libtomcrypt.pc.in template (but only used/installed in case of 'makefile.shared'/'makefile.unix' and the buildroot compile uses the default 'makefile' one)...

That of course changes the story completely.

Do you know if there is a reason for us not to use makefile.unix, so we don't
need to sed the .pc file ourselves?

Regards,
Arnout

Quoted 10 lines

Regards,
Peter

Quoted 5 lines

Therefore, I've marked this patch as Rejected.

Regards,
Arnout

#14 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

Hello Arnout,

Quoted 45 lines · Arnout Vandecappelle
Quoted 20 lines · Peter Seiderer

Hello Arnout,

Quoted 16 lines · Arnout Vandecappelle
Quoted 15 lines · Peter Seiderer

Hello Thomas,

Quoted 7 lines · Thomas Petazzoni
Quoted 1 line · On Mon, 12 Apr 2021 21:55:25 +0200 Peter Seiderer <[email protected]> wrote:

Is there any specific motivation? Does this had a chance of going upstream ?

For an custom project, previously developed on with cmake on ubuntu (which provides the pkgconfig file)....

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Can try to suggest upstream...

Adding a .pc file in Buildroot usually doesn't make much sense, because no
package that depends on it is going to use it. So yes, please organise this upstream.

But a buildroot provided library should be usable for buildroot packages AND out-of-tree/custom packages?

What I mean is the following. A .pc file is useless unless a package that uses
libtomcrypt actually uses pkg-config to configure it. If the .pc file is not provided by libtomcrypt itself, but only by buildroot, then no package that depends on libtomcrypt is going to use pkg-config, because they "think" there is no .pc file for libtomcrypt. So we would have to patch each and every user of libtomcrypt to use pkg-config instead of whatever discovery mechanism they have. And none of these patches are upstreamable, because there is no .pc file outside of buildroot.

Quoted 4 lines

Nevertheless, did take a second look at the libtomcrypt sources, already providing a libtomcrypt.pc.in template (but only used/installed in case of 'makefile.shared'/'makefile.unix' and the buildroot compile uses the default 'makefile' one)...

Quoted 4 lines

That of course changes the story completely.

Do you know if there is a reason for us not to use makefile.unix, so we don't
need to sed the .pc file ourselves?

No..., it is used since the introduction of libtomcrypt (2016), maybe because it is the default or because it uses less/no predefined compile vars which needs to be patched/overwritten...

By the way, libtomcrypt depends on libtommath which used -fPIC unconditionally...

Regards,
Peter

Quoted 18 lines

Regards,
Arnout

Quoted 10 lines

Regards,
Peter

Quoted 5 lines

Therefore, I've marked this patch as Rejected.

Regards,
Arnout

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#15 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

Quoted 1 line · Peter Seiderer

By the way, libtomcrypt depends on libtommath which used -fPIC unconditionally...

So, apparently I'm just full of s**t when I say -fPIC sometimes fails in static
builds... Weird, I really *do* remember that...

Ah, here I have it: [1] It doesn't lead to build failures, it's just less
performant and useless in static builds. It turns out, however, that we unconditionally pass -fPIC in dozens of packages. So one more doesn't really hurt I guess.

Regards,
Arnout

[1]
https://patchwork.ozlabs.org/project/buildroot/patch/20210209104726.20132-1-kremneva at synopsys.com/

#16 lore raw

PATCH 1/3 package/libtomcrypt: add pkgconfig support

Hello Arnout,

Quoted 10 lines · Arnout Vandecappelle
Quoted 1 line · Peter Seiderer

By the way, libtomcrypt depends on libtommath which used -fPIC unconditionally...

So, apparently I'm just full of s**t when I say -fPIC sometimes fails in static
builds... Weird, I really *do* remember that...

Ah, here I have it: [1] It doesn't lead to build failures, it's just less
performant and useless in static builds. It turns out, however, that we unconditionally pass -fPIC in dozens of packages. So one more doesn't really hurt I guess.

Thanks for insight, can send (at least) a patch for libtommath to change the -fPIC usage only for the non static case...

Regards,
Peter

Quoted 12 lines

Regards,
Arnout

[1]
https://patchwork.ozlabs.org/project/buildroot/patch/20210209104726.20132-1-kremneva at synopsys.com/

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot