Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's not friendly for developer to compile libsairedis twice. #333

Open
jeromesun14 opened this issue Jul 13, 2018 · 2 comments
Open

It's not friendly for developer to compile libsairedis twice. #333

jeromesun14 opened this issue Jul 13, 2018 · 2 comments

Comments

@jeromesun14
Copy link

Hi folks,

sonic-sairedis may compile in three ways: syncd / syncd-rpc / syncd-vs.

in debian/rules:

binary: binary-syncd binary-syncd-rpc

binary-syncd:
	$(shell echo > /tmp/syncd-build)
	dh clean  --with autotools-dev
	dh build  -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
	dh binary -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev

binary-syncd-rpc: | binary-syncd
	$(shell echo '--enable-rpcserver=yes' > /tmp/syncd-build)
	dh clean  --with autotools-dev
	dh build  -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
	dh binary -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev

binary-syncd-vs:
	$(shell echo '--with-sai=vs' > /tmp/syncd-build)
	dh clean  --with autotools-dev
	dh build  -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg --with autotools-dev
	dh binary -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg --with autotools-dev

In general, we only need to compile one at a time. But now we have to compile syncd / syncd-rpc every time.
It's really waste of time, especially for developer, who need to revise and debug syncd code.

Why not use configuration ENABLE_SYNCD_RPC here to distinguish which target to use?

Regards,
Jerome

@jeromesun14
Copy link
Author

jeromesun14 commented Jul 13, 2018

I try a solution like sonic-buildimage/platform/vs/syncd-vs.mk using xxx_DPKG_TARGET, and it works!
If I am free, I will start a PR. But I am busy now... Here's the source code:

  • add sonic-buildimage/rules/syncd.mk. Maybe it's better to put syncd.mk and syncd-rpc.mk in platform/xxx and use config ENABLE_SYNCD_RPC to separate them.
$ cat rules/syncd.mk 
$(LIBSAIREDIS)_DPKG_TARGET = binary-syncd

SYNCD = syncd_1.0.0_amd64.deb
$(SYNCD)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD)))

SYNCD_DBG = syncd-dbg_1.0.0_amd64.deb
$(SYNCD_DBG)_DEPENDS += $(SYNCD)
$(SYNCD_DBG)_RDEPENDS += $(SYNCD)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_DBG)))
  • modify sonic-buildimage/rules/sairedis.mk
$ cat rules/sairedis.mk 
# sairedis package

LIBSAIREDIS = libsairedis_1.0.0_amd64.deb
$(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis
$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV)
$(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON)
$(LIBSAIREDIS)_DEB_BUILD_OPTIONS = nocheck
SONIC_DPKG_DEBS += $(LIBSAIREDIS)

LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DEV)))

LIBSAIMETADATA = libsaimetadata_1.0.0_amd64.deb
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA)))

LIBSAIMETADATA_DEV = libsaimetadata-dev_1.0.0_amd64.deb
$(LIBSAIMETADATA_DEV)_DEPENDS += $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DEV)))

LIBSAIREDIS_DBG = libsairedis-dbg_1.0.0_amd64.deb
$(LIBSAIREDIS_DBG)_DEPENDS += $(LIBSAIREDIS)
$(LIBSAIREDIS_DBG)_RDEPENDS += $(LIBSAIREDIS)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DBG)))

LIBSAIMETADATA_DBG = libsaimetadata-dbg_1.0.0_amd64.deb
$(LIBSAIMETADATA_DBG)_DEPENDS += $(LIBSAIMETADATA)
$(LIBSAIMETADATA_DBG)_RDEPENDS += $(LIBSAIMETADATA)
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DBG)))
  • modify sonic-sairedis/debian/rules
src/sonic-sairedis$ git diff debian/rules
diff --git a/debian/rules b/debian/rules
index 7282b1b..a3081a0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -22,11 +22,12 @@ clean:
 build:
        echo build stage is skipped. Please use binary to generate debian packages
 
-binary: binary-syncd binary-syncd-rpc
+binary:
+       dh build  -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
+       dh binary -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev

@kcudnik
Copy link
Collaborator

kcudnik commented Jul 6, 2021

is this issue still valid ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants