Electrostat-Lab / Electrostat-Lab/Electrostatic-Sandbox

[Latent-issue] Avoid duplications when handling the dependencies for static and shared libraries routines

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
bug build-script help wanted
Dominant language
C
Stars
9
Forks
5
Avg merge
20m
Merged PRs (30d)
1

Description

I've noticed that the front-end bash build script for `electrostatic-core` which provides the build routines for the generic `CMakeLists.txt` script, has a potential issue which is a latent one (i.e., not manifested) while declaring the dependencies to be linked with output binaries; that is this line:
```bash
dependencies=$(find "$(pwd)/${source_dir}/dependencies/libs/" \
-name *.a -o -name *.so -o -name *.ar | tr '\n' ';')
```
This line entails finding all the dependencies whether static archives or shared libraries that matches the pattern ending in _*.so_ or _*.a_, and then using them for both routines of building the static and the shared libraries in the _CMakeLists.txt_ script:
```cmake
target_link_libraries(${library_a} PUBLIC "${DEPENDENCIES}")
target_link_libraries(${library_so} PUBLIC "${DEPENDENCIES}")
```
So, this introduces a potential of duplication of function tables if not handled internally by GCC which is a scripting anti-pattern anyway (i.e., Merging of _mutually exclusive or disjoint routines_ that are rather incompatible).

_**Reasons for latency and no error reports:**_
The main reason for latency is entailed to the fact that the `electrostatic-core` module haven't got any external dependencies, yet. While the internal dependencies linked (including the math and the pthread libraries) are handled internally by the linker at compile-time.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.