I am building a package that uses sub-module (protobuf) that I wand to link with statically, and avoid providing it's binaries in the package I build.
I did the following:
Add protobuf as sub-module of my project.
Use autoconf to build only static library using: --with-pic=yes --enable-
shared=no flags.
Avoid invoking "make install" (only make) on the sub-module.
Currently the package building process fails when running distcheck.
According to error message, it fails on distcheck of the sub-module, since the binaries of the sub-module are not included.
Is there a guide for how to properly build and link statically with sub modules ?
(and avoid including them in the packages)
Related
I'm using meson to build a project.
The project now needs a dependency to another library, which is easily built using Make, just by issuing the make command.
I would like to add this as a subproject dependency in Meson. Is it possible to call Make from Meson's meson.build file? How is it done?
We have multiple libraries in different folder, The main application needs to build those libraries in other folders and install them to output folder and then the main application needs to link to libraries to build executable.
I am able to build the libraries present in other folders using add_subdirectory() in a loop, but I am not able to install them to output folder by main cmake file. Could anyone help me out on this.
The main application needs to build those libraries in other folders and install them to output folder and then the main application needs to link to libraries to build executable.
It is not necessary in CMake to install libraries in order to link to them. You can build the libraries and have your main executable link to them without installing the libraries. When you need to install your application as a whole, you can install libraries along with the executable if needed i.e. if the libraries are shared ones and not static ones.
One example of how you can organize things: assume you have the following structure in your project:
CMakeLists.txt # root of project
|
|--lib
| |--CMakeLists.txt # library subproject
|
|--app
|--CMakeLists.txt # app subproject
Then your root CMakeLists.txt can look like this:
project(MyProject)
add_subdirectory(lib)
add_subdirectory(app)
The lib subproject's CMakeLists.txt can look like this:
project(MyLib)
set(SOURCES <...>) # specify library's sources
add_library(${PROJECT_NAME} ${SOURCES})
set(MyLib ${PROJECT_NAME} CACHE INTERNAL "")
The last line in the snippet above is aimed to make MyLib variable available everywhere within the project. I found this trick here and used it successfully in my projects. Maybe there are better options here, if anyone knows them, feel free to suggest.
The app's CMakeLists.txt can then look like this:
project(MyApp)
set(SOURCES <...>) # specify app's sources
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${MyLib})
I haven't covered the installation here but it's actually straightforward: if your libraries are static ones, you only need to install the executable using install TARGETS. If your libraries are shared ones, you need to install them along with the executable.
I see go install <main package> will compile the dependency packages into static library files and install them into the pkg directory, but the executable doesn't need the library files when running. And I also discover that source file is necessary when compiling.
So, is there any special usage of the static files?
The compiled packages can be reused if you compile something else. This saves time on subsequent compiles. When you recompile you only need to compile the package and the things that depend on it, not its dependencies.
They also contain data used by gocode for autcompleting.
I want to build a maven artifact that contains some executable native binaries so that other maven projects can depend on this artifact and refer to those binaries at build time.
I've looked at the maven-assembler-plugin and it appears promising, but I'm not sure how to get it going end to end. If I tell it to package up my dir I'll still need a way to tell clients to depend on that artifact and have that cause the binaries to be pulled in and put in a well-defined location.
Some specifics might help. I want to put the various platform versions of the thrift compiler into an artifact. Then I want clients to depend on that artifact and use the maven-thrift-plugin to execute the binary thrift compiler appropriate to the platform to generate the java code that will then be built by the java compiler.
The maven-assembly-plugin should be sufficient to package your native binaries into an archive.
Clients can the use the unpack goal of the maven-dependency-plugin to unpack this archive into a given directory, e.g. the current target.
Then all you need is a Maven plugin that knows how to run your native binaries and to pick them up from the given directory.
I try to compile QtWebKit on Qt5 but I have a problem. Actually I implement next command "d:\qt_5.0.2\qtwebkit qmake" after that
I see "Running configure test..." but at all after that I have a problem "pkg-configure isn't inside or outside command using app or package file"
And then i get the error ->> "Project ERROR: WebKit requires SQLite. Either make it available via pkg-config, set $SQLITE3SRCDIR or build WebKit under qt5.git."
Exactly what the message tells you: you need sqlite sources to compile QtWebKit. Given you're under Windows, we can exclude the pkg-config way.
You have a copy of sqlite sources inside the qtbase repository, so you can do in your prompt
SET SQLITE3SRCDIR=D:\path\to\qtbase\src\3rdparty\sqlite
and then qmake and make as usual.
(Note that you're not building from qt5.git as the message suggest, but module by module. That has its pros and its cons. Having to manually manage module (inter)dependencies is one of the cons, as you've just figured out.)