From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by dpdk.org (Postfix) with ESMTP id E0AE858C4 for ; Thu, 2 Oct 2014 10:58:25 +0200 (CEST) Received: by mail-pa0-f45.google.com with SMTP id rd3so1900342pab.32 for ; Thu, 02 Oct 2014 02:05:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=80iykqtBDz4/E5oZEQtib1eIZ3qVFFJZMK3t8uRhYBI=; b=TAGpafzlXmoWSPIdN+6h0Azm/wbc2OJpoWE1+TRTD8+VYn+NxTf+gumOF3vOJnaD1w hD8mNMc0DGNWCpxixD4IoUyE6BDutJ/IXEAeoWr/Eb9P8pqpnwjjJEjeb432+kFJuT1F kI+WSJsEcx+zaw5T9SuRKLTFHxORAspIJ/TRFx8+pGVEW+S52dKmQXRV1mTnWmBr+bTS njIBmQ1jZNDqIX6tEwnUvZWGtnE/szuEVpCEYqru/i9dF/wBo7QknUsjD3Z0Gt/OHcEB RlVMw3O2xbVQHooOJgggLhQyPI3ZKgHFpZ7GuVbg03A+jAy+ngZRwp+ixrQO09kaKoTe d0Pg== X-Gm-Message-State: ALoCoQlvM7z2Um9Le+WyLbmRa4tGGUJNg+nfGLhOYYzccrKyK4p5laHvQqLfDZEu/CcEE9dwdiGS X-Received: by 10.68.129.102 with SMTP id nv6mr70821107pbb.134.1412240713939; Thu, 02 Oct 2014 02:05:13 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id f12sm2905584pat.36.2014.10.02.02.05.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Oct 2014 02:05:13 -0700 (PDT) Message-ID: <542D1545.8040202@igel.co.jp> Date: Thu, 02 Oct 2014 18:05:09 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Sergio Gonzalez Monroy References: <1412137623-18817-1-git-send-email-mukawa@igel.co.jp> <20141001105022.GB21151@hmsreliant.think-freely.org> <3354420.dnXLPNUCVP@xps13> <542CBD05.5000507@igel.co.jp> <20141002081221.GA27208@sivswdev02.ir.intel.com> <542D0C94.70209@igel.co.jp> <20141002085321.GA31287@sivswdev02.ir.intel.com> In-Reply-To: <20141002085321.GA31287@sivswdev02.ir.intel.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] Fix linking errors when CONFIG_RTE_BUILD_SHARED_LIB is enabled X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2014 08:58:26 -0000 (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=3Dnative -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=3DRTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_C= PUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_C= PUFLAG_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=3Dtestacl.map,--c= ref >>>> -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=20 >>> Hi Tetsuya, >>> >>> Would you mind posting the output of the last command adding the opti= on '-v'? >> Sure, here is. >> >> $ gcc -m64 -pthread -fPIC -march=3Dnative -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=3DRTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPU= FLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPU= FLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX,RTE_CPUFLAG_F16C=20 >> -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=3Dtestacl.map,--cr= ef >> -o testacl main.o -Wl,-export-dynamic >> -L/home/mukawa/tmp/dpdk/x86_64-native-linuxapp-gcc/lib=20 >> -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,-l= m >> -Wl,-lgcc_s -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive -v >> Using built-in specs. >> COLLECT_GCC=3Dgcc >> COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper >> Target: x86_64-linux-gnu >> Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu >> 4.8.2-19ubuntu1' --with-bugurl=3Dfile:///usr/share/doc/gcc-4.8/README.= Bugs >> --enable-languages=3Dc,c++,java,go,d,fortran,objc,obj-c++ --prefix=3D/= usr >> --program-suffix=3D-4.8 --enable-shared --enable-linker-build-id >> --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3D= posix >> --with-gxx-include-dir=3D/usr/include/c++/4.8 --libdir=3D/usr/lib >> --enable-nls --with-sysroot=3D/ --enable-clocale=3Dgnu >> --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes >> --enable-gnu-unique-object --disable-libmudflap --enable-plugin >> --with-system-zlib --disable-browser-plugin --enable-java-awt=3Dgtk >> --enable-gtk-cairo >> --with-java-home=3D/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre >> --enable-java-home >> --with-jvm-root-dir=3D/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 >> --with-jvm-jar-dir=3D/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 >> --with-arch-directory=3Damd64 >> --with-ecj-jar=3D/usr/share/java/eclipse-ecj.jar --enable-objc-gc >> --enable-multiarch --disable-werror --with-arch-32=3Di686 --with-abi=3D= m64 >> --with-multilib-list=3Dm32,m64,mx32 --with-tune=3Dgeneric >> --enable-checking=3Drelease --build=3Dx86_64-linux-gnu >> --host=3Dx86_64-linux-gnu --target=3Dx86_64-linux-gnu >> Thread model: posix >> gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) >> COMPILER_PATH=3D/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=3D/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-li= nux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/li= b/:/usr/lib/ >> COLLECT_GCC_OPTIONS=3D'-m64' '-pthread' '-fPIC' '-march=3Dnative' '-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=3DRTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUF= LAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUF= LAG_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-prototype= s' >> '-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=3D/ --build-id >> --eh-frame-hdr -m elf_x86_64 --hash-style=3Dgnu --as-needed > The '--as-needed' just at the end of the above line is incorrect and no= t matching > a closing '--no-as-needed'. > You may get away with it by adding 'EXTRA_LDFLAGS=3D--no-as-needed'.=20 > ie. $ make install T=3Dx86_64-native-linuxapp-gcc EXTRA_LDFLAGS=3D--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=3Dtestacl.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_fr= ag >> -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 libr= aries? >>>> >>>> Regards, >>>> Tetsuya >>>>