Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move j1939 applications to a separate repository #587

Open
hartkopp opened this issue Mar 3, 2025 · 29 comments
Open

move j1939 applications to a separate repository #587

hartkopp opened this issue Mar 3, 2025 · 29 comments
Assignees

Comments

@hartkopp
Copy link
Member

hartkopp commented Mar 3, 2025

All,

after my failure to build the latest can-utils code with the plain Makefile here 71b2aec#commitcomment-153191516 , I thought about the dependency to libgps-dev over night.

IMO the problem is not in the Makefile but in the libgps dependency.

The can-utils are self-contained and aim to provide a bunch of tools to interact with the CAN subsystem in the Linux kernel. It can be easily compiled on every system that has a C-compiler and 'make' - even on offline systems with outdated kernel includes.
It has tools to send and receive content to the CAN_RAW/CAN_ISOTP/CAN_J1939 sockets, where things can be stored, replayed and analyzed in detail. We also have J1939 tools

PROGRAMS_J1939 := \
	j1939acd \
	j1939cat \
	j1939spy \
	j1939sr \
	testj1939

for a while now which is fine.

Recently @olerem contributed J1939 applications that do not fit the idea of "simple tools to interact with the CAN subsystem in the Linux kernel" anymore. There is a good reason why we don't have the socketcand inside the can-utils or a full blown UDS diagnosis application that randomly uses CAN_ISOTP. So why do we have a j1939-vehicle-position-srv application in can-utils??

IMHO the J1939 applications (where I also assume that only a minority of CAN users is interested in anyway) got out of control - and I would suggest to create a separate repository (e.g. can-j1939.git or can-j1939-utils.git or j1939-utils.git) to host the recently contributed J1939 applications.

@marckleinebudde
Copy link
Member

marckleinebudde commented Mar 3, 2025

There was a dedicated j1939 repo in the past, but we merged it here.

To ease the pain with your use-case, have a look at #588 and #589.

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

That does not address my general concerns on this topic.
IMO a j1939-vehicle-position-srv has no justification to be in can-utils.

@marckleinebudde
Copy link
Member

Then let's move it out of here.

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

Thanks! I'm not sure which j1939 applications make sense to remain in can-utils.
I'm not generally against j1939 tools here - but it should be something on the level of cansend or isotpsend and not an application suite which continuously grows.

@marckleinebudde
Copy link
Member

Probably move:

  • isobusfs
  • j1939_vehicle_position
  • j1939_timedate

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

Yes, those are the really big chunks that are already clustered in directories.
@olerem , would this be ok for you too?
@marckleinebudde does it make sense to split up the j1939 lib stuff or link the can-utils repo from the j1939-utils repo to have the code only in one place?

@marckleinebudde
Copy link
Member

What do you mean by link one repo to the other? If the libs in can-utils provide code that's uses by the j1939-utils, IMHO the can-utils must install these libs. The next issue to think about is the licensing of those those libs.

See #578 (comment)

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

I was thinking of libj1939.h and libj1939.c
AFAICS either $PROGRAMS_J1939 are referencing this code as well as isobusfs, j1939_vehicle_position, j1939_timedate

@marckleinebudde
Copy link
Member

Yes, but what do you mean by

link the can-utils repo from the j1939-utils repo

?

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

I have seen, that you can have a git repository where you have e.g. a directory which points to another git repo with a specific commit. A bit like a symbolic link that needs to be pulled and updated before you can build your code.
I'm not sure how this process/concept is named.

It was:
git submodule init
git submodule update

@yegorich
Copy link
Contributor

yegorich commented Mar 3, 2025

Submodules are good but I don't think, it makes the life of a package maintainer in Debian, Buildroot, etc. easier.

@marckleinebudde
Copy link
Member

What about using shared libraries?

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

Submodules are good but I don't think, it makes the life of a package maintainer in Debian, Buildroot, etc. easier.

ok

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

What about using shared libraries?

Does that make things more complicated with installation, versioning, etc?

E.g. if you build candump for an embedded device you would like to hack then you currently only need to copy a single binary which can be executed. Without the need for installing the shared lib in a read-only filesystem.

@marckleinebudde
Copy link
Member

Does that make things more complicated with installation, versioning, etc?

Choose your poison --- Split the code base or not.

@yegorich
Copy link
Contributor

yegorich commented Mar 3, 2025

"Shared" library, as long as it doesn’t make "dynamic" calls, will be mostly shipped in both *.so and *.a variants. Hence, there should be no problems in getting only a single candump binary.

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

Sorry for my missing basics ... but how to I get a single candump binary after the build process generated a "dynamic" candump binary file and some *.so and *.a files?

@yegorich
Copy link
Contributor

yegorich commented Mar 3, 2025

Just an example of possible packages:

  • can-utils: provides/installs both candump and friends as also libcanutils.[a,so]
  • j1939tools: provides j1939 binaries and libj1939utils.[a,so] and depends on can-utils

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

Does that make things more complicated with installation, versioning, etc?

Choose your poison --- Split the code base or not.

The j1939lib was very stable and unchanged for a long time. Therefore I would not have bad feelings to split the code base in this specific case.

@yegorich
Copy link
Contributor

yegorich commented Mar 3, 2025

@hartkopp this a tutorial about the creating a static library.

But you can also pass a full path to the *.a file to link. See this answer. This way, you can override ld standard behaviour that will look for *.so first.

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

So it could be possible to run 'make' in a way that it creates dynamically linked binaries OR statically linked binaries?
When this is handy to use, it would be fine for me.

@marckleinebudde
Copy link
Member

It would be cmake .. && make

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

But this would require cmake then

@marckleinebudde
Copy link
Member

We can keep the Makefile as is, i.e. static linking everything. In cmake we can create static and shared libs and install them.

@hartkopp
Copy link
Member Author

hartkopp commented Mar 3, 2025

That's great!

@BubuOT
Copy link

BubuOT commented Mar 11, 2025

When bumping this package in buildroot it came up that a full static build of can-utils no longer succeeds because when building with cmake libisobusfs is now unconditionally built as a shared library (https://github.com/linux-can/can-utils/blob/master/CMakeLists.txt#L132) if I understood the problem correctly?

There's two logs of failed builds because of that here: https://gitlab.com/jolivain/buildroot/-/jobs/9348149565 and https://gitlab.com/jolivain/buildroot/-/jobs/9348149479

I thought this might be a good place to ask if building can-utils without shared library support is going to be a supported use-case.

@yegorich
Copy link
Contributor

@BubuOT does #593 fix your issue?

@marckleinebudde
Copy link
Member

@BubuOT does #593 fix your issue?

At least it compiles the lib static, merged.

@BubuOT
Copy link

BubuOT commented Mar 12, 2025

@yegorich yes, looks all good now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants