From ebba0c19006ecf43237415389e8c7110abb774aa Mon Sep 17 00:00:00 2001 From: Vulcan <93451215+trholding@users.noreply.github.com> Date: Fri, 31 Jan 2025 12:35:59 +0530 Subject: [PATCH 1/2] Add Dynamic Linking Info --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 8a15b88..f29cd26 100644 --- a/README +++ b/README @@ -26,6 +26,8 @@ Linux build instructions: 4. Build cd cray-sim/simulator make build + Else for Linux distros that require dynamic linking do: + make LINK_TYPE=dynamic build 5. Build images cd ../target/cos_117 ./build_boot_tape From dc7deefc00b6953a7fd442040491105a00d975e7 Mon Sep 17 00:00:00 2001 From: Vulcan <93451215+trholding@users.noreply.github.com> Date: Fri, 31 Jan 2025 12:46:06 +0530 Subject: [PATCH 2/2] Add dynamic linking support The original static linking works on distributions like Ubuntu that provide static libraries, but it would fail on some distributions like Arch Linux that primarily provide dynamic libraries. This commit adds dynamic linking support to accommodate these distributions. Usage: ``` make LINK_TYPE=dynamic build ``` --- simulator/common.mak | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/simulator/common.mak b/simulator/common.mak index 1ca25b6..a68badc 100644 --- a/simulator/common.mak +++ b/simulator/common.mak @@ -141,7 +141,12 @@ INC_DIRS += $(DEP_INC_DIRS) $(EXTRA_INC) DEFINES += _FILE_OFFSET_BITS=64 +ifndef LINK_TYPE +LINK_TYPE=static +endif + # $(if ("$(SYSTEM)","cygwin"), $(1), :lib$(strip $(1)).a) +ifeq ($(LINK_TYPE),static) define static_lib :lib$(strip $(1)).a endef @@ -155,6 +160,13 @@ define static_lib :lib$(strip $(1))-mt.a endef endif +else ifeq ($(LINK_TYPE),dynamic) +define static_lib + $(1) +endef +else +$(error LINK_TYPE must be either 'static' or 'dynamic', not '$(LINK_TYPE)') +endif ################################################################################# ### Setting up some common libraries @@ -181,9 +193,11 @@ COMMON_LIBS += Bcrypt endif ifeq ($(SYSTEM),linux) NCURSES_LIBS += $(call static_lib, ncurses) +NCURSES_LIBS += $(call static_lib, panel) +ifeq ($(LINK_TYPE),static) NCURSES_LIBS += $(call static_lib, termcap) NCURSES_LIBS += $(call static_lib, gpm) -NCURSES_LIBS += $(call static_lib, panel) +endif BOOST_LIBS += $(call static_lib, rt) COMMON_LIBS += pthread endif