[dpdk-dev] mk: add rpath for applications

Message ID 1461947665-1086-1-git-send-email-ferruh.yigit@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Ferruh Yigit April 29, 2016, 4:34 p.m. UTC
  Add default library output folder to the library search folder.

This is useful for development environment, in production environment
DPDK libraries already should be in know locations.

Patch removes requirement to set LD_LIBRARY_PATH variable when DPDK
compiled as shared library.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 mk/rte.app.mk | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Thomas Monjalon May 2, 2016, 4:10 p.m. UTC | #1
2016-04-29 17:34, Ferruh Yigit:
> Add default library output folder to the library search folder.
> 
> This is useful for development environment, in production environment
> DPDK libraries already should be in know locations.

Yes it is useful in dev environment, but can be risky or strange when
packaged for production environment.
Shouldn't we have a switch to avoid a development garbage in production?
I suggest to use RTE_DEVEL_BUILD.

> Patch removes requirement to set LD_LIBRARY_PATH variable when DPDK
> compiled as shared library.

Yes, this patch could remove
	export LD_LIBRARY_PATH=$build/lib:$LD_LIBRARY_PATH
in scripts/test-null.sh.

[...]
> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
> +LDFLAGS += --rpath=$(RTE_SDK_BIN)/lib
> +endif

Isn't it -rpath, with a single dash?

As it is a variable setting, it should be added before the rules,
just after LDLIBS settings.
  
Ferruh Yigit May 3, 2016, 1:24 p.m. UTC | #2
On 5/2/2016 5:10 PM, Thomas Monjalon wrote:
> 2016-04-29 17:34, Ferruh Yigit:
>> Add default library output folder to the library search folder.
>>
>> This is useful for development environment, in production environment
>> DPDK libraries already should be in know locations.
> 
> Yes it is useful in dev environment, but can be risky or strange when
> packaged for production environment.
> Shouldn't we have a switch to avoid a development garbage in production?
> I suggest to use RTE_DEVEL_BUILD.
> 

Right, I will use RTE_DEVEL_BUILD

>> Patch removes requirement to set LD_LIBRARY_PATH variable when DPDK
>> compiled as shared library.
> 
> Yes, this patch could remove
> 	export LD_LIBRARY_PATH=$build/lib:$LD_LIBRARY_PATH
> in scripts/test-null.sh.
> 

Sure, I can update it.

> [...]
>> +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
>> +LDFLAGS += --rpath=$(RTE_SDK_BIN)/lib
>> +endif
> 
> Isn't it -rpath, with a single dash?
> 

It seems both are working, I will convert to single dash.

> As it is a variable setting, it should be added before the rules,
> just after LDLIBS settings.
> 

OK.
I will send an updated version.


Thanks for the review,
ferruh
  

Patch

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index c66e491..b8715ee 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -198,6 +198,10 @@  build: _postbuild
 
 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDFLAGS += --rpath=$(RTE_SDK_BIN)/lib
+endif
+
 ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
 O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \