Liblinprog linkage?

While trying to fix an issue in the 64-bit version of my fork of ALEditor I saw a reference to $(CORELIBS) in the linker directive in the CMake build script. The strange part is that it works on 32-bit but not 64-bit.

The error I get suggests a symbol is undefined but it doesn’t get referenced until actually running the program. Given that every executable on Haiku is PIC and internally is a shared object, that shouldn’t be so surprising. My hypothesis is that there’s some startup code not getting linked correctly.

What is the error you get?

runtime_loader: /boot/home/ALEditor/libale.so: Could not resolve symbol ‘_ZN17LinearProgramming10Constraint8LeftSideEv’
resolve symbol “_ZN17LinearProgramming10Constraint8LeftSideEv” returned: -2147478780
runtime_loader: /boot/home/ALEditor/libale.so: Troubles relocating: Symbol not found

Edit:

The repo is at https://github.com/SamuraiCrow/ALEditor

I don’t think that CORELIBS variable does anything. Seems like the symbols from liblinprog.a aren’t being re-exported from libalm.so(or wherever) on the newer compilers. You might need to grab liblinprog.a from the Haiku sources to link against.

Thanks! I suspected as much WRT the CORELIBS variable. I’ll try finding liblinprog.a in the tree.

Having never been able to build Haiku from source due to some infinite recursion in the Jamfile or Jamrules, I started looking for tickets related to liblinprog and it seems that ticket #8518 makes reference to a .so version of liblinprog. Does it exist? If so, I haven’t been able to find it. Is the ALMLayout class ticket linked above underway?

.a is a static library, .so a shared one.
You don’t need to build either from source if they are shipped.

Check with:
find /system/develop/headers/ linproc
find /system/lib/ linproc

It’s probably sufficient to add linproc to the last line of the cmake, after the other libs. maybe liblinproc instead of just linproc

I already tried that. It isn’t supplied but I did find it in the Haiku sources. It appears to be part of interface kit. Shouldn’t that be brought in by libbe though?

Edit

It’s not LinproC its linproG with a G. Its in the Haiku sources under src/libs/linprog/ so it’s not really included by interface kit at all?

Update:

LibALM.so is included in the linkage already. Maybe what I need is not another linker target but find out why ALM isn’t exporting symbols?

There was a change in haiku build to avoid “leaking” symbols from static libraries when they are used in shared libraries.

Before this change, linking with libalm would have allowed to access the liblinprog functions. Now it is not possible anymore. This is necessary because we use static libraries to hrovide some internals/private functions inside Haiku sources.

But it breaks this specific case, wqere the exporting of linprog functions by libalm was intentional. So we have to adjust the build of libalm to export the symbols again.

3 Likes