Skip to content

Commit c6c009e

Browse files
authored
Merge pull request #4180 from grandixximo/fix/stale-soname-symlink
build: fix stale soname symlink after a library version bump
2 parents 130f851 + 8511831 commit c6c009e

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ genclean:
535535
find . -name '*.o' |xargs rm -f
536536
-rm -rf objects
537537
-rm -f $(TARGETS)
538+
-rm -f ../lib/*.so.[0-9]*
538539
-rm -f $(GENERATED_MANPAGES)
539540
-rm -f ../rtlib/*.$(MODULE_EXT)
540541
-rm -f hal/components/conv_*.comp

src/emc/ini/Submakefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@ $(patsubst ./emc/ini/%,../include/%,$(LIBLCNCINICXINCS)): ../include/%.hh: ./emc
1919
../lib/liblinuxcncini.so.1: $(call TOOBJS,$(LIBLCNCINISRCS))
2020
$(ECHO) Creating shared library $(notdir $@)
2121
@mkdir -p ../lib
22-
@rm -f $@
22+
@rm -f $(basename $@).[0-9]*
2323
$(Q)$(CXX) $(LDFLAGS) -Wl,-soname,$(notdir $@) -shared -o $@ $^ -lfmt
2424

25+
# Explicit symlink rule: the generic ../lib/%.so pattern rules in src/Makefile
26+
# match both %.so.0 and %.so.1, and the %.so.0 rule wins when a stale .so.0 is
27+
# left over from before this library's soname bump. Bind the dev symlink to the
28+
# current soname explicitly so it always repoints in a single build pass.
29+
../lib/liblinuxcncini.so: ../lib/liblinuxcncini.so.1
30+
ln -sf $(notdir $<) $@
31+
2532
# Command-line utility for reading ini-files
2633
INIVALUESRCS := emc/ini/inivalue.cc
2734
USERSRCS += $(INIVALUESRCS)

0 commit comments

Comments
 (0)