How to add "-lsqlite3" option into makefile of an open source programe - linux

I want to test a function into an open source program, such as LLDPD, it will get input data from SQLite3 database, then output it. But there is always a problem that "undefined function sqlite3_open" when using "make" after "./configure".
I think this problem happens because I can't using "-lsqlite3" option when using "make" to compile lldp.c file - the file I modified.
I want to add "-lsqlite3" into the makefile to solve my problem, but I don't know it's legal or not?
If it's legal, could you give me some advice to do that? I really appreciate that.
Thank you so much for your time.

You can add link flags by setting LDFLAGS:
LDFLAGS="-lsqlite3" ./configure

Related

Where can I find the lua script of a Co-Simulation model in OMSimulator (OpenModelica)?

I am trying to run a co-simulation model using OMSimulator. I managed to create a FMU from a TRNSYS model thanks to this tool: https://sourceforge.net/projects/trnsys-fmu/
When I import it, I get the following error:
[2] 12:23:32 Scripting Error
[fmiLogger] module FMI2XML: Start attribute is required for this causality, variability and initial combination
It seems that I need to initialize some variables (not sure about what) in the OMSimulator command line. I think that it is the Lua script I heard about, but I cannot really find it.
I would really appreciate it someone could help me on this, since the documentation (https://openmodelica.org/doc/OMSimulator/v2.0.1/html/OMSimulator.html) it is not enough for my level.
Thanks!!!
It seems to be a problem with the FMU and not OMSimulator. The start value is required in the modelDescription.xml file of the FMU according to the FMI specification.

Is it possible to start a program with a missing shared library

I'm running Linux and have a situation like this:
A binary file 'bin1' loads via dlopen 'shared1.so' which is linked with 'shared2.so' and 'shared3.so'.
if 'shared2.so' or 'shared3.so' is missing the program 'bin1' won't run.
There are runs that I know that I won't touch any code from 'shared2.so' and I want 'bin1' to be able to run even when this library is missing, can this be done ?
You could ship program with dummy shared2.so library. You might need to add dummy functions which shared1 expects to find there. This can be done manually or via automatic tool like Implib.so.

Shared object missing from pin tool

When I compile my pin tool and run ldd on the pin tool shared object the shared objects libxed.so, libpin3dwarf.so, libdl-dynamic.so, libstlport-dynamic.so, and libc-dynamic.so all cannot be found. I thought it might be the makefile.rules file, as I modified it to link some other object files, but even when compiling an example pin tool provided in the pin directory the same problem occurs. Does anyone know what the problem may be?
To make ldd able to find them you can create a new conf file in /etc/ld.so.conf.d/ (/etc/ld.so.conf.d/pin.conf for instance). Then, inside this file, your need to provide paths to pin's dynamic libraries :
path_to_your_pin_folder/pin-3.0-76991-gcc-linux/ia32/runtime/pincrt
path_to_your_pin_folder/pin-3.0-76991-gcc-linux/intel64/runtime/pincrt/
path_to_your_pin_folder/pin-3.0-76991-gcc-linux/extras/xed-ia32/lib/
path_to_your_pin_folder/pin-3.0-76991-gcc-linux/extras/xed-intel64/lib/
path_to_your_pin_folder/pin-3.0-76991-gcc-linux/ia32/lib-ext/
path_to_your_pin_folder/pin-3.0-76991-gcc-linux/intel64/lib-ext/
Try adding the relevant directories to your LD_LIBRARY_PATH environment variable.

CMake Help find_path find_library - I just don't understand

I am trying to learn CMake. I have the Mastering CMake book and I'm trying to go through my first "easy" tutorial. Using CMake: Hello World Example
I made it through the first part alright, but when I tried to add the sub folders for the "Building a library" part of the tutorial I'm just not getting it. I followed the instructions all the way to the very end.
**We've seen an example of how to build a program. Now let's make a library as well. The library will be called "namer" and it will have a single function "getWorld" that returns the name of the nearest planet. We choose to put this library in a subdirectory called "namer" - it doesn't really matter where we put it, this is just an example.
I made it a subfolder in my HelloWorld project. Should I be making this a separate project?
**One way we can help CMake find the Namer package (which will be our namer library) is by writing a helper script called FindNamer.cmake. This is just another file written in the CMake language that pokes around in all the places our library might be hiding. Here is an example (put this in "hello/FindNamer.cmake"):
This is my FindNamer.cmake file:
find_path(Namer_INCLUDE_DIRS world.h /usr/include "$ENV{NAMER_ROOT}")
find_library(Namer_LIBRARIES namer /usr/lib "$ENV{NAMER_ROOT}")
set(Namer_FOUND TRUE)
if (NOT Namer_INCLUDE_DIRS)
set(Namer_FOUND FALSE)
endif (NOT Namer_INCLUDE_DIRS)
if (NOT Namer_LIBRARIES)
set(Namer_FOUND FALSE)
endif (NOT Namer_LIBRARIES)
**The important parts here are the "find_path" and "find_library" commands, which look for the header file world.h and the namer library.
I followed the next instructions and at the very end the tutorial includes this:
**If we try again, configuration will still fail since the search path we gave for "find_path" and "find_library" doesn't actually include the needed files. We could copy them, or have added a hard-coded directory to find_path and find_library pointing to where the files are on our hard drive - but better, in the CMake GUI on windows or by running "ccmake ." on Linux, we can just fill in the directories there.
At this point I am completely confused (Newbie!!!!). I don't have a NamerConfig.cmake or namer-config.cmake file and I don't know what the find_path and find_library is supposed to be pointing to.
Thank you in advance for your help,
Severely Confused :-(
I said I was a newbie. I guess I'm a little tired too! Yes, these must be in two separate projects.

autoconf: AC_PROG_CC checks for object and executable suffix, but how to get this?

I'm a newbie to autoconf, and found out that a call of the macro AC_PROG_CC checks for the suffixes of executables and object files. Now I want to use the results of these checks and replace them in my Makefile.in, but there is no adequate documentation or mentioning in the autoconf docs on how to use this.
I'm also having the general problem: Which macro gives me which variables, and where is a reference to get know about?
Thanks for any help.
The variables you are looking for are #EXEEXT# and #OBJEXT#.
This link takes you to the index of all the output variables from the Autoconf manual.
Unfortunately there's no easy table of which ones are defined by which macros, you just have to read the descriptions.

Resources