[LU-7356] configure --disable-shared broken for server builds Created: 29/Oct/15  Updated: 05/Aug/17  Resolved: 05/Aug/17

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.8.0
Fix Version/s: Lustre 2.11.0

Type: Bug Priority: Minor
Reporter: James A Simmons Assignee: Nathaniel Clark
Resolution: Fixed Votes: 0
Labels: patch

Issue Links:
Related
is related to LU-5541 improve liblustreapi build Resolved
Epic/Theme: build
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

While testing LU-5541 patch it was discovered that if you use --disable-shared for configure for lustre that lustre snmp and the mount utility components for zfs and ldiskfs will not build. This is due to the Makefiles hardcoding the --shared option.



 Comments   
Comment by Peter Jones [ 30/Oct/15 ]

Nathaniel

Could you please advise?

Thanks

Peter

Comment by James A Simmons [ 31/Oct/15 ]

Just to make people aware the patch from LU-5541 does not cause the breakage.What is causing this breakage is in two spots. One is in snmp/Makefile.am:

lustresnmp_la_CFLAGS := -fPIC $(NET_SNMP_CFLAGS)
lustresnmp_la_LDFLAGS = -fPIC -shared -module -avoid-version

Both -fPIC -shared are shared file options.

Same problem exist in lustre/utils/Makefile.am:

mount_osd_ldiskfs_la_LDFLAGS := -shared -export-dynamic -module -avoid-version
...
mount_osd_zfs_la_LDFLAGS += -shared -export-dynamic -module -avoid-version

Comment by James A Simmons [ 01/Nov/15 ]

Looking the the configuration the question is do we want to keep mount_osd_[zfs|ldisk]fs.so as dynamic plugins when --disable-shared is enabled or make the *.so files merge into mount_lustre like a true static file.

Comment by Nathaniel Clark [ 05/Nov/15 ]

This will require changing how the build works for those plugins when disable-shared is used. It should be doable. It will also require a change in lustre/utils/mount_utils.c since we explicitly load the .so files.

Comment by James A Simmons [ 05/Nov/15 ]

I wonder if ltdl library to make dlopen portal would be the solution for both static and dynamic loading for mount_utils.c?

Comment by Nathaniel Clark [ 11/Nov/15 ]

I'm not sure it would. ZFS doesn't ship with .a files so the mount_osd_zfs.so would have to be dynamically linked to libzfs unless zfs was built with different options than default.

Comment by James A Simmons [ 11/Nov/15 ]

In that case the best option would be to create a temporary *.a file and turn it into a
*.so. Much like what liblustreapi.* does. This avoids the libtool configure --disable-sharedinfluence.

Comment by Nathaniel Clark [ 17/Nov/15 ]

James,
Do you mean change the ZFS build to create libzfs.a along with libzfs.so? I don't think there's a way to convert a .so to a .a. If you know of a way do to this, can you please share it with me? If you don't I don't see a way to resolve this issue.

Comment by John Fuchs-Chesney (Inactive) [ 03/Dec/15 ]

James,

Looks like we are not going to be able to progress this any further. If you have any new ideas you would like us to investigate, please let us know.

Thanks,
~ jfc.

Comment by James A Simmons [ 04/Dec/15 ]

Please don't close this ticket. It is a real bug. What I like to recommend at this point is to do the reverse Nathaniel. We create a static library and if shared libraries are supported then convert it to a shared library. liblustreapi.so actually does this approach today.

Comment by Nathaniel Clark [ 04/Dec/15 ]

James,

libzfs.so is provided by the libzfs2-devel package from ZFS on Linux. A patch would need to be pushed upstream to have libzfs2-devel include static versions, then those would be need to used to build a statically linked version of mount_osd_zfs.so. But the end result would still be a .so file, just statically linked, because it's explicitly dlloaded by mount/mkfs/tunefs utils.

Or am I still misunderstanding your view of this?

~ Nathaniel

Comment by James A Simmons [ 04/Dec/15 ]

The --disable-shared flags only matter if you use libtool to build the zfs mount module code. Currently it doesn't build due to the build system using lib tool. I will play with it once I get home.

Comment by Gerrit Updater [ 13/Dec/15 ]

James Simmons (uja.ornl@yahoo.com) uploaded a new patch: http://review.whamcloud.com/17576
Subject: LU-7356 build: fix --disable-shared configure option
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 028df461ff16d0c83c8cb2edc6ee53b31b9f6085

Comment by Gerrit Updater [ 14/Dec/15 ]

James Simmons (uja.ornl@yahoo.com) uploaded a new patch: http://review.whamcloud.com/17581
Subject: LU-7356 build: handle static/shared configure option for mount plugin
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: ffa58f79c3303ea02b24b799086f3181ec4c2e66

Comment by James A Simmons [ 14/Dec/15 ]

Nathaniel I submitted two patches to handle this issue. The first patch makes the lustre SNMP and liblnetconfig to obey the configure --disable-shared --disable-static. That is straight forward and . The challenge is the mount plugins. The mount plugins are always built as dynamic using libtool but libtool always obeys the configure options. So if you do a configure --disable-shared this breaks the mount plugins build. The approach I took was to not use libtool with the mount plugins. First I build it as a static library then link it into a dynamic library type code. I broke the mount plugin changes out from the original patch since dlopen didn't like what I did so I'm doing something wrong but I feel it is a good starting point.

Comment by Nathaniel Clark [ 15/Dec/15 ]

They look good. I updated the second to account some debug code in mount_utils.c.

Comment by Gerrit Updater [ 06/Jan/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/17576/
Subject: LU-7356 build: handle library configure options for SNMP/LNet
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 75f07b2fa054b69d1c20eef8dddb831af41fd7a5

Comment by James A Simmons [ 06/Jan/16 ]

A patch is still needed to handle building the mount plugins when --disable-shared is set.

Comment by James A Simmons [ 25/Jan/16 ]

Nathaniel did you ever make any progress on this?

Comment by James A Simmons [ 26/Jan/16 ]

Looked at the patch with fresh eyes and I see the problem. I needed to link in libdl explicitly in the Makefile. Just tested it with --disabled-shared and normal configuration and it worked.

Comment by Nathaniel Clark [ 26/Jan/16 ]

I reviewed patch and restarted autotest as you requested.

Comment by James A Simmons [ 26/Jan/16 ]

Thank you.

Comment by Christopher Morrone [ 27/Jan/16 ]

Must we do this? Do we really care that --disable-shared doesn't work? I would prefer that we stick with the simple cleaner libtool method unless there is a really, really, good reason to need a static build.

Comment by James A Simmons [ 27/Jan/16 ]

Yes due to Oleg making this a requirement for the LU-5541 work. In Oleg's personal testing he uses the static versions of things. The ugliness is mainly due to liblustreapi not being built with libtool. That changes in the first LU-5541 patch

Comment by Christopher Morrone [ 27/Jan/16 ]

Ah, I see. Thanks for the explanation.

Comment by James A Simmons [ 21/Apr/17 ]

Nathaniel I updated the patch. Easy work since it mostly was done. Now if you do a --disable-shared the mount plugins will be built into the utilities. This should make Oleg happy.

Comment by Gerrit Updater [ 05/Aug/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/17581/
Subject: LU-7356 build: handle configure options for mount plugin
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: d6f57eda898cc80a1cff49ad3875021749563dbf

Generated at Sat Feb 10 02:08:11 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.