This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error: L6218E: Undefined symbol pairing

hi
i got this error ( am using keilv4 for cortex m0 )
.\code.axf: Error: L6218E: Undefined symbol __gmpz_clear (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol __gmpz_get_si (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol __gmpz_init (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol element_from_bytes_compressed (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol element_from_bytes_x_only (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol element_pow2_mpz (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol element_pow3_mpz (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol element_printf (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol element_to_bytes_compressed (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol element_to_bytes_x_only (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol pairing_clear (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol pairing_init_set_buf (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol pbc_die (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol pbc_free (referred from bls.o).
.\code.axf: Error: L6218E: Undefined symbol pbc_malloc (referred from bls.o).

please does anyone have an idea how can i solve these errors
thankx

  • So - you seem to be using the PCB and GMB libraries - but why did you not tell us that directly? Wouldn't knowledge about the relevant libraries be an important part for anyone who should answer?

    crypto.stanford.edu/.../
    https://gmplib.org/

    The linker misses code. Shouldn't you make sure you have included all source files or maybe all prebuilt library files?

  • well i didn't think that mentioning the libraries would make a difference
    i thought that such an error may occur no matter what library we use
    Truthfully am not an expert here it's been 3 years since the last time i programmed a simple c code "hello world" but here i am struggling to understand how to manipulate a c code and to implement it to the FPGA
    well sorry to ask what did you mean by prebuilt library ?
    and about the included sources files they have been all added to the project in fact these "undefined symbols " are in fact defined in the associated header files .

  • The header files are only there to tell the compiler that it should accept a source file that references symbols mentioned in the header file.

    But you need the implementation too. And that needs to either come in a source file, or precompiled in an object file, or merged with other object files into a library file.

    Missing a header file gives you issues with the compiler.

    Missing to add the required source files, object files or libraries to the project gives you issues with the linker.

    And since libraries normally comes with documentation, it does matter what libraries you are using - and where you got them from - since that decides where you might find the required documentation. And it matters when looking for other users that might have experience with the specific libraries.

    In your case, the linker mentions symbol names it sees that you try to reference - but it hasn't found any actual implementation. Now you have to figure out where you have that missing source code. Or the missing object files. Or the missing libraries.

    If you have issues with your car - don't you think it's important to mention brand, model and model year when you want help or want to buy spare parts?

    In the end, when asking for help, it often hurts to supply too little information - but it very seldom hurts to supply a bit too much information.

  • well sorry if i offended you by not mentioning my libraries
    but as i said am still a beginner here so i didn't know how to use you suggestion :'(
    as you have remarked am using the plc and gmp libraries i read the documentation that you have sent to me but am still stuck in my problem
    here are the included .h files :
    in my bls code
    #include "pbc.h"
    #include "pbc_test.h"
    then within the pbc.h
    #include <stdarg.h>
    #include <stdio.h>
    #include <stdint.h>
    #include <stdlib.h>
    #include "gmp.h"
    #include "pbc_utils.h"
    #include "pbc_field.h"
    #include "pbc_param.h"
    #include "pbc_pairing.h"
    #include "pbc_curve.h"
    #include "pbc_mnt.h"
    #include "pbc_a1_param.h"
    #include "pbc_a_param.h"
    #include "pbc_d_param.h"
    #include "pbc_e_param.h"
    #include "pbc_f_param.h"
    #include "pbc_g_param.h"
    #include "pbc_i_param.h"
    #include "pbc_random.h"
    #include "pbc_memory.h"

  • Hi mariam,

    The problem may not be in your code. You may have correctly included the header files but for the all the variables/functions declared in those header files, it must have a definition of those.

    So as Per Westermark already said, you need the Libraries implementation files: the source files (.c/.cpp) OR the object files (.o) OR the Library file (*.lib) included in your project.

    Check the Libraries documentation and associated supplied files that came with library.

    Regards,
    Girish Thavai

  • crystal clear thank you Mr Girish Thavai and Mr Per Westermark

  • hi
    since i filed to generate the implementation libraries files with msys emulation tool i had to change my code
    the new code is about calculating energy, ETX and the position of nodes in WSN it includes:
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include "ESSAI2.h"

    however i get this warning warning: #223-D: function "min" declared implicitly
    then this error
    Error: L6218E: Undefined symbol min (referred from main.o).

    from other discussions i got to know that it's not a Linker issue

    But i couldn't rectify it ..please do you have any hint to help me

  • Hi mariam,

    Go through the Keil Help Manual for List of Errors and Warning. An error starting with L is a linker error.

    From your warning and error, it seems the prototype for min() is incorrect or header file is not included or the that function is not defined the cause for generating that linker error.

    Regards,
    Girish Thavai

  • however i get this warning warning: #223-D: function "min" declared implicitly
    then this error
    Error: L6218E: Undefined symbol min (referred from main.o).

    a) You used a function without prototyping it, so the compiler made assumptions about the parameters passed.

    b) The actual functional code required is not provided anywhere in your project, or it's library files, and the linker can't find it.

    The solution would be to determine which include file defines this macro, or provide a macro or function in your own code that does so.

  • well thank you i found the prob now
    actually in my math.h the minimum is defined as fmin and not min

  • fmin() isn't really suitable.

    min() and max() aren't a required part of stdlib.h, although often there.

    stackoverflow.com/.../min-and-max-in-c

    The common implementation looks like this

    /* min and max macros */
    
    #define max(a,b)    (((a) > (b)) ? (a) : (b))
    #define min(a,b)    (((a) < (b)) ? (a) : (b))
    

    Try Google, it really works...