erezgeva / libptpmgmt

Library to communicate with linuxptp using IEEE 1558 management messages over Unix network. The library provide functionality that is provided by the pmc tool of the linuxptp project.
Other
24 stars 5 forks source link

Build failure on cross toolchain configured with only shared libraries #13

Closed psadro closed 4 months ago

psadro commented 4 months ago

Compiling the library on a system with only shared libraries results in a build failure, as all of the libtool .lo files only have the PIC objects. I don't see a configure option to disable static linking.

ar rcs libptpmgmt.a objs/bin.o objs/buf.o objs/cfg.o objs/err.o objs/init.o objs/json.o objs/jsonDef.o objs/msgCall.o objs/msg.o objs/opt.o objs/proc.o objs/ptp.o objs/sig.o objs/sock.o objs/ver.o;/home/.../arm64/host/bin/aarch64-linux-gcc-ranlib libptpmgmt.a ar: objs/bin.o: No such file or directory

# cat objs/bin.lo # objs/bin.lo - a libtool object file # Generated by libtool (GNU libtool) 2.4.6 # # Please DO NOT delete this file! # It is necessary for linking the library.

# Name of the PIC object. pic_object='.libs/bin.o'

# Name of the non-PIC object non_pic_object=none

erezgeva commented 4 months ago

The static libraries are optional, user can choose what library to use. That is why I did not provide a flag to disable static link.

I understand the problem is that your libtool do not compile the static object. I did saw this bizarre behaviour, but not on a Linux machine.

I will probe it on the configure stage and use alternative. But I need to test it. What system do you use?

psadro commented 4 months ago

Hello Erez,

I am building on Ubuntu 20.04 (kernel 5.4.0-105)

My cross tools are based on gcc-8.3-2.0 libtool version info:

linuxBldRoot> output/arm64/host/bin/libtool --version

libtool (GNU libtool) 2.4.6 Written by Gordon Matzigkeit, 1996

Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Pete

On Tue, Jul 16, 2024 at 4:36 AM Erez Geva @.***> wrote:

The static libraries are optional, user can choose what library to use. That is why I did not provide a flag to disable static link.

I understand the problem is that your libtool do not compile the static object. I did saw this blizzard behaviour, but not on a Linux machine.

I will probe it on the configure stage and use alternative. But I need to test it. What system do you use?

— Reply to this email directly, view it on GitHub https://github.com/erezgeva/libptpmgmt/issues/13#issuecomment-2230333893, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ36MQRAHIJEUUHS5J7UYYLZMTLRRAVCNFSM6AAAAABK4YATWKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZQGMZTGOBZGM . You are receiving this because you authored the thread.Message ID: @.***>

-- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.

erezgeva commented 4 months ago

Cross building on Ubuntu. Good luck.

I always get in trouble when I build on Ubuntu. One of the reason I steak with Debian.

But to the point.

In principle you can use Ubuntu native libtool. No need for a "cross tool" of libtool.

For cross compiling you need cross GCC (gcc, g++) cross libc and libstdc++ (as we use C++). The selection of cross compiling and cross libraries depends on target. In case the target is also Ubuntu, you may use Ubuntu own cross compiling and cross libraries.

Of course if the target is not Ubuntu or you want something else, you can build or download a proper cross compiling and cross libraries.

However the libtool can be native in any case. Or at lease build it properly with support for static libraries. As I mention. you do not have to use any static library.

I see no reason to support bizarre libtool on Ubuntu. I may add support in the future. But no promise.

erezgeva commented 4 months ago

Let me explain why it is bizarre.

GNU Libtool - The GNU Portable Library Tool

The tool was desing to build both static and dynamic libraries. That it is why it is called the Library Tool. It is possible to build the tool, and exclude static libraries, but there is no real reason to do so. Most Linux system including Ubuntu use a proper configured libtool.

I except to use a proper Libtool which compile both.

$ libtool --features
host: x86_64-pc-linux-gnu
enable shared libraries
enable static libraries

The build time for the static libraries is neglectable. And you can simple ignore the static libraries if you do not need them. That is the reason I add support for packaging, and add the static libraries to the development package.

erezgeva commented 4 months ago

See: Motivation for writing libtool

erezgeva commented 4 months ago

Hi @psadro,

I update Integrate a local libtool with configuration on master branch.

I hope this version works better with your cross compilation on Ubuntu.

If you have more issues, please share them. I do try to fix and make the project more friendly. You are also welcome to pull request changes.

Yours Erez