Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Request for Relative Paths

Open Platin21 opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. The feature I request is the ability to add rpath's to frameworks and so/lib/dylib files so that the can be relative to some point and are not required to be inside the runtime linker search path.

This is something that is only for Linux and MacOS interesting.

  • For MacOS it's because of .app's requiring the lib's to be internal in the .app container and signed if it's not a system library
  • For Linux there are similar executable containers that make this maybe interesting also the commands are roughly the same.

Describe the solution you'd like My Proposal would be something in that ballpark:

foreign import libclang "libclang@app/libs/"

The other option would be to have a relative path search path flag added to the compiler:

odin build main.odin -relative_path="@app/libs/"

I'm not sure which of these two ways is better but one thing that is important is to change the nameingconvention of the relative identifiers as writing out @executable_path and so on is pretty awful. My proposal in that regard would be to have:

@app = @executable_path (on macOS this actually points to the .app folder) @bin = @loader_path (this points to the folder containing the actual binary this can be set for libraries and also executables)

Additional context https://blog.krzyzanowskim.com/2018/12/05/rpath-what/ https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW19

Platin21 avatar Apr 05 '21 13:04 Platin21

Couldn't we overload the collection system to do this? Like how system is reserved. We could have system_app and system_bin.

gingerBill avatar Apr 05 '21 13:04 gingerBill

As in -collection=MyLib:@bin/lib thing is just it's not really per library that's what sucks a bit about it. Like one doesn't need to add a rpath to each library they added.

Or did you mean we just collect all the paths and add them once and depending how one does do system_app or system_bin ?

So say for example:

foreign import clang "system_app:/lib/libclang" 

Would still required one to define somehow the system_app path as it doesn't need to be the same every time. E.g “one cannot just simply” for this that path and for that this path with the from you proposed way.

Platin21 avatar Apr 05 '21 14:04 Platin21

Hello!

I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue

  • open a PR referencing and resolving the issue;
  • leave a comment on it and discuss ideas how you could contribute towards resolving it;
  • leave a comment and describe in detail why this issue is critical for your use case;
  • open a new issue with updated details and a plan on resolving the issue.

The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..

github-actions[bot] avatar Jul 24 '22 21:07 github-actions[bot]

Github bot again..

Platin21 avatar Dec 23 '22 21:12 Platin21

I’ll make a pr with both versions and let’s see what feels better we can certainly add a rpath flag..

Platin21 avatar Dec 23 '22 21:12 Platin21

Bump.

flysand7 avatar Oct 17 '23 06:10 flysand7