DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
@ 2014-10-01  4:27 mukawa
  2014-10-01 10:50 ` Neil Horman
  0 siblings, 1 reply; 12+ messages in thread
From: mukawa @ 2014-10-01  4:27 UTC (permalink / raw)
  To: dev

From: Tetsuya Mukawa <mukawa@igel.co.jp>

When CONFIG_RTE_BUILD_SHARED_LIB is enabled, linking errors occured
while compiling. It seems those errors are caused by wrong link order
of some libraries. The patch fixes it like following.

1. librte_eal
2. librte_malloc
3. librte_mempool
4. librte_ring
5. librte_pmd_bond
6. librte_kvargs

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 mk/rte.app.mk | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 34dff2a..172ba4d 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -121,10 +121,6 @@ endif
 
 LDLIBS += --start-group
 
-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
 ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
 LDLIBS += -lrte_mbuf
 endif
@@ -137,6 +133,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
 LDLIBS += -lethdev
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
+LDLIBS += -lrte_eal
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
 LDLIBS += -lrte_malloc
 endif
@@ -158,10 +158,6 @@ ifeq ($(CONFIG_RTE_LIBGLOSS),y)
 LDLIBS += -lgloss
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
 ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
 LDLIBS += -lrte_cmdline
 endif
@@ -174,6 +170,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
 LDLIBS += -lrte_pmd_bond
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
+LDLIBS += -lrte_kvargs
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
 LDLIBS += -lrte_pmd_xenvirt
 LDLIBS += -lxenstore
-- 
1.9.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-01  4:27 [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled mukawa
@ 2014-10-01 10:50 ` Neil Horman
  2014-10-01 11:56   ` Thomas Monjalon
  2014-10-02  1:43   ` Tetsuya Mukawa
  0 siblings, 2 replies; 12+ messages in thread
From: Neil Horman @ 2014-10-01 10:50 UTC (permalink / raw)
  To: mukawa; +Cc: dev

On Wed, Oct 01, 2014 at 01:27:03PM +0900, mukawa@igel.co.jp wrote:
> From: Tetsuya Mukawa <mukawa@igel.co.jp>
> 
> When CONFIG_RTE_BUILD_SHARED_LIB is enabled, linking errors occured
> while compiling. It seems those errors are caused by wrong link order
> of some libraries. The patch fixes it like following.
> 
> 1. librte_eal
> 2. librte_malloc
> 3. librte_mempool
> 4. librte_ring
> 5. librte_pmd_bond
> 6. librte_kvargs
> 
I'm not sure why thats necesecary.  We add a --start-group/--end-group pair
halfway through this makefile.  If we just encompassed the entire set of
libraries in that group, order would be irrelevant.

Neil

> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
> ---
>  mk/rte.app.mk | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index 34dff2a..172ba4d 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -121,10 +121,6 @@ endif
>  
>  LDLIBS += --start-group
>  
> -ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
> -LDLIBS += -lrte_kvargs
> -endif
> -
>  ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
>  LDLIBS += -lrte_mbuf
>  endif
> @@ -137,6 +133,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
>  LDLIBS += -lethdev
>  endif
>  
> +ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
> +LDLIBS += -lrte_eal
> +endif
> +
>  ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
>  LDLIBS += -lrte_malloc
>  endif
> @@ -158,10 +158,6 @@ ifeq ($(CONFIG_RTE_LIBGLOSS),y)
>  LDLIBS += -lgloss
>  endif
>  
> -ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
> -LDLIBS += -lrte_eal
> -endif
> -
>  ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
>  LDLIBS += -lrte_cmdline
>  endif
> @@ -174,6 +170,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
>  LDLIBS += -lrte_pmd_bond
>  endif
>  
> +ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
> +LDLIBS += -lrte_kvargs
> +endif
> +
>  ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
>  LDLIBS += -lrte_pmd_xenvirt
>  LDLIBS += -lxenstore
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-01 10:50 ` Neil Horman
@ 2014-10-01 11:56   ` Thomas Monjalon
  2014-10-02  2:48     ` Tetsuya Mukawa
  2014-10-02  1:43   ` Tetsuya Mukawa
  1 sibling, 1 reply; 12+ messages in thread
From: Thomas Monjalon @ 2014-10-01 11:56 UTC (permalink / raw)
  To: mukawa; +Cc: dev

2014-10-01 06:50, Neil Horman:
> On Wed, Oct 01, 2014 at 01:27:03PM +0900, mukawa@igel.co.jp wrote:
> > When CONFIG_RTE_BUILD_SHARED_LIB is enabled, linking errors occured
> > while compiling. It seems those errors are caused by wrong link order
> > of some libraries. The patch fixes it like following.
> > 
> > 1. librte_eal
> > 2. librte_malloc
> > 3. librte_mempool
> > 4. librte_ring
> > 5. librte_pmd_bond
> > 6. librte_kvargs
> > 
> I'm not sure why thats necesecary.  We add a --start-group/--end-group pair
> halfway through this makefile.  If we just encompassed the entire set of
> libraries in that group, order would be irrelevant.

I don't see any error.
Please Tetsuya, could you describe how you test and what is the error message?

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-01 10:50 ` Neil Horman
  2014-10-01 11:56   ` Thomas Monjalon
@ 2014-10-02  1:43   ` Tetsuya Mukawa
  2014-10-02  2:46     ` Matthew Hall
  1 sibling, 1 reply; 12+ messages in thread
From: Tetsuya Mukawa @ 2014-10-02  1:43 UTC (permalink / raw)
  To: Neil Horman; +Cc: dev

(2014/10/01 19:50), Neil Horman wrote:
> I'm not sure why thats necesecary.  We add a --start-group/--end-group pair
> halfway through this makefile.  If we just encompassed the entire set of
> libraries in that group, order would be irrelevant.
I haven't known the options. Thanks.
Anyway, I understand I shouldn't change link order, but should check why
'--start-group/--end-group' doesn't work on my environment.
I will describe more in the email for Thomas.

Regards,
Tetsuya

> Neil
>
>> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
>> ---
>>  mk/rte.app.mk | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
>> index 34dff2a..172ba4d 100644
>> --- a/mk/rte.app.mk
>> +++ b/mk/rte.app.mk
>> @@ -121,10 +121,6 @@ endif
>>  
>>  LDLIBS += --start-group
>>  
>> -ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
>> -LDLIBS += -lrte_kvargs
>> -endif
>> -
>>  ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
>>  LDLIBS += -lrte_mbuf
>>  endif
>> @@ -137,6 +133,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
>>  LDLIBS += -lethdev
>>  endif
>>  
>> +ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
>> +LDLIBS += -lrte_eal
>> +endif
>> +
>>  ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
>>  LDLIBS += -lrte_malloc
>>  endif
>> @@ -158,10 +158,6 @@ ifeq ($(CONFIG_RTE_LIBGLOSS),y)
>>  LDLIBS += -lgloss
>>  endif
>>  
>> -ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
>> -LDLIBS += -lrte_eal
>> -endif
>> -
>>  ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
>>  LDLIBS += -lrte_cmdline
>>  endif
>> @@ -174,6 +170,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
>>  LDLIBS += -lrte_pmd_bond
>>  endif
>>  
>> +ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
>> +LDLIBS += -lrte_kvargs
>> +endif
>> +
>>  ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
>>  LDLIBS += -lrte_pmd_xenvirt
>>  LDLIBS += -lxenstore
>> -- 
>> 1.9.1
>>
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-02  1:43   ` Tetsuya Mukawa
@ 2014-10-02  2:46     ` Matthew Hall
  2014-10-02  3:44       ` Tetsuya Mukawa
  0 siblings, 1 reply; 12+ messages in thread
From: Matthew Hall @ 2014-10-02  2:46 UTC (permalink / raw)
  To: Tetsuya Mukawa; +Cc: dev

On Thu, Oct 02, 2014 at 10:43:52AM +0900, Tetsuya Mukawa wrote:
> I haven't known the options. Thanks.
> Anyway, I understand I shouldn't change link order, but should check why
> '--start-group/--end-group' doesn't work on my environment.
> I will describe more in the email for Thomas.
> 
> Regards,
> Tetsuya

It's worth pointing out that you're likely better off using COMBINE_LIBS to 
make one big static lib rather than using a shared lib or you're facing a 
performance loss from the dynamic linking overhead.

Matthew.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-01 11:56   ` Thomas Monjalon
@ 2014-10-02  2:48     ` Tetsuya Mukawa
  2014-10-02  8:12       ` Sergio Gonzalez Monroy
  0 siblings, 1 reply; 12+ messages in thread
From: Tetsuya Mukawa @ 2014-10-02  2:48 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

(2014/10/01 20:56), Thomas Monjalon wrote:
> 2014-10-01 06:50, Neil Horman:
>> On Wed, Oct 01, 2014 at 01:27:03PM +0900, mukawa@igel.co.jp wrote:
>>> When CONFIG_RTE_BUILD_SHARED_LIB is enabled, linking errors occured
>>> while compiling. It seems those errors are caused by wrong link order
>>> of some libraries. The patch fixes it like following.
>>>
>>> 1. librte_eal
>>> 2. librte_malloc
>>> 3. librte_mempool
>>> 4. librte_ring
>>> 5. librte_pmd_bond
>>> 6. librte_kvargs
>>>
>> I'm not sure why thats necesecary.  We add a --start-group/--end-group pair
>> halfway through this makefile.  If we just encompassed the entire set of
>> libraries in that group, order would be irrelevant.
> I don't see any error.
> Please Tetsuya, could you describe how you test and what is the error message?
>
> Thanks
Thank you for testing.
I have confirmed '--start-group/--end-groups' is specified while
compiling, but I am still seeing the error.

Here is what I actually did.

----------------------------------------------------------------------

<< Show my environment >>
$ uname -a
Linux eris 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014
x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:    trusty
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --disable-libmudflap --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

<< Compile DPDK >>
$ git clone git://dpdk.org/dpdk
$ cd dpdk
$ vi config/common_linuxapp
CONFIG_RTE_BUILD_SHARED_LIB=y
$ T=x86_64-native-linuxapp-gcc make install V=1

.......

== Build app/test-acl
gcc -Wp,-MD,./.main.o.d.tmp -m64 -pthread -fPIC  -march=native
-DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2
-DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3
-DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2
-DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ
-DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_F16C
-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
-I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wold-style-definition -Wpointer-arith
-Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-Wformat-security -Wundef -Wwrite-strings   -o main.o -c
/home/mukawa/tmp/dpdk/app/test-acl/main.c
gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
-DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
-DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
-DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
-DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
-DRTE_MACHINE_CPUFLAG_F16C
-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
-I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wold-style-definition -Wpointer-arith
-Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
-o testacl main.o -Wl,-export-dynamic
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
-Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
-Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
-Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
-Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
-Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
-Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
-Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
-Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
undefined reference to `rte_mempool_lookup'
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
undefined reference to `rte_mempool_create'

<< Reproduce the issue with same options >>
$ cd x86_64-native-linuxapp-gcc/build/app/test-acl/
$ gcc -Wp,-MD,./.main.o.d.tmp -m64 -pthread -fPIC  -march=native
-DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2
-DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3
-DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2
-DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ
-DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_F16C
-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
-I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wold-style-definition -Wpointer-arith
-Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-Wformat-security -Wundef -Wwrite-strings   -o main.o -c
/home/mukawa/tmp/dpdk/app/test-acl/main.c
mukawa@eris:~/tmp/dpdk/x86_64-native-linuxapp-gcc/build/app/test-acl$
gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
-DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
-DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
-DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
-DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
-DRTE_MACHINE_CPUFLAG_F16C
-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
-I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wold-style-definition -Wpointer-arith
-Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
-o testacl main.o -Wl,-export-dynamic
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
-Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
-Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
-Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
-Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
-Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
-Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
-Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
-Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
undefined reference to `rte_mempool_lookup'
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
undefined reference to `rte_mempool_create'
collect2: error: ld returned 1 exit status

----------------------------------------------------------------------

I just enabled the following option, then compile DPDK.
CONFIG_RTE_BUILD_SHARED_LIB
Is this collect to compile PMDs as dynamic link libraries?

With the option, all libraries include are compiled as dynamic link library.
Does "--start-group/--end-group" options work with dynamic link libraries?

Regards,
Tetsuya

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-02  2:46     ` Matthew Hall
@ 2014-10-02  3:44       ` Tetsuya Mukawa
  0 siblings, 0 replies; 12+ messages in thread
From: Tetsuya Mukawa @ 2014-10-02  3:44 UTC (permalink / raw)
  To: Matthew Hall; +Cc: dev

(2014/10/02 11:46), Matthew Hall wrote:
> On Thu, Oct 02, 2014 at 10:43:52AM +0900, Tetsuya Mukawa wrote:
> It's worth pointing out that you're likely better off using
> COMBINE_LIBS to make one big static lib rather than using a shared lib
> or you're facing a performance loss from the dynamic linking overhead.
> Matthew. 

Thanks.  I will go over it

Regards,
Tetsuya

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-02  2:48     ` Tetsuya Mukawa
@ 2014-10-02  8:12       ` Sergio Gonzalez Monroy
  2014-10-02  8:28         ` Tetsuya Mukawa
  0 siblings, 1 reply; 12+ messages in thread
From: Sergio Gonzalez Monroy @ 2014-10-02  8:12 UTC (permalink / raw)
  To: Tetsuya Mukawa; +Cc: dev

On Thu, Oct 02, 2014 at 11:48:37AM +0900, Tetsuya Mukawa wrote:
> (2014/10/01 20:56), Thomas Monjalon wrote:
> > 2014-10-01 06:50, Neil Horman:
> >> On Wed, Oct 01, 2014 at 01:27:03PM +0900, mukawa@igel.co.jp wrote:
> >>> When CONFIG_RTE_BUILD_SHARED_LIB is enabled, linking errors occured
> >>> while compiling. It seems those errors are caused by wrong link order
> >>> of some libraries. The patch fixes it like following.
> >>>
> >>> 1. librte_eal
> >>> 2. librte_malloc
> >>> 3. librte_mempool
> >>> 4. librte_ring
> >>> 5. librte_pmd_bond
> >>> 6. librte_kvargs
> >>>
> >> I'm not sure why thats necesecary.  We add a --start-group/--end-group pair
> >> halfway through this makefile.  If we just encompassed the entire set of
> >> libraries in that group, order would be irrelevant.
> > I don't see any error.
> > Please Tetsuya, could you describe how you test and what is the error message?
> >
> > Thanks
> Thank you for testing.
> I have confirmed '--start-group/--end-groups' is specified while
> compiling, but I am still seeing the error.
> 
> Here is what I actually did.
> 
> ----------------------------------------------------------------------
> 
> << Show my environment >>
> $ uname -a
> Linux eris 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014
> x86_64 x86_64 x86_64 GNU/Linux
> $ lsb_release -a
> No LSB modules are available.
> Distributor ID:    Ubuntu
> Description:    Ubuntu 14.04.1 LTS
> Release:    14.04
> Codename:    trusty
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
> --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
> --program-suffix=-4.8 --enable-shared --enable-linker-build-id
> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib
> --enable-nls --with-sysroot=/ --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
> --enable-gnu-unique-object --disable-libmudflap --enable-plugin
> --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
> --enable-gtk-cairo
> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
> --enable-java-home
> --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
> --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
> --with-arch-directory=amd64
> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
> --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
> --with-multilib-list=m32,m64,mx32 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
> 
> << Compile DPDK >>
> $ git clone git://dpdk.org/dpdk
> $ cd dpdk
> $ vi config/common_linuxapp
> CONFIG_RTE_BUILD_SHARED_LIB=y
> $ T=x86_64-native-linuxapp-gcc make install V=1
> 
> .......
> 
> == Build app/test-acl
> gcc -Wp,-MD,./.main.o.d.tmp -m64 -pthread -fPIC  -march=native
> -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2
> -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3
> -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2
> -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ
> -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_F16C
> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
> -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> -Wformat-security -Wundef -Wwrite-strings   -o main.o -c
> /home/mukawa/tmp/dpdk/app/test-acl/main.c
> gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
> -DRTE_MACHINE_CPUFLAG_F16C
> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
> -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> -Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
> -o testacl main.o -Wl,-export-dynamic
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
> -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> undefined reference to `rte_mempool_lookup'
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> undefined reference to `rte_mempool_create'
> 
> << Reproduce the issue with same options >>
> $ cd x86_64-native-linuxapp-gcc/build/app/test-acl/
> $ gcc -Wp,-MD,./.main.o.d.tmp -m64 -pthread -fPIC  -march=native
> -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2
> -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3
> -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2
> -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ
> -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_F16C
> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
> -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> -Wformat-security -Wundef -Wwrite-strings   -o main.o -c
> /home/mukawa/tmp/dpdk/app/test-acl/main.c
> mukawa@eris:~/tmp/dpdk/x86_64-native-linuxapp-gcc/build/app/test-acl$
> gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
> -DRTE_MACHINE_CPUFLAG_F16C
> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
> -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> -Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
> -o testacl main.o -Wl,-export-dynamic
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
> -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> undefined reference to `rte_mempool_lookup'
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> undefined reference to `rte_mempool_create'
> collect2: error: ld returned 1 exit status
> 

Hi Tetsuya,

Would you mind posting the output of the last command adding the option '-v'?

Sergio


> ----------------------------------------------------------------------
> 
> I just enabled the following option, then compile DPDK.
> CONFIG_RTE_BUILD_SHARED_LIB
> Is this collect to compile PMDs as dynamic link libraries?
> 
> With the option, all libraries include are compiled as dynamic link library.
> Does "--start-group/--end-group" options work with dynamic link libraries?
> 
> Regards,
> Tetsuya
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-02  8:12       ` Sergio Gonzalez Monroy
@ 2014-10-02  8:28         ` Tetsuya Mukawa
  2014-10-02  8:53           ` Sergio Gonzalez Monroy
  0 siblings, 1 reply; 12+ messages in thread
From: Tetsuya Mukawa @ 2014-10-02  8:28 UTC (permalink / raw)
  To: Sergio Gonzalez Monroy; +Cc: dev

(2014/10/02 17:12), Sergio Gonzalez Monroy wrote:
> On Thu, Oct 02, 2014 at 11:48:37AM +0900, Tetsuya Mukawa wrote:
>
>> $ gcc -m64 -pthread -fPIC -march=native -DRTE_MACHINE_CPUFLAG_SSE
>> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
>> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
>> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
>> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
>> -DRTE_MACHINE_CPUFLAG_F16C
>> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C
>> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h
>> -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
>> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
>> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
>> -Wformat-security -Wundef -Wwrite-strings -Wl,-Map=testacl.map,--cref
>> -o testacl main.o -Wl,-export-dynamic
>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
>> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
>> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
>> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
>> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
>> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
>> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
>> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt
>> -Wl,-lm -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
>> undefined reference to `rte_mempool_lookup'
>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
>> undefined reference to `rte_mempool_create' collect2: error: ld
>> returned 1 exit status 
> Hi Tetsuya,
>
> Would you mind posting the output of the last command adding the option '-v'?
Sure, here is.

$ gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
-DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
-DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
-DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
-DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
-DRTE_MACHINE_CPUFLAG_F16C
-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
-I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wold-style-definition -Wpointer-arith
-Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
-o testacl main.o -Wl,-export-dynamic
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
-Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
-Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
-Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
-Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
-Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
-Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
-Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
-Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --disable-libmudflap --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-m64' '-pthread' '-fPIC' '-march=native' '-D'
'RTE_MACHINE_CPUFLAG_SSE' '-D' 'RTE_MACHINE_CPUFLAG_SSE2' '-D'
'RTE_MACHINE_CPUFLAG_SSE3' '-D' 'RTE_MACHINE_CPUFLAG_SSSE3' '-D'
'RTE_MACHINE_CPUFLAG_SSE4_1' '-D' 'RTE_MACHINE_CPUFLAG_SSE4_2' '-D'
'RTE_MACHINE_CPUFLAG_AES' '-D' 'RTE_MACHINE_CPUFLAG_PCLMULQDQ' '-D'
'RTE_MACHINE_CPUFLAG_AVX' '-D' 'RTE_MACHINE_CPUFLAG_F16C' '-D'
'RTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C'
'-I' '/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include'
'-include'
'/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h'
'-Wextra' '-Wall' '-Werror' '-Wstrict-prototypes' '-Wmissing-prototypes'
'-Wmissing-declarations' '-Wold-style-definition' '-Wpointer-arith'
'-Wcast-align' '-Wnested-externs' '-Wcast-qual' '-Wformat-nonliteral'
'-Wformat-security' '-Wundef' '-Wwrite-strings' '-o' 'testacl'
'-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib'
'-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib' '-v'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id
--eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o testacl
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
-L/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..
-Map=testacl.map --cref main.o -export-dynamic --whole-archive
-lrte_distributor -lrte_kni -lrte_pipeline -lrte_table -lrte_port
-lrte_timer -lrte_hash -lrte_lpm -lrte_power -lrte_acl -lrte_meter
-lrte_sched -lm -lrt --start-group -lrte_kvargs -lrte_mbuf -lrte_ip_frag
-lethdev -lrte_malloc -lrte_mempool -lrte_ring -lrte_eal -lrte_cmdline
-lrte_cfgfile -lrte_pmd_bond -lrt -lm -lgcc_s -ldl --end-group
--no-whole-archive -lgcc --as-needed -lgcc_s --no-as-needed -lpthread
-lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
undefined reference to `rte_mempool_lookup'
/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
undefined reference to `rte_mempool_create'
collect2: error: ld returned 1 exit status

Regards,
Tetsuya

> Sergio
>
>
>> ----------------------------------------------------------------------
>>
>> I just enabled the following option, then compile DPDK.
>> CONFIG_RTE_BUILD_SHARED_LIB
>> Is this collect to compile PMDs as dynamic link libraries?
>>
>> With the option, all libraries include are compiled as dynamic link library.
>> Does "--start-group/--end-group" options work with dynamic link libraries?
>>
>> Regards,
>> Tetsuya
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-02  8:28         ` Tetsuya Mukawa
@ 2014-10-02  8:53           ` Sergio Gonzalez Monroy
  2014-10-02  9:05             ` Tetsuya Mukawa
  0 siblings, 1 reply; 12+ messages in thread
From: Sergio Gonzalez Monroy @ 2014-10-02  8:53 UTC (permalink / raw)
  To: Tetsuya Mukawa; +Cc: dev

On Thu, Oct 02, 2014 at 05:28:04PM +0900, Tetsuya Mukawa wrote:
> (2014/10/02 17:12), Sergio Gonzalez Monroy wrote:
> > On Thu, Oct 02, 2014 at 11:48:37AM +0900, Tetsuya Mukawa wrote:
> >
> >> $ gcc -m64 -pthread -fPIC -march=native -DRTE_MACHINE_CPUFLAG_SSE
> >> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
> >> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
> >> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
> >> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
> >> -DRTE_MACHINE_CPUFLAG_F16C
> >> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C
> >> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> >> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h
> >> -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> >> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> >> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> >> -Wformat-security -Wundef -Wwrite-strings -Wl,-Map=testacl.map,--cref
> >> -o testacl main.o -Wl,-export-dynamic
> >> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> >> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> >> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
> >> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
> >> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
> >> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
> >> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
> >> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
> >> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt
> >> -Wl,-lm -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
> >> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> >> undefined reference to `rte_mempool_lookup'
> >> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> >> undefined reference to `rte_mempool_create' collect2: error: ld
> >> returned 1 exit status 
> > Hi Tetsuya,
> >
> > Would you mind posting the output of the last command adding the option '-v'?
> Sure, here is.
> 
> $ gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
> -DRTE_MACHINE_CPUFLAG_F16C
> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
> -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> -Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
> -o testacl main.o -Wl,-export-dynamic
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
> -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
> --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
> --program-suffix=-4.8 --enable-shared --enable-linker-build-id
> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib
> --enable-nls --with-sysroot=/ --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
> --enable-gnu-unique-object --disable-libmudflap --enable-plugin
> --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
> --enable-gtk-cairo
> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
> --enable-java-home
> --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
> --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
> --with-arch-directory=amd64
> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
> --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
> --with-multilib-list=m32,m64,mx32 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
> COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
> LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
> COLLECT_GCC_OPTIONS='-m64' '-pthread' '-fPIC' '-march=native' '-D'
> 'RTE_MACHINE_CPUFLAG_SSE' '-D' 'RTE_MACHINE_CPUFLAG_SSE2' '-D'
> 'RTE_MACHINE_CPUFLAG_SSE3' '-D' 'RTE_MACHINE_CPUFLAG_SSSE3' '-D'
> 'RTE_MACHINE_CPUFLAG_SSE4_1' '-D' 'RTE_MACHINE_CPUFLAG_SSE4_2' '-D'
> 'RTE_MACHINE_CPUFLAG_AES' '-D' 'RTE_MACHINE_CPUFLAG_PCLMULQDQ' '-D'
> 'RTE_MACHINE_CPUFLAG_AVX' '-D' 'RTE_MACHINE_CPUFLAG_F16C' '-D'
> 'RTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C'
> '-I' '/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include'
> '-include'
> '/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h'
> '-Wextra' '-Wall' '-Werror' '-Wstrict-prototypes' '-Wmissing-prototypes'
> '-Wmissing-declarations' '-Wold-style-definition' '-Wpointer-arith'
> '-Wcast-align' '-Wnested-externs' '-Wcast-qual' '-Wformat-nonliteral'
> '-Wformat-security' '-Wundef' '-Wwrite-strings' '-o' 'testacl'
> '-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib'
> '-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib' '-v'

We have been looking at this issue over the last couple of days.
It seems to be an Ubuntu GCC related bug as it works on other distros.
GCC is passing incorrectly the option '--as-needed' to LD resulting in wrong linking.

>  /usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id
> --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed

The '--as-needed' just at the end of the above line is incorrect and not matching
a closing '--no-as-needed'.
You may get away with it by adding 'EXTRA_LDFLAGS=--no-as-needed'. 
ie. $ make install T=x86_64-native-linuxapp-gcc EXTRA_LDFLAGS=--no-as-needed

Sergio

> -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o testacl
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o
> /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> -L/usr/lib/gcc/x86_64-linux-gnu/4.8
> -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
> -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib
> -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu
> -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..
> -Map=testacl.map --cref main.o -export-dynamic --whole-archive
> -lrte_distributor -lrte_kni -lrte_pipeline -lrte_table -lrte_port
> -lrte_timer -lrte_hash -lrte_lpm -lrte_power -lrte_acl -lrte_meter
> -lrte_sched -lm -lrt --start-group -lrte_kvargs -lrte_mbuf -lrte_ip_frag
> -lethdev -lrte_malloc -lrte_mempool -lrte_ring -lrte_eal -lrte_cmdline
> -lrte_cfgfile -lrte_pmd_bond -lrt -lm -lgcc_s -ldl --end-group
> --no-whole-archive -lgcc --as-needed -lgcc_s --no-as-needed -lpthread
> -lc -lgcc --as-needed -lgcc_s --no-as-needed
> /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> undefined reference to `rte_mempool_lookup'
> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> undefined reference to `rte_mempool_create'
> collect2: error: ld returned 1 exit status
> 
> Regards,
> Tetsuya
> 
> > Sergio
> >
> >
> >> ----------------------------------------------------------------------
> >>
> >> I just enabled the following option, then compile DPDK.
> >> CONFIG_RTE_BUILD_SHARED_LIB
> >> Is this collect to compile PMDs as dynamic link libraries?
> >>
> >> With the option, all libraries include are compiled as dynamic link library.
> >> Does "--start-group/--end-group" options work with dynamic link libraries?
> >>
> >> Regards,
> >> Tetsuya
> >>
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-02  8:53           ` Sergio Gonzalez Monroy
@ 2014-10-02  9:05             ` Tetsuya Mukawa
  2014-10-03 11:11               ` Sergio Gonzalez Monroy
  0 siblings, 1 reply; 12+ messages in thread
From: Tetsuya Mukawa @ 2014-10-02  9:05 UTC (permalink / raw)
  To: Sergio Gonzalez Monroy; +Cc: dev

(2014/10/02 17:53), Sergio Gonzalez Monroy wrote:
> On Thu, Oct 02, 2014 at 05:28:04PM +0900, Tetsuya Mukawa wrote:
>> (2014/10/02 17:12), Sergio Gonzalez Monroy wrote:
>>> On Thu, Oct 02, 2014 at 11:48:37AM +0900, Tetsuya Mukawa wrote:
>>>
>>>> $ gcc -m64 -pthread -fPIC -march=native -DRTE_MACHINE_CPUFLAG_SSE
>>>> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
>>>> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
>>>> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
>>>> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
>>>> -DRTE_MACHINE_CPUFLAG_F16C
>>>> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C
>>>> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
>>>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h
>>>> -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
>>>> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
>>>> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
>>>> -Wformat-security -Wundef -Wwrite-strings -Wl,-Map=testacl.map,--cref
>>>> -o testacl main.o -Wl,-export-dynamic
>>>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
>>>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
>>>> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
>>>> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
>>>> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
>>>> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
>>>> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
>>>> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
>>>> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt
>>>> -Wl,-lm -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
>>>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
>>>> undefined reference to `rte_mempool_lookup'
>>>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
>>>> undefined reference to `rte_mempool_create' collect2: error: ld
>>>> returned 1 exit status 
>>> Hi Tetsuya,
>>>
>>> Would you mind posting the output of the last command adding the option '-v'?
>> Sure, here is.
>>
>> $ gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
>> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
>> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
>> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
>> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
>> -DRTE_MACHINE_CPUFLAG_F16C
>> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
>> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
>> -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
>> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
>> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
>> -Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
>> -o testacl main.o -Wl,-export-dynamic
>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
>> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
>> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
>> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
>> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
>> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
>> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
>> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
>> -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>> 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
>> --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
>> --program-suffix=-4.8 --enable-shared --enable-linker-build-id
>> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
>> --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib
>> --enable-nls --with-sysroot=/ --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
>> --enable-gnu-unique-object --disable-libmudflap --enable-plugin
>> --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
>> --enable-gtk-cairo
>> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
>> --enable-java-home
>> --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
>> --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
>> --with-arch-directory=amd64
>> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
>> --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
>> --with-multilib-list=m32,m64,mx32 --with-tune=generic
>> --enable-checking=release --build=x86_64-linux-gnu
>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
>> COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
>> LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
>> COLLECT_GCC_OPTIONS='-m64' '-pthread' '-fPIC' '-march=native' '-D'
>> 'RTE_MACHINE_CPUFLAG_SSE' '-D' 'RTE_MACHINE_CPUFLAG_SSE2' '-D'
>> 'RTE_MACHINE_CPUFLAG_SSE3' '-D' 'RTE_MACHINE_CPUFLAG_SSSE3' '-D'
>> 'RTE_MACHINE_CPUFLAG_SSE4_1' '-D' 'RTE_MACHINE_CPUFLAG_SSE4_2' '-D'
>> 'RTE_MACHINE_CPUFLAG_AES' '-D' 'RTE_MACHINE_CPUFLAG_PCLMULQDQ' '-D'
>> 'RTE_MACHINE_CPUFLAG_AVX' '-D' 'RTE_MACHINE_CPUFLAG_F16C' '-D'
>> 'RTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C'
>> '-I' '/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include'
>> '-include'
>> '/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h'
>> '-Wextra' '-Wall' '-Werror' '-Wstrict-prototypes' '-Wmissing-prototypes'
>> '-Wmissing-declarations' '-Wold-style-definition' '-Wpointer-arith'
>> '-Wcast-align' '-Wnested-externs' '-Wcast-qual' '-Wformat-nonliteral'
>> '-Wformat-security' '-Wundef' '-Wwrite-strings' '-o' 'testacl'
>> '-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib'
>> '-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib' '-v'
> We have been looking at this issue over the last couple of days.
> It seems to be an Ubuntu GCC related bug as it works on other distros.
> GCC is passing incorrectly the option '--as-needed' to LD resulting in wrong linking.
>
>>  /usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id
>> --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed
> The '--as-needed' just at the end of the above line is incorrect and not matching
> a closing '--no-as-needed'.
> You may get away with it by adding 'EXTRA_LDFLAGS=--no-as-needed'. 
> ie. $ make install T=x86_64-native-linuxapp-gcc EXTRA_LDFLAGS=--no-as-needed

I can compile DPDK with above options.
Thank you everyone for helping to solve this issue.

Regards,
Tetsuya

>
> Sergio
>
>> -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o testacl
>> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o
>> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o
>> /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o
>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
>> -L/usr/lib/gcc/x86_64-linux-gnu/4.8
>> -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
>> -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib
>> -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu
>> -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..
>> -Map=testacl.map --cref main.o -export-dynamic --whole-archive
>> -lrte_distributor -lrte_kni -lrte_pipeline -lrte_table -lrte_port
>> -lrte_timer -lrte_hash -lrte_lpm -lrte_power -lrte_acl -lrte_meter
>> -lrte_sched -lm -lrt --start-group -lrte_kvargs -lrte_mbuf -lrte_ip_frag
>> -lethdev -lrte_malloc -lrte_mempool -lrte_ring -lrte_eal -lrte_cmdline
>> -lrte_cfgfile -lrte_pmd_bond -lrt -lm -lgcc_s -ldl --end-group
>> --no-whole-archive -lgcc --as-needed -lgcc_s --no-as-needed -lpthread
>> -lc -lgcc --as-needed -lgcc_s --no-as-needed
>> /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o
>> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
>> undefined reference to `rte_mempool_lookup'
>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
>> undefined reference to `rte_mempool_create'
>> collect2: error: ld returned 1 exit status
>>
>> Regards,
>> Tetsuya
>>
>>> Sergio
>>>
>>>
>>>> ----------------------------------------------------------------------
>>>>
>>>> I just enabled the following option, then compile DPDK.
>>>> CONFIG_RTE_BUILD_SHARED_LIB
>>>> Is this collect to compile PMDs as dynamic link libraries?
>>>>
>>>> With the option, all libraries include are compiled as dynamic link library.
>>>> Does "--start-group/--end-group" options work with dynamic link libraries?
>>>>
>>>> Regards,
>>>> Tetsuya
>>>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled
  2014-10-02  9:05             ` Tetsuya Mukawa
@ 2014-10-03 11:11               ` Sergio Gonzalez Monroy
  0 siblings, 0 replies; 12+ messages in thread
From: Sergio Gonzalez Monroy @ 2014-10-03 11:11 UTC (permalink / raw)
  To: Tetsuya Mukawa; +Cc: dev

On Thu, Oct 02, 2014 at 06:05:09PM +0900, Tetsuya Mukawa wrote:
> (2014/10/02 17:53), Sergio Gonzalez Monroy wrote:
> > On Thu, Oct 02, 2014 at 05:28:04PM +0900, Tetsuya Mukawa wrote:
> >> (2014/10/02 17:12), Sergio Gonzalez Monroy wrote:
> >>> On Thu, Oct 02, 2014 at 11:48:37AM +0900, Tetsuya Mukawa wrote:
> >>>
> >>>> $ gcc -m64 -pthread -fPIC -march=native -DRTE_MACHINE_CPUFLAG_SSE
> >>>> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
> >>>> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
> >>>> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
> >>>> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
> >>>> -DRTE_MACHINE_CPUFLAG_F16C
> >>>> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C
> >>>> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> >>>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h
> >>>> -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> >>>> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> >>>> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> >>>> -Wformat-security -Wundef -Wwrite-strings -Wl,-Map=testacl.map,--cref
> >>>> -o testacl main.o -Wl,-export-dynamic
> >>>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> >>>> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> >>>> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
> >>>> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
> >>>> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
> >>>> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
> >>>> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
> >>>> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
> >>>> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt
> >>>> -Wl,-lm -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
> >>>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> >>>> undefined reference to `rte_mempool_lookup'
> >>>> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> >>>> undefined reference to `rte_mempool_create' collect2: error: ld
> >>>> returned 1 exit status 
> >>> Hi Tetsuya,
> >>>
> >>> Would you mind posting the output of the last command adding the option '-v'?
> >> Sure, here is.
> >>
> >> $ gcc -m64 -pthread -fPIC  -march=native -DRTE_MACHINE_CPUFLAG_SSE
> >> -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3
> >> -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1
> >> -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES
> >> -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX
> >> -DRTE_MACHINE_CPUFLAG_F16C
> >> -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C 
> >> -I/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include -include
> >> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h -W
> >> -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> >> -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> >> -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> >> -Wformat-security -Wundef -Wwrite-strings  -Wl,-Map=testacl.map,--cref
> >> -o testacl main.o -Wl,-export-dynamic
> >> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib 
> >> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> >> -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni
> >> -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer
> >> -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl
> >> -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group
> >> -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lethdev
> >> -Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
> >> -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrt -Wl,-lm
> >> -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive -v
> >> Using built-in specs.
> >> COLLECT_GCC=gcc
> >> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
> >> Target: x86_64-linux-gnu
> >> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> >> 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
> >> --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
> >> --program-suffix=-4.8 --enable-shared --enable-linker-build-id
> >> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
> >> --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib
> >> --enable-nls --with-sysroot=/ --enable-clocale=gnu
> >> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
> >> --enable-gnu-unique-object --disable-libmudflap --enable-plugin
> >> --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
> >> --enable-gtk-cairo
> >> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
> >> --enable-java-home
> >> --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
> >> --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
> >> --with-arch-directory=amd64
> >> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
> >> --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
> >> --with-multilib-list=m32,m64,mx32 --with-tune=generic
> >> --enable-checking=release --build=x86_64-linux-gnu
> >> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> >> Thread model: posix
> >> gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
> >> COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
> >> LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
> >> COLLECT_GCC_OPTIONS='-m64' '-pthread' '-fPIC' '-march=native' '-D'
> >> 'RTE_MACHINE_CPUFLAG_SSE' '-D' 'RTE_MACHINE_CPUFLAG_SSE2' '-D'
> >> 'RTE_MACHINE_CPUFLAG_SSE3' '-D' 'RTE_MACHINE_CPUFLAG_SSSE3' '-D'
> >> 'RTE_MACHINE_CPUFLAG_SSE4_1' '-D' 'RTE_MACHINE_CPUFLAG_SSE4_2' '-D'
> >> 'RTE_MACHINE_CPUFLAG_AES' '-D' 'RTE_MACHINE_CPUFLAG_PCLMULQDQ' '-D'
> >> 'RTE_MACHINE_CPUFLAG_AVX' '-D' 'RTE_MACHINE_CPUFLAG_F16C' '-D'
> >> 'RTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C'
> >> '-I' '/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include'
> >> '-include'
> >> '/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/include/rte_config.h'
> >> '-Wextra' '-Wall' '-Werror' '-Wstrict-prototypes' '-Wmissing-prototypes'
> >> '-Wmissing-declarations' '-Wold-style-definition' '-Wpointer-arith'
> >> '-Wcast-align' '-Wnested-externs' '-Wcast-qual' '-Wformat-nonliteral'
> >> '-Wformat-security' '-Wundef' '-Wwrite-strings' '-o' 'testacl'
> >> '-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib'
> >> '-L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib' '-v'
> > We have been looking at this issue over the last couple of days.
> > It seems to be an Ubuntu GCC related bug as it works on other distros.
> > GCC is passing incorrectly the option '--as-needed' to LD resulting in wrong linking.
> >

Just a quick follow up on this issue and to rectify myself. 
This is not a bug but expected behavior:
https://wiki.debian.org/ToolChain/DSOLinking#Onlylinkwithneededlibraries

Sergio

> >>  /usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id
> >> --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed
> > The '--as-needed' just at the end of the above line is incorrect and not matching
> > a closing '--no-as-needed'.
> > You may get away with it by adding 'EXTRA_LDFLAGS=--no-as-needed'. 
> > ie. $ make install T=x86_64-native-linuxapp-gcc EXTRA_LDFLAGS=--no-as-needed
> 
> I can compile DPDK with above options.
> Thank you everyone for helping to solve this issue.
> 
> Regards,
> Tetsuya
> 
> >
> > Sergio
> >
> >> -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o testacl
> >> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o
> >> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o
> >> /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o
> >> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> >> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib
> >> -L/usr/lib/gcc/x86_64-linux-gnu/4.8
> >> -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
> >> -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib
> >> -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu
> >> -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..
> >> -Map=testacl.map --cref main.o -export-dynamic --whole-archive
> >> -lrte_distributor -lrte_kni -lrte_pipeline -lrte_table -lrte_port
> >> -lrte_timer -lrte_hash -lrte_lpm -lrte_power -lrte_acl -lrte_meter
> >> -lrte_sched -lm -lrt --start-group -lrte_kvargs -lrte_mbuf -lrte_ip_frag
> >> -lethdev -lrte_malloc -lrte_mempool -lrte_ring -lrte_eal -lrte_cmdline
> >> -lrte_cfgfile -lrte_pmd_bond -lrt -lm -lgcc_s -ldl --end-group
> >> --no-whole-archive -lgcc --as-needed -lgcc_s --no-as-needed -lpthread
> >> -lc -lgcc --as-needed -lgcc_s --no-as-needed
> >> /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o
> >> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
> >> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> >> undefined reference to `rte_mempool_lookup'
> >> /home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib/librte_eal.so:
> >> undefined reference to `rte_mempool_create'
> >> collect2: error: ld returned 1 exit status
> >>
> >> Regards,
> >> Tetsuya
> >>
> >>> Sergio
> >>>
> >>>
> >>>> ----------------------------------------------------------------------
> >>>>
> >>>> I just enabled the following option, then compile DPDK.
> >>>> CONFIG_RTE_BUILD_SHARED_LIB
> >>>> Is this collect to compile PMDs as dynamic link libraries?
> >>>>
> >>>> With the option, all libraries include are compiled as dynamic link library.
> >>>> Does "--start-group/--end-group" options work with dynamic link libraries?
> >>>>
> >>>> Regards,
> >>>> Tetsuya
> >>>>
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-10-03 11:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01  4:27 [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled mukawa
2014-10-01 10:50 ` Neil Horman
2014-10-01 11:56   ` Thomas Monjalon
2014-10-02  2:48     ` Tetsuya Mukawa
2014-10-02  8:12       ` Sergio Gonzalez Monroy
2014-10-02  8:28         ` Tetsuya Mukawa
2014-10-02  8:53           ` Sergio Gonzalez Monroy
2014-10-02  9:05             ` Tetsuya Mukawa
2014-10-03 11:11               ` Sergio Gonzalez Monroy
2014-10-02  1:43   ` Tetsuya Mukawa
2014-10-02  2:46     ` Matthew Hall
2014-10-02  3:44       ` Tetsuya Mukawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).