Skip to contentSkip to conversation

flex: not to build shared libraries

PATCH In review Chong Lu 4 participants 9 messages Mar 5, 2014 – Mar 7, 2014

lore
Share & tools
lore

Chong Lu

author
#0 lore raw

cover flex: not to build shared libraries

The following changes since commit f03955041d0e44d377ca1c4def630982f24f1e8b:

Revert "ncurses: use ln -r to generate relative symlink" (2014-03-03 15:55:27 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib chonglu/flex
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=chonglu/flex

Chong Lu (1):
flex: not to build shared libraries

 .../files/flex-not-to-build-shared-libraries.patch | 39 ++++++++++++++++++++++
 meta/recipes-devtools/flex/flex.inc                |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-devtools/flex/files/flex-not-to-build-shared-libraries.patch
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 1/1 flex: not to build shared libraries

Some packages do not link successfully using shared libraries. When link something to libfl.so, we will get this:

libfl.so: undefined reference to `yylex'

So we only build static libraries to fix this issue.

---
 .../files/flex-not-to-build-shared-libraries.patch | 39 ++++++++++++++++++++++
 meta/recipes-devtools/flex/flex.inc                |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-devtools/flex/files/flex-not-to-build-shared-libraries.patch
meta/recipes-devtools/flex/files/flex-not-to-build-shared-libraries.patch new file +39 -0
new file mode 100644
index 0000000..a50569f
@@ -0,0 +1,39 @@
+flex: not to build shared libraries
+
+Some packages do not link successfully using shared libraries.
+When link something to libfl.so, we will get this:
+
+	libfl.so: undefined reference to `yylex'
+
+So we only build static libraries to fix this issue.
+
+Upstream-Status: Pending
+
+Signed-off-by: Chong Lu <[email protected]>
+---
+ Makefile.am |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 1f90356..f3638aa 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -73,13 +73,13 @@ libfl_la_SOURCES = \
+ 	libmain.c \
+ 	libyywrap.c
+ 
+-libfl_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
++libfl_la_LDFLAGS = -all-static -no-undefined -version-info @SHARED_VERSION_INFO@
+ 
+ libfl_pic_la_SOURCES = \
+ 	libmain.c \
+ 	libyywrap.c
+ 
+-libfl_pic_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
++libfl_pic_la_LDFLAGS = -all-static -no-undefined -version-info @SHARED_VERSION_INFO@
+ 
+ noinst_HEADERS = \
+ 	flexdef.h \
+-- 
+1.7.9.5
+
meta/recipes-devtools/flex/flex.inc +1 -0
index 75c10ef..616f4d7 100644
@@ -7,6 +7,7 @@ SECTION = "devel"
 LICENSE = "BSD"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/flex/flex-${PV}.tar.bz2 \
+           file://flex-not-to-build-shared-libraries.patch \
            file://run-ptest \
 "
 
Signature · 1 line
1.8.1.2
#2 lore raw
Quoted 5 lines · Chong Lu

Some packages do not link successfully using shared libraries. When link something to libfl.so, we will get this:

libfl.so: undefined reference to `yylex'

Quoted 8 lines

So we only build static libraries to fix this issue.

---
 .../files/flex-not-to-build-shared-libraries.patch | 39 ++++++++++++++++++++++
 meta/recipes-devtools/flex/flex.inc                |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-devtools/flex/files/flex-not-to-build-shared-libraries.patch

Why aren't the shared libraries working? Which packages show this problem? Is this not a problem in the recipes using the shared libraries?

At the very least this patch needs more explanation but I don't like the idea.

Cheers,

Richard

#8 lore raw
In reply to Chong Lu
Quoted 4 lines · Chong Lu

Some packages do not link successfully using shared libraries. When link something to libfl.so, we will get this:

libfl.so: undefined reference to `yylex'

Isn't that generally because the makefile is doing it wrong, for example linking the lexer in C++ mode instead of C?

Remove a shared library and forcing everyone to static link doesn't seem like a long-term solution to me.

Ross

author
#3 lore raw
In reply to Richard Purdie
Quoted 18 lines · Richard Purdie
Quoted 5 lines · Chong Lu

Some packages do not link successfully using shared libraries. When link something to libfl.so, we will get this:

libfl.so: undefined reference to `yylex'

Quoted 8 lines

So we only build static libraries to fix this issue.

---
  .../files/flex-not-to-build-shared-libraries.patch | 39 ++++++++++++++++++++++
  meta/recipes-devtools/flex/flex.inc                |  1 +
  2 files changed, 40 insertions(+)

create mode 100644 meta/recipes-devtools/flex/files/flex-not-to-build-shared-libraries.patch

Why aren't the shared libraries working? Which packages show this problem? Is this not a problem in the recipes using the shared libraries?

Quoted 9 lines

At the very least this patch needs more explanation but I don't like the idea.

Cheers,

Richard

In flex 2.5.38, libfl.so was built by libtool.

ipsec-tools shows this problem.
When link libipsec.so to libfl.so, it uses '-lfl' flag. It will link from libfl.so. But libfl.so doesn't define yylex, we may get "libfl.so not found" through `ldd libipsec.so'. If we only build static libraries, libipsec.so will not link to libfl.so. it will link to libfl.a. Then libipsec.so uses yylex function by itself rather than libfl.so provided.

In Mageia distribution, revert building libraries with libtool.
http://www.rpmfind.net//linux/RPM/mageia/cauldron/x86_64/media/core/release/flex-2.5.38-1.mga5.x86_64.html
And in flex 2.5.37 version, it will only generate static libraries.
So in order to ignore blocking some packages(likes ipsec-tools), I have two ways to fix this issue.
1. revert building libraries with libtool.
2. modify libtool to make it only build static libraries.
I choose the second way. The same result to first.

Best Regards
Chong

#4 lore raw
Quoted 8 lines · Lu Chong

In Mageia distribution, revert building libraries with libtool.
http://www.rpmfind.net//linux/RPM/mageia/cauldron/x86_64/media/core/release/flex-2.5.38-1.mga5.x86_64.html
And in flex 2.5.37 version, it will only generate static libraries. So in order to ignore blocking some packages(likes ipsec-tools), I have two ways to fix this issue.
1. revert building libraries with libtool.
2. modify libtool to make it only build static libraries.
I choose the second way. The same result to first.

Same result apart from that there is no longer a shared libfl.so anymore, so it's not the same.

Mageia's solution is cleaner as it only impacts ipsec-tools, but I'd have thought it could be solved without having to revert using libtool (as the error suggests its an as-needed ordering problem).

Ross

#5 lore raw
In reply to Lu Chong
Quoted 8 lines · Lu Chong

In flex 2.5.38, libfl.so was built by libtool.

ipsec-tools shows this problem.
When link libipsec.so to libfl.so, it uses '-lfl' flag. It will link from libfl.so.
But libfl.so doesn't define yylex, we may get "libfl.so not found" through `ldd libipsec.so'.

I've used flex before, this is correct, libfl is not supposed to define yylex. See for example
https://www.mail-archive.com/[email protected]/msg00601.html

The problem is in how ipsec-tools is being linked, not in flex. I'd suggest patching that recipe instead.

Cheers,

Signature · 4 lines
Paul Barker

Email: [email protected]
http://www.paulbarker.me.uk
#6 lore raw
Quoted 10 lines · Paul Barker
Quoted 8 lines · Lu Chong

In flex 2.5.38, libfl.so was built by libtool.

ipsec-tools shows this problem.
When link libipsec.so to libfl.so, it uses '-lfl' flag. It will link from libfl.so.
But libfl.so doesn't define yylex, we may get "libfl.so not found" through `ldd libipsec.so'.

Quoted 9 lines

I've used flex before, this is correct, libfl is not supposed to define yylex. See for example
https://www.mail-archive.com/[email protected]/msg00601.html

The problem is in how ipsec-tools is being linked, not in flex. I'd suggest patching that recipe instead.

Cheers,

I've patched ipsec-tools to fix this, will send the patch to the oe-devel list.

Signature · 4 lines
Paul Barker

Email: [email protected]
http://www.paulbarker.me.uk
#7 lore raw
Quoted 15 lines · Paul Barker
Quoted 14 lines · Paul Barker
Quoted 8 lines · Lu Chong

In flex 2.5.38, libfl.so was built by libtool.

ipsec-tools shows this problem.
When link libipsec.so to libfl.so, it uses '-lfl' flag. It will link from libfl.so.
But libfl.so doesn't define yylex, we may get "libfl.so not found" through `ldd libipsec.so'.

I've used flex before, this is correct, libfl is not supposed to define yylex. See for example
https://www.mail-archive.com/[email protected]/msg00601.html

Quoted 8 lines
Quoted 5 lines

The problem is in how ipsec-tools is being linked, not in flex. I'd suggest patching that recipe instead.

Cheers,

I've patched ipsec-tools to fix this, will send the patch to the oe-devel list.

Sent.

Signature · 4 lines
Paul Barker

Email: [email protected]
http://www.paulbarker.me.uk