Hello

Thanks for the link to nslu2 and the information that I basically just need
to set these bunch of variables correct for cross compiling. I was now able
to create a mostly working package for Buildroot. The .mk file is attached
for others which may run into the same situation.

Thanks

Benjamin

Am Mi., 24. Juni 2020 um 18:05 Uhr schrieb Ovidiu Sas <[email protected]
>:

> I haven't cross compiled in a long time ...
> For proper cross-compilation, the CROSS_COMPILE flag must be set to
> something, then the LOCALBASE and SYSBASE should point to the staging
> directory where the toolchain and all the libraries and include files
> for the target platform are present.
> Extra compile and link options can be passed via CC_EXTRA_OPTS and
> LD_EXTRA_OPTS.
>
> An old example for optware can be found here:
>
> https://raw.githubusercontent.com/nslu2-linux/Optware/master/make/kamailio.mk
>
> Some modules have a proper Makefile that will use the pkg-config from
> staging directory and detect proper compile and link flags while other
> modules require manual tinkering with the Makefile.
> It's good to enable the noisy build (Q=0) and check that proper
> include files and libs are used (from the staging directory and not
> from the build machine).
>
> Regards,
> Ovidiu Sas
>
> On Wed, Jun 24, 2020 at 4:52 AM Daniel-Constantin Mierla
> <[email protected]> wrote:
> >
> > Hello,
> >
> > I haven't cross compiled myself, but there is a makefile flag
> CROSS_COMPILE that you can set in such cases -- the Makefile of the modules
> sets the path to includes and libs based on it. You may need to set other
> Makefile variables to get it done, look in the src/Makefile.defs to see
> most of them.
> >
> > Ovidiu Sas seemed to be active in this space some time ago, maybe he can
> give further guidelines.
> >
> > Cheers,
> > Daniel
> >
> > On 19.06.20 14:11, Benjamin Marty wrote:
> >
> > Hello
> >
> > I would like to ask if someone already tried to build Kamailio for the
> Embedded Distribution Buildroot. I tried it myself but it looks like
> Kamailio is not that easy to cross compile.
> >
> > Thanks
> >
> > Benjamin
> >
> > _______________________________________________
> > Kamailio (SER) - Users Mailing List
> > [email protected]
> > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> >
> > --
> > Daniel-Constantin Mierla -- www.asipto.com
> > www.twitter.com/miconda -- www.linkedin.com/in/miconda
> > Funding: https://www.paypal.me/dcmierla
> >
> > _______________________________________________
> > Kamailio (SER) - Users Mailing List
> > [email protected]
> > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
>
> --
> VoIP Embedded, Inc.
> http://www.voipembedded.com
>
KAMAILIO_VERSION = 5.3.5
KAMAILIO_SOURCE = kamailio-$(KAMAILIO_VERSION)_src.tar.gz
KAMAILIO_SITE = https://www.kamailio.org/pub/kamailio/$(KAMAILIO_VERSION)/src

KAMAILIO_INCLUDE_PUA_MODULES=pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp
KAMAILIO_INCLUDE_PRESENCE_MODULES=presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_b2b
KAMAILIO_INCLUDE_AAA_MODULES=auth auth_ims auth_identity auth_db auth_diameter auth_radius
KAMAILIO_INCLUDE_LDAP_MODULES=ldap
KAMAILIO_INCLUDE_BASE_MODULES=$(KAMAILIO_INCLUDE_PUA_MODULES) \
$(KAMAILIO_INCLUDE_PRESENCE_MODULES) \
$(KAMAILIO_INCLUDE_AAA_MODULES) \
xmpp cpl-c db_unixodbc db_postgres db_sqlite carrierroute rls identity regex xmlops xcap_server tls xhttp_pi
KAMAILIO_EXCLUDE_APP_MODULES=app_lua app_mono app_perl app_python app_java app_python3 app_ruby erlang
KAMAILIO_EXCLUDE_DB_MODULES=db_berkeley db_cassandra db_oracle db_perlvdb db_redis db2_ldap db_mongodb db_mysql db_postgres cnxcc cplc evapi geoip geoip2 http_async_client ims_ipsec_pcscf janssonrpcc jsonrpcc kazoo log_systemd lost misc_radius ndb_cassandra ndb_mongodb nsq peering phonenum rabbitmq rtp_media_server snmpstats topos_redis websocket xcap_server xhttp_pi xmpp
KAMAILIO_EXCLUDE_MODULES=$(KAMAILIO_EXCLUDE_APP_MODULES) $(KAMAILIO_EXCLUDE_DB_MODULES) $(KAMAILIO_INCLUDE_LDAP_MODULES) bdb cdp siptrace sipcapture identity iptrtpproxy jabber json jsonrpc-c memcached ndb_redis osp h350 purple seas mi_xmlrpc dnssec sctp app_lua_sr auth_radius acc_radius uuid

KAMAILIO_CPPFLAGS=-fexpensive-optimizations -fomit-frame-pointer -fsigned-char

define KAMAILIO_BUILD_CMDS
	CC_EXTRA_OPTS="$(KAMAILIO_CPPFLAGS) $(STAGING_CPPFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/libxml2" \
	LD_EXTRA_OPTS="$(STAGING_LDFLAGS)" CROSS_COMPILE="$(TARGET_CROSS)" \
	LOCALBASE=$(STAGING_DIR) SYSBASE=$(STAGING_DIR) CC="$(TARGET_CC)" \
	$(MAKE) -C $(@D) FLAVOUR=kamailio cfg $(KAMAILIO_MAKEFLAGS) \
	include_modules="$(KAMAILIO_INCLUDE_MODULES)" exclude_modules="$(KAMAILIO_EXCLUDE_MODULES)" prefix="" \
	modules_dirs="modules"

	CC_EXTRA_OPTS="$(KAMAILIO_CPPFLAGS) $(STAGING_CPPFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/libxml2" \
	LD_EXTRA_OPTS="$(STAGING_LDFLAGS)" CROSS_COMPILE="$(TARGET_CROSS)" \
	LOCALBASE=$(STAGING_DIR) SYSBASE=$(STAGING_DIR) CC="$(TARGET_CC)" \
	$(MAKE) -C $(@D) $(KAMAILIO_MAKEFLAGS) \
	include_modules="$(KAMAILIO_INCLUDE_MODULES)" exclude_modules="$(KAMAILIO_EXCLUDE_MODULES)" prefix="" all \
	modules_dirs="modules"
endef

define KAMAILIO_INSTALL_TARGET_CMDS
	CC_EXTRA_OPTS="$(KAMAILIO_CPPFLAGS) $(STAGING_CPPFLAGS)" \
	LD_EXTRA_OPTS="$(STAGING_LDFLAGS)" CROSS_COMPILE="$(TARGET_CROSS)" \
	LOCALBASE=$(STAGING_DIR) SYSBASE=$(STAGING_DIR) CC="$(TARGET_CC)" \
	$(MAKE) -C $(@D) $(KAMAILIO_MAKEFLAGS) DESTDIR=$(TARGET_DIR) \
	prefix="" install
endef

$(eval $(generic-package))
_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to