Giacomo Travaglini has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/66855?usp=email )

Change subject: scons: Include libraries when building gem5 as a shared object
......................................................................

scons: Include libraries when building gem5 as a shared object

While we include shared libraries in the Executable class, we
are not doing it when linking the SharedLib. This means the
resulting Shared library won't have the library as a dependency
(it won't appear in ldd) and the symbols will remain undefined.

Any executable will fail to link with the shared library as
the executable will contain undefined references.

This bug was exposed when I tried to link util/tlm sources with
libgem5.so. As I have libpng/libpng-dev installed in my machine,
the shared library included libpng headers, but didn't link
to the library as scons didn't append "-lpng" to the linking CL.
Those png functions thus remained ubdefined symbols.

Change-Id: Id9c4a65607a7177f71659f1ac400a67edf7080fd
Signed-off-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
---
M src/SConscript
1 file changed, 30 insertions(+), 0 deletions(-)



diff --git a/src/SConscript b/src/SConscript
index 4e7139c..51b4bd9 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -376,6 +376,12 @@
     def declare(self, env):
         objs = self.srcs_to_objs(env, self.sources(env))

+        libs = self.libs(env)
+        # Higher priority libraries should be earlier in the list.
+        libs.sort(key=lambda l: l.priority, reverse=True)
+        if libs:
+            env.Append(LIBS=list(lib.source for lib in libs))
+
         date_obj = env.SharedObject(date_source)
         env.Depends(date_obj, objs)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/66855?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id9c4a65607a7177f71659f1ac400a67edf7080fd
Gerrit-Change-Number: 66855
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to