Metin2 Client.bin.lz

Metin2 Client.bin.lz 3,5/5 6571 reviews

I created a cpp project, which used a lib file named: libblpapi3_64.soThis file comes from a library which I download it from Internet.

Client 28788. Plenty 28787. Offense 8450. Confident 8450. Slightly 8445. Ministry 5106. Tortured 5105. Challengers 229. Insinuations 229. Mightier 229. Hola, hoy vengo a brindarles la solucion al problema de patchs en la carga del Metin2 es porque estube durante varias semanas sin poder hacerlo andar eh intente las opciones que les mostrare para que puedan hacer andar el juego rapido sin demoras. Metin2.exe - original dll file, download here. One click to download this file. Repair your system.

My project runs without any error. So I update it to bitbucket.Then my colleague downloads it and runs it at his own computer. But he gets an error:

usr/bin/ld: cannot find -lblpapi3_64.

In fact, I have copied it into my project repository. I mean I created a file named lib under my project and all lib files that I used are in it.

There are also other lib files such as liblog4cpp.a, but they are all good. Only the libblpapi3_64.so gets the error.

Is it because it's a .so file not .a file? Or there is other reason?
Btw, the file name of libblpapi3_64.so is green and others files(.a) is white. I think it's not a link file, it's the original file.

YvesYves

2 Answers

Briefly:

ld does not know about where your project libs are located. You have to place it into ld's known directories or specify the full path of your library by -L parameter to the linker.

To be able to build your program you need to have your library in /bin/ld search paths and your colleague too. Why? See detailed answer.

Detailed:

At first, we should understand what tools do what:

  1. The compiler produces simple object files with unresolved symbols (it does not care about symbols so much at it's running time).
  2. The linker combines a number of object and archive files, relocates their data and ties up symbol references into a single file: an executable or a library.

Let's start with some example. For example, you have a project which consists of 3 files: main.c, func.h and func.c.

main.c

func.h

Lz Baldy

func.c

So, when you compile your source code (main.c) into an object file (main.o) it can't be run yet because it has unresolved symbols. Let's start from the beginning of producing an executable workflow (without details):

The preprocessor after its job produces the following main.c.preprocessed:

and the following func.c.preprocessed:

As you may see in main.c.preprocessed, there are no connections to your func.c file and to the void func()'s implementation, the compiler simply does not know about it, it compiles all the source files separately. So, to be able to compile this project you have to compile both source files by using something like cc -c main.c -o main.o and cc -c func.c -o func.o, this will produce 2 object files, main.o and func.o. func.o has all it's symbols resolved because it has only one function which body is written right inside the func.c but main.o does not have func symbol resolved yet because it does not know where it is implemented.

Let's look what is inside func.o:

Simply, it contains a symbol which is in text code section so this is our func function.

And let's look inside main.o:

Our main.o has an implemented and resolved static function main and we are able to see it in the object file. But we also see func symbol which marked as unresolved U, and thus we are unable to see its address offset.

For fixing that problem, we have to use the linker. It will take all the object files and resolve all these symbols (void func(); in our example). If the linker somehow is unable to do that it throws a error like unresolved external symbol: void func(). This may happen if you don't give the func.o object file to the linker. So, let's give all the object files we have to the linker:

The linker will go through main.o, then through func.o, try to resolve symbols and if it goes okay - put it's output to the test file. If we look at the produced output we will see all symbols are resolved:

Here our job is done. Let's look the situation with dynamic(shared) libraries. Let's make a shared library from our func.c source file:

Voila, we have it. Now, let's put it into known dynamic linker library path, /usr/lib/:

And let's make our project depend on that shared library by leaving func() symbol unresolved after compilation and static linkage process, creating an executable and linking it (dynamically) to our shared library (libfunc):

Adam Lz Merch

Now if we look for the symbol in its symbols table we still have our symbol unresolved:

But this is not a problem anymore because func symbol will be resolved by dynamic loader before each program start. Okay, now let's back to the theory.

Libraries, in fact, are just the object files which are placed into a single archive by using ar tool with a single symbols table which is created by ranlib tool.

Compiler, when compiling object files, does not resolve symbols. These symbols will be replaced to addresses by a linker. So resolving symbols can be done by two things: the linker and dynamic loader:

  1. The linker: ld, does 2 jobs:

    a) For static libs or simple object files, this linker changes external symbols in the object files to the addresses of the real entities. For example, if we use C++ name mangling linker will change _ZNK3MapI10StringName3RefI8GDScriptE10ComparatorIS0_E16DefaultAllocatorE3hasERKS0_ to 0x07f4123f0.

    b) For dynamic libs it only checks if the symbols can be resolved (you try to link with correct library) at all but does not replace the symbols by address. If symbols can't be resolved (for example they are not implemented in the shared library you are linking to) - it throws undefined reference to error and breaks up the building process because you try to use these symbols but linker can't find such symbol in it's object files which it is processing at this time. Otherwise, this linker adds some information to the ELF executable which is:

    i. .interp section - request for an interpreter - dynamic loader to be called before executing, so this section just contains a path to the dynamic loader. If you look at your executable which depends on shared library (libfunc) for example you will see the interp section $ readelf -l a.out:

    ii. .dynamic section - a list of shared libraries which interpreter will be looking for before executing. You may see them by ldd or readelf:

    Note that ldd also finds all the libraries in your filesystem while readelf only shows what libraries does your program need. So, all of these libraries will be searched by dynamic loader (next paragraph).The linker works at build time.

    My Goddess Bye Bye Belldandy Artbook   Ah! My Goddess Colours   Ah! My Goddess Artbook and Postcards   Ah! My Goddess 2003 Calendar   Ah! Satoshi urushihara illustrations rar. My Goddess Artbook   Ah!

  2. Dynamic loader: ld.so or ld-linux. It finds and loads all the shared libraries needed by a program (if they were not loaded before), resolves the symbols by replacing them to real addresses right before the start of the program, prepares the program to run, and then runs it. It works after the build and before running the program. Less speaking, dynamic linking means resolving symbols in your executable before each program start.

Actually, when you run an ELF executable with .interp section (it needs to load some shared libraries) the OS (Linux) runs an interpreter at first but not your program. Otherwise you have an undefined behavior - you have symbols in your program but they are not defined by addresses which usually means that the program will be unable to work properly.

Adam Lz Youtube

You may also run dynamic loader by yourself but it is unnecessary (binary is /lib/ld-linux.so.2 for 32-bit architecture elf and /lib64/ld-linux-x86-64.so.2 for 64-bit architecture elf).

Why does the linker claim that /usr/bin/ld: cannot find -lblpapi3_64 in your case? Because it tries to find all the libraries in it's known paths. Why does it search the library if it will be loaded during runtime? Because it needs to check if all the needed symbols can be resolved by this library and to put it's name into the .dynamic section for dynamic loader. Actually, the .interp section exists in almost every c/c++ elf because the libc and libstdc++ libraries are both shared, and compiler by default links any project dynamically to them. You may link them statically as well but this will enlarge the total executable size. So, if the shared library can't be found your symbols will remain unresolved and you will be UNABLE to run your application, thus it can't produce an executable. You may get the list of directories where libraries are usually searched by:

Metin2 client.bin.lzm
  1. Passing a command to the linker in compiler arguments.
  2. By parsing ld --verbose's output.
  3. By parsing ldconfig's output.
Metin2 Client.bin.lz

Some of these methods are explained here.

Dynamic loader tries to find all the libraries by using:

  1. DT_RPATH dynamic section of an ELF file.
  2. DT_RUNPATH section of the executable.
  3. LD_LIBRARY_PATH environment variable.
  4. /etc/ld.so.cache - own cache file which contains a compiled list of candidate libraries previously found in the augmented library path.
  5. Default paths: In the default path /lib, and then /usr/lib. If the binary was linked with -z nodeflib linker option, this step is skipped.

Also, note please, that if we are talking about shared libraries, they are not named .so but in .so.version format instead. When you build your application the linker will look for .so file (which is usually a symlink to .so.version) but when you run your application the dynamic loader looks for .so.version file instead. For example, let's say we have a library test which version is 1.1.1 according to semver. In the filesystem it will look like:

So, to be able to compile you must have all of versioned files (libtest.so.1, libtest.so.1.1 and libtest.so.1.1.1) and a libtest.so file but for running your app you must have only 3 versioned library files listed first. This also explains why do Debian or rpm packages have devel-packages separately: normal one (which consists only of the files needed by already compiled applications for running them) which has 3 versioned library files and a devel package which has only symlink file for making it possible to compile the project.

Resume

After all of that:

  1. You, your colleague and EACH user of your application code must have all the libraries in their system linker paths to be able to compile (build your application). Otherwise, they have to change Makefile (or compile command) to add the shared library location directory by adding -L<somePathToTheSharedLibrary> as argument.
  2. After successful build you also need your library again to be able to run the program. Your library will be searched by dynamic loader (ld-linux) so it needs to be in it's paths (see above) or in system linker paths. In most of linux program distributions, for example, games from steam, there is a shell-script which sets the LD_LIBRARY_PATH variable which points to all shared libraries needed by the game.
Victor PolevoyVictor Polevoy

You could look at our Rblapi package which uses this very library too.

Your basic question of 'how do I make a library visible' really has two answers:

  1. Use ld.so. The easiest way is to copy blpapi3_64.so to /usr/local/lib. If you then call ldconfig to update the cache you should be all set. You can test this via ldconfig -p grep blpapi which should show it.

  2. Use an rpath instruction when building your application; this basically encodes the path and makes you independent of ld.so.

Dirk EddelbuettelDirk Eddelbuettel

Not the answer you're looking for? Browse other questions tagged c++ or ask your own question.