Giter Club home page Giter Club logo

Comments (2)

joakin avatar joakin commented on September 23, 2024

A couple of things I learnt looking into ld:

  • If you switch the -l/home/joakin/dev/forks/Odin/vendor/raylib/linux/libraylib.so.5.0.0 for -l:/home/joakin/dev/forks/Odin/vendor/raylib/linux/libraylib.so.5.0.0 with the colon, it seems to link fine
  • Another way is to add the folder with -L and then the lib name separately with -l, like so: -L/home/joakin/dev/forks/Odin/vendor/raylib/linux -lraylib which also compiles fine if you remove the original -l argument that was failing

Poking I've found some logic here:

Odin/src/linker.cpp

Lines 406 to 422 in 4c35633

// NOTE(vassvik): static libraries (.a files) in linux can be linked to directly using the full path,
// since those are statically linked to at link time. shared libraries (.so) has to be
// available at runtime wherever the executable is run, so we make require those to be
// local to the executable (unless the system collection is used, in which case we search
// the system library paths for the library file).
if (string_ends_with(lib, str_lit(".a")) || string_ends_with(lib, str_lit(".o"))) {
// static libs and object files, absolute full path relative to the file in which the lib was imported from
lib_str = gb_string_append_fmt(lib_str, " -l:\"%.*s\" ", LIT(lib));
} else if (string_ends_with(lib, str_lit(".so"))) {
// dynamic lib, relative path to executable
// NOTE(vassvik): it is the user's responsibility to make sure the shared library files are visible
// at runtime to the executable
lib_str = gb_string_append_fmt(lib_str, " -l:\"%s/%.*s\" ", cwd, LIT(lib));
} else {
// dynamic or static system lib, just link regularly searching system library paths
lib_str = gb_string_append_fmt(lib_str, " -l%.*s ", LIT(lib));
}

Where it seems like it is checking for .so extension for dynamic libraries at the end of the file name, while the raylib library ends with the version number instead libraylib.so.5.0.0.

If this is the issue I'm not sure if changing the name of the dyn library or the logic for that check would be the way to go.

from odin.

joakin avatar joakin commented on September 23, 2024

From discord

laytan — Today at 1:32 PM
So the fix is probably checking for the version thingy after the .so too
in our linker code

from odin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.