Opened 9 years ago

Closed 5 years ago

Last modified 4 years ago

#12184 closed bug (no change required)

'setarch x86' doesn't change LIBRARY_PATH

Reported by: haiqu Owned by: nobody
Priority: normal Milestone:
Component: Applications/Command Line Tools Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

When shelling into a GCC4 build environment with 'setarch x86', the PATH statement changes to point to the ~/x86 directories. LIBRARY_PATH should change likewise, but doesn't. This leads to 'library not found' errors, especially when using languages like Pascal.

Can be seen by dumping the environment to the terminal with the 'env' command.

Change History (7)

comment:1 by waddlesplash, 9 years ago

Component: - GeneralApplications/Command Line Tools
Keywords: path removed

comment:2 by pulkomandy, 9 years ago

The runtime_loader automatically adds the architecture suffix to the paths in LIBRARY_PATH (and same for add-ons). If you changed the LIBRARY_PATH, any gcc2 app would stop working (including bash, so you wouldn't go very far in your setarch environment).

The fact that some language's runtime are using/manipulating LIBRARY_PATH without taking this into account is not Haiku's problem. Please report this to the people working on Freepascal so they can add the suffix where needed.

The find_paths and BPathFinder APIs were introduced to make it easy for applications to find the correct paths. These function will do the appropriate manipulations and add the suffix as needed to the paths they return.

comment:3 by haiqu, 9 years ago

Yep, I see what you mean there. First noticed this in Lazarus (see #12112) and it seems any programming language that isn't GCC has the issue unless patched.

I'll look into it and see if I can come up with a fix.

comment:4 by waddlesplash, 9 years ago

No, any programming language which goes through the runtime_loader will work (GCC, LLVM-compiled languages e.g. Rust, etc.)

comment:5 by pulkomandy, 9 years ago

It's not related to gcc, but to the use of dynamic loading of libraries (dlopen, or the BeOS equivalent load_add_on). On linux it's common to locate the libraries using LD_LIBRARY_PATH then load them with dlopen, doing this in Haiku requires managing the architecture suffix. To make things easier for such apps we provide BPathFinder and find_path which will perform the path manipulations automatically.

Yes, this means some patching is needed, but LD_LIBRARY_PATH is Linux specific, and LIBRARY_PATH will work correctly on a gcc2 system when using gcc2 apps, so we don't break BeOS compatibility. So, I think Haiku has done its part of the job here.

comment:6 by waddlesplash, 5 years ago

Resolution: no change required
Status: newclosed

comment:7 by nielx, 4 years ago

Milestone: Unscheduled

Remove milestone for tickets with status = closed and resolution != fixed

Note: See TracTickets for help on using tickets.