rte_eth_dev_count_avail() from the DPDK API returns 0 intel x550 ethernet card on linux 5.4.0 dpdk version 19.11.12 - dpdk

built dpdk 19.11.12 from source and i have written an ext app built using these libraries. I use dpdk-devbind to bind a device to igb_uio .
The device i have is an Intel X550. When i run testpmd it seems to recognize the device but int my app rte_eth_dev_count_avail always returns 0
I would belive this has to either do with the way i have built my dpdk library or my app
this is extract of the Makefile i am using to build my app
RTE_SDK ?= /usr/local/share/dpdk
RTE_TARGET ?= x86_64-default-linuxapp-gcc
include $(RTE_SDK)/mk/rte.vars.mk
# binary name
APP = myapp
# all source are stored in SRCS-y
SRCS-y := main.c
WERROR_FLAGS += -Werror
CFLAGS += -O3 -g
CFLAGS += $(WERROR_FLAGS) -Wno-address-of-packed-member
CFLAGS += -Wall
CFLAGS += -pie -fPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -fstack-protector-strong
CFLAGS += -DSTATSD
LDFLAGS += -z relro -z now
LDFLAGS += -ljansson -lrte_pmd_ixgbe
LDLIBS += -lrte_pmd_ixgbe
# disable since libxenstore.so isn't linked properly
#CONFIG_RTE_LIBRTE_PMD_XENVIRT = n
CONFIG_RTE_LIBRTE_PMD_IXGBE = y
include $(RTE_SDK)/mk/rte.extapp.mk
I build my dpdk libraries using this
RUN make -C /dpdk/dpdk-stable-${DPDK_VERSION}/ config T=x86_64-native-linuxapp-gcc
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=n/CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n/CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=n/CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_RX=n/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_RX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX=n/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LOG_DP_LEVEL=RTE_LOG_INFO/CONFIG_RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LOG_HISTORY=256/CONFIG_RTE_LOG_HISTORY=2048/g > /tmp/out && mv /tmp/out build/.config
i can bind to the interfaces using dpdk-devbind and testpmd also seems to identify and be able to bind to these devices
but my app is not able to recognize the devices.
What am i missing here ?
these are the logs --log-level=8 for EAL logs and I get this output
Sep 09 04:56:50 {"timestamp": 1662717410.8821511, "level": "info", "message": "Initialising EAL ..."}
Sep 09 04:56:50 EAL: Detected 64 lcore(s)
Sep 09 04:56:50 EAL: Detected 2 NUMA nodes
Sep 09 04:56:50 EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
Sep 09 04:56:50 EAL: Selected IOVA mode 'PA'
Sep 09 04:56:50 EAL: No available hugepages reported in hugepages-1048576kB
Sep 09 04:56:50 EAL: Debug dataplane logs available - lower performance
Sep 09 04:56:50 EAL: Debug dataplane logs available - lower performance
Sep 09 04:56:50 EAL: Probing VFIO support...
Sep 09 04:56:50 EAL: VFIO support initialized
Sep 09 04:56:50 EAL: Probing VFIO support...
Sep 09 04:56:50 EAL: VFIO support initialized
also adding the -d parameter with the directory where the plugins are located /usr/local/lib/ gives me an error where the plugin is not found
the eal param initialized is
--master-lcore 4 -l 4,5,6,7 --log-level 8 -d /usr/local/lib/
Sep 09 04:47:29 EAL: Detected 64 lcore(s)
Sep 09 04:47:29 EAL: Detected 2 NUMA nodes
Sep 09 04:47:29 EAL: librte_compressdev.so.0.200: cannot open shared object file: No such file or directory
Sep 09 04:47:29 EAL: FATAL: Cannot init plugins
Sep 09 04:47:29 EAL: Cannot init plugins
the librte_compressdev.so.0.200 is present in the path
ls -l /usr/local/lib/librte_compressdev.so.0.200
-rwxr-xr-x 1 root root 38024 Sep 8 23:51 /usr/local/lib/librte_compressdev.so.0.200

[based on the live debug]
DPDK 17.11 LTS use libdpdk.so and a complete shared library, which makes all the necessary ethdev PMD available. hence using the current makefile, it pans out properly without any issues.
But moving to DPDK 19.11 LTS, libdpdk.so is no longer availble. hence one have to manually link either in shared or static libraries properly (as pointed out in comments). For example
DPDK_CFLAGS=" -DHAVE_DPDK -I${RTE_SDK}/${RTE_TARGET}/include/ -include ${RTE_SDK}/${RTE_TARGET}/include/rte_config.h "
DPDK_LDFLAGS="-I$RTE_SDK/lib/librte_eal/linux/eal/include \
-DRTE_USE_FUNCTION_VERSIONING \
-I$RTE_SDK/$RTE_TARGET/include -include $RTE_SDK/$RTE_TARGET/include/rte_config.h \
-D_GNU_SOURCE -W -Wall -DALLOW_EXPERIMENTAL_API \
-L$RTE_SDK/$RTE_TARGET/lib -Wl,-lrte_flow_classify -Wl,--whole-archive -Wl,-lrte_pipeline -Wl,--no-whole-archive \
-Wl,--whole-archive -Wl,-lrte_table -Wl,--no-whole-archive -Wl,--whole-archive \
-Wl,-lrte_port -Wl,--no-whole-archive -Wl,-lrte_pdump -Wl,-lrte_ip_frag -Wl,-lrte_meter \
-Wl,-lrte_fib -Wl,-lrte_rib -Wl,-lrte_lpm -Wl,-lrte_acl -Wl,-lrte_power -Wl,-lrte_kni \
-Wl,-lrte_efd -Wl,-lrte_bpf -Wl,-lrte_ipsec -Wl,--whole-archive -Wl,-lrte_cfgfile -Wl,-lrte_gro \
-Wl,-lrte_gso -Wl,-lrte_hash -Wl,-lrte_member -Wl,-lrte_vhost -Wl,-lrte_kvargs -Wl,-lrte_mbuf \
-Wl,-lrte_net -Wl,-lrte_ethdev -Wl,-lrte_cryptodev -Wl,-lrte_security -Wl,-lrte_compressdev \
-Wl,-lrte_eventdev -Wl,-lrte_timer -Wl,-lrte_mempool -Wl,-lrte_stack -Wl,-lrte_mempool_ring \
-Wl,-lrte_ring -Wl,-lrte_pci -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_reorder -Wl,-lrte_sched \
-Wl,-lrte_rcu -Wl,-lrte_bus_pci -Wl,-lrte_bus_vdev -Wl,-lrte_mempool_bucket -Wl,-lrte_mempool_stack \
-Wl,-lrte_pmd_af_packet \
-Wl,-lrte_pmd_ixgbe \
-Wl,-lrte_pmd_memif \
-Wl,-lrte_pmd_null \
-Wl,-lpcap -Wl,-lrte_pmd_ring -Wl,-lrte_pmd_tap -Wl,-lrte_pmd_virtio -Wl,-lrte_bus_vmbus \
-Wl,-lcrypto -Wl,-lrte_pmd_null_crypto -Wl,-lrte_pmd_crypto_scheduler -Wl,-lrte_pmd_virtio_crypto \
-Wl,-lrte_pmd_skeleton_event -Wl,-lrte_pmd_sw_event \
-Wl,--no-whole-archive -Wl,-lrt -Wl,-lm -Wl,-lnuma -Wl,-ldl -Wl,-export-dynamic -Wl,-export-dynamic \
-L$RTE_SDK/examples/l2fwd/build/lib -L$RTE_SDK/$RTE_TARGET/lib -Wl,--as-needed"
Since DPDk 19.11 LTS makes uses on meson-ninja, my suggestion and recommendation is to make use of pkg-config to built the right CFLAGS and LDFLAGS. Please refer StackOverflow query on using dpdk cmake too
Note: recommended to build a custom target folder rather than make install, since the built and application run is done in docker.

Related

ocamlc - compiling ocaml-wasm - Error: /usr/lib/ocaml/bigarray.cma is not a bytecode object file

I'm trying to make install ocaml-wasm 1.
Unfortunately the build is failing with the error-message:
Error: /usr/lib/ocaml/bigarray.cma is not a bytecode object file
Here's a Dockerfile so you may reproduce the error:
FROM base/archlinux
RUN pacman -Sy --noconfirm ocaml ocamlbuild wget unzip make
RUN wget https://github.com/WebAssembly/spec/archive/v1.0.zip
RUN unzip v1.0.zip
CMD cd spec-1.0; make -C interpreter install; bash
You may run it:
docker build -t ocaml-wasm . && docker run --rm -it ocaml-wasm
It should find it to produce the same error as above.
Here's the entire output of the make command:
make: Entering directory '/spec-1.0/interpreter'
ls util/*.ml* syntax/*.ml* binary/*.ml* text/*.ml* valid/*.ml* runtime/*.ml* exec/*.ml* script/*.ml* host/*.ml* main/*.ml* \
| sed 's:\(.*/\)\{0,1\}\(.*\)\.[^\.]*:\2:' \
| grep -v main \
| sort | uniq \
>wasm.mlpack
echo >_tags "true: bin_annot"
echo >>_tags "<{util,syntax,binary,text,valid,runtime,exec,script,host,main}/*.cmx>: for-pack(Wasm)"
ocamlbuild -cflags '-w +a-4-27-42-44-45 -warn-error +a' -I util -I syntax -I binary -I text -I valid -I runtime -I exec -I script -I host -I main -libs bigarray -quiet wasm.cmx
+ /usr/bin/ocamlc.opt -pack bigarray.cma -bin-annot util/lib.cmo binary/utf8.cmo exec/float.cmo exec/f32.cmo exec/f64.cmo exec/numeric_error.cmo exec/int.cmo exec/i32.cmo exec/i64.cmo syntax/types.cmo syntax/values.cmo runtime/memory.cmo util/source.cmo syntax/ast.cmo util/error.cmo binary/encode.cmo exec/i64_convert.cmo syntax/operators.cmo binary/decode.cmo script/script.cmo text/parser.cmo text/lexer.cmo text/parse.cmo util/sexpr.cmo text/arrange.cmo exec/i32_convert.cmo exec/f32_convert.cmo exec/f64_convert.cmo exec/eval_numeric.cmo runtime/func.cmo runtime/global.cmo runtime/table.cmo runtime/instance.cmo exec/eval.cmo host/env.cmo main/flags.cmo script/import.cmo script/js.cmo text/print.cmo valid/valid.cmo script/run.cmo host/spectest.cmo -o wasm.cmo
File "_none_", line 1:
Error: /usr/lib/ocaml/bigarray.cma is not a bytecode object file
Command exited with code 2.
make: *** [Makefile:83: _build/wasm.cmx] Error 10
rm wasm.mlpack _tags
make: Leaving directory '/spec-1.0/interpreter'
How do I get ocaml-wasm to compile?
I've seen 2, but the answer doesn't help me. I've not installed any non-standard binaries. Could the ocaml distribution on arch linux be broken?
I suspect that your ocamlbuild version is 0.13 (see ocamlbuild --version), which is known to have this issue. You should use 0.12 to avoid the problem.
ocamlbuild 0.13 is not package on opam because of this problem (so it's not visible to most users), but I hadn't considered that distribution packagers may decide to package it nonetheless.

How to use Bazel as a build tool in Conan.io

I am trying to use Conan for package management and Bazel as build tool for my C++ Codes. The reason I am using conan is because JFrog Artifactory supports it, which I am using as my Artifactory Repository.
To do that I came up with the following plan :
$/home/mytimer=> ls -lrt
0 Sep 25 11:57 WORKSPACE
4096 Sep 25 12:00 build/
4096 Sep 25 12:02 main/
$/home/mytimer=> ls -l main
total 4
60 Sep 25 12:02 BUILD
61 Sep 25 11:56 conanfile.txt
955 Sep 25 11:56 timer.cpp
$/home/mytimer=> ls -l build
total 8
1266 Sep 25 12:00 conanbuildinfo.gcc
1875 Sep 25 12:00 conaninfo.txt
( This is after I executed conan --install ../main )
$/home/mytimer=> cat cat main/conanfile.txt
[requires]
Poco/1.7.8p3#pocoproject/stable
[generators]
gcc
$/home/mytimer=>cat build/conanbuildinfo.gcc
-DPOCO_STATIC=ON -DPOCO_NO_AUTOMATIC_LIBS -I"/home/.conan/data/Poco/1.7.8p3/pocoproject/stable/package/da23483d46b7229cbae8615ce1ea2594635f3a5f/include" -I"/home/.conan/data/OpenSSL/1.0.2l/conan/stable/package/c8dc3f0797f6d24f3c80634ae2854ddf9ee34334/include" -I"/home/.conan/data/zlib/1.2.11/conan/stable/package/82b1dd29b2e9143665c77ef477100c690d719cbf/include" -Wl,-rpath="/home/.conan/data/Poco/1.7.8p3/pocoproject/stable/package/da23483d46b7229cbae8615ce1ea2594635f3a5f/lib" -Wl,-rpath="/home/.conan/data/OpenSSL/1.0.2l/conan/stable/package/c8dc3f0797f6d24f3c80634ae2854ddf9ee34334/lib" -Wl,-rpath="/home/.conan/data/zlib/1.2.11/conan/stable/package/82b1dd29b2e9143665c77ef477100c690d719cbf/lib" -L"/home/.conan/data/Poco/1.7.8p3/pocoproject/stable/package/da23483d46b7229cbae8615ce1ea2594635f3a5f/lib" -L"/home/.conan/data/OpenSSL/1.0.2l/conan/stable/package/c8dc3f0797f6d24f3c80634ae2854ddf9ee34334/lib" -L"/home/.conan/data/zlib/1.2.11/conan/stable/package/82b1dd29b2e9143665c77ef477100c690d719cbf/lib" -lPocoUtil -lPocoMongoDB -lPocoNet -lPocoNetSSL -lPocoCrypto -lPocoData -lPocoDataSQLite -lPocoZip -lPocoXML -lPocoJSON -lPocoFoundation -lpthread -lrt -lssl -lcrypto -ldl -lz -D_GLIBCXX_USE_CXX11_ABI=0 -m64 -s -DNDEBUGdevc
$/home/mytimer=> cat build/conaninfo.txt
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=6.3
os=Linux
[requires]
Poco/1.Y.Z
[options]
[full_settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=6.3
os=Linux
[full_requires]
OpenSSL/1.0.2l#conan/stable:c8dc3f0797f6d24f3c80634ae2854ddf9ee34334
Poco/1.7.8p3#pocoproject/stable:da23483d46b7229cbae8615ce1ea2594635f3a5f
zlib/1.2.11#conan/stable:82b1dd29b2e9143665c77ef477100c690d719cbf
[full_options]
OpenSSL:386=False
OpenSSL:no_asm=False
OpenSSL:no_bf=False
OpenSSL:no_cast=False
OpenSSL:no_des=False
OpenSSL:no_dh=False
OpenSSL:no_dsa=False
OpenSSL:no_hmac=False
OpenSSL:no_md2=False
OpenSSL:no_md5=False
OpenSSL:no_mdc2=False
OpenSSL:no_rc2=False
OpenSSL:no_rc4=False
OpenSSL:no_rc5=False
OpenSSL:no_rsa=False
OpenSSL:no_sha=False
OpenSSL:no_sse2=False
OpenSSL:no_threads=False
OpenSSL:no_zlib=False
OpenSSL:shared=False
Poco:cxx_14=False
Poco:enable_apacheconnector=False
Poco:enable_cppparser=False
Poco:enable_crypto=True
Poco:enable_data=True
Poco:enable_data_mysql=False
Poco:enable_data_odbc=False
Poco:enable_data_sqlite=True
Poco:enable_json=True
Poco:enable_mongodb=True
Poco:enable_net=True
Poco:enable_netssl=True
Poco:enable_netssl_win=True
Poco:enable_pagecompiler=False
Poco:enable_pagecompiler_file2page=False
Poco:enable_pdf=False
Poco:enable_pocodoc=False
Poco:enable_sevenzip=False
Poco:enable_tests=False
Poco:enable_util=True
Poco:enable_xml=True
Poco:enable_zip=True
Poco:force_openssl=True
Poco:poco_unbundled=False
Poco:shared=False
zlib:shared=False
[scope]
dev=True
[recipe_hash]
[env]
$/home/mytimer=> cat main/BUILD
cc_binary(
name = "timer",
srcs = ["timer.cpp"],
)
Now, I want to build the mytimer project using bazel as something like this :
$/home/mytimer=> bazel build --(some options) //main:timer
What should this some options be , so that bazel can read conanbuildinfo.gcc and use it to create the executable file ?
I used the genrule() feature of bazel to solve my problem in this way :
$/home/mytimer=> cat main/BUILD
genrule(
name = "timer",
outs = ["timer.out"],
cmd = "g++ /home/mytimer/main/timer.cpp#/home/mytimer/build/conanbuildinfo.gcc -o $# ",
)
/home/mytime=> bazel build -s //main:timer
WARNING: ignoring http_proxy in environment.
WARNING: Output base '/home/.cache/bazel/_bazel_user/274fa1325d85b25c2722794ea' is on NFS. This may lead to surprising failures and undetermined behavior.
INFO: Found 1 target...
>>>>> # //main:timer [action 'Executing genrule //main:timer']
(cd /home/.cache/bazel/_bazel_user/274fa1325d85b25c2722614/execroot/__main__ && \
exec env - \
LD_LIBRARY_PATH=<library paths>
PATH=<all other paths>
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; g++ /home/bazel/examples/cpp-tutorial/mytimer/main/timer.cpp #/home/bazel/examples/cpp-tutorial/mytimer/build/conanbuildinfo.gcc -o bazel-out/local-fastbuild/genfiles/main/timer.out ')
Target //main:timer up-to-date:
bazel-genfiles/main/timer.out
INFO: Elapsed time: 1.050s, Critical Path: 0.50s
/home/mytime=> ls -lrt bazel-out/local-fastbuild/genfiles/main/
total 212
212000 Sep 26 14:42 timer.out
/home/mytime=> ./bazel-out/local-fastbuild/genfiles/main/timer.out
Callback called after 249 milliseconds.
Callback called after 749 milliseconds.
Callback called after 1249 milliseconds.
Callback called after 1749 milliseconds.
Callback called after 2249 milliseconds.
Callback called after 2749 milliseconds.
^C
So, by using genrule() feature, we can execute any shell command in bazel. Although this is not a so-called "bazel" way to generate artifacts (genrule() to bazel is same as "goto" command to C/C++ ), in this scenario, I do not see any other option to solve this issue.
You could also create a custom rule: https://docs.bazel.build/versions/master/skylark/rules.html for this. Ideally you would use a Skylark api to the C++ rules, to prevent reimplementing everything that C++ rules already do, but unfortunately that api is not yet finished (October 2017). I think the best tracking bug is https://github.com/bazelbuild/bazel/issues/1624.

binutils and gcc with LTO

I have binutils-2.25.1 installed to /usr/local/binutils-2.25.1, configured with
../configure --prefix=/usr/local/binutils-2.25.1 --enable-plugins --enable-gold --disable-werror
And I want to build RPM package - gcc with LTO support that uses linker ld from /usr/local/binutils-2.25.1.
I try:
Summary: The GNU Compiler Collection
Name: gcc-custom
Version: 4.9.3
%define full_name gcc-%{version}
%define binutils_path /usr/local/binutils-2.25.1
Release: 0
...
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%description
%prep
%setup -q -a0 -n %{full_name}
%build
AR=%{binutils_path}/bin/ar NM=%{binutils_path}/bin/nm RANLIB=#%{binutils_path}/bin/ranlib ./configure \
--prefix=/usr/local/%{full_name} \
--disable-multilib \
--enable-languages=c,c++ \
--enable-lto \
--enable-linker-build-id \
--enable-plugin \
--with-ld=%{binutils_path}/bin/ld \
--with-plugin-ld=%{binutils_path}/bin/ld \
--with-as=%{binutils_path}/bin/as
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
/usr/local/%{full_name}
%changelog
After installing this package I try:
/usr/local/gcc-4.9.3/bin/g++ -flto -fno-fat-lto-objects -fuse-linker-plugin test.cpp -o test
And get:
cc1plus: error: -fno-fat-lto-objects are supported only with linker plugin
But, ld from /usr/local/binutils-2.25.1 has plugin support
/usr/local/binutils-2.25.1/bin/ld --help | grep plugin
-plugin PLUGIN Load named plugin
-plugin-opt ARG Send arg to last-loaded plugin
Also, gcc-{ar,nm,ranlib} from /usr/local/gcc-4.9.3 have --plugin support
/usr/local/gcc-4.9.3/bin/gcc-ar --help | grep plugin
--plugin <p> - load the specified plugin
Need your help, guys
UPD I managed to solve the problem. Just replaced
./configure ...
with
mkdir build && cd build && ../configure ...
and also added
cd build
to %install begin
gcc-4.9.3/lto-plugin/congifure script isn't written correct !!!

DPDK KNI example

I want to work with DPDK for packet processing I can't run kni example
I tried every possible config and I get :
EAL: Error - exiting with code: 1
Cause: Invalid option specified
./build/kni -c 0x0f -n 4 -- -P -p 0x3 -config="(0,2,3),(1,4,5)"
./build/kni -c 0x0f -n 4 -- -P -p 0x3 -config="(0,4,6),(1,5,7)"
I should put a "--" before config, but in all samples it has one dash
Your command has en error:
./build/kni -c 0x0f -n 4 -- -P -p 0x3 -config="(0,4,6),(1,5,7)"
The -P option should put before -config, like this:
-c 0x0f -n 4 -- -p 0x3 -P --config="(0,4,6),(1,5,7)"
From DPDK sample application user guide:
to run the application with two ports served by six lcores, one lcore of RX, one
lcore of TX, and one lcore of kernel thread for each port:
./build/kni -c 0xf0 -n 4 -- -P -p 0x3 -config="(0,4,6,8),(1,5,7,9)"
you need to check your "config" inputs(should be 4 elements for each port).
the following command will work
./build/kni -l 4-5 -n 4 -- -p1 -P --config="(0, 4, 5)"

Unknown package libcxx and libcxxabi when building Clang?

I'm trying to build Clang with libc++ from sources. And I'm trying to drop libc++ in-tree while building it out-of-tree with the other components. The recipe I use is below.
If I simply place libcxx and libcxxabi in-tree, then configure does not pick them up, and they are not built automatically. I placed them in llvm/projects per LLVM's libc++ Standard Library.
Additionally, adding make cxx to the recipe does not work as advertised on the LLVM's libc++ Standard Library page. It results in:
llvm[0]: Constructing LLVMBuild project information.
make: *** No rule to make target `cxx'. Stop.
When I configure LLVM/Clang with --with-libcxx and --with-libcxxabi:
# Issued from a scratch 'build' directory, which is next to the 'llvm' directory.
../llvm/configure --enable-optimized --enable-cxx11 --with-libcxx --with-libcxxabi \
$OTHER_OPTIONS --prefix=/usr/local
then I receive the following:
configure: WARNING: Unknown project (libcxx) won't be configured automatically
configure: WARNING: Unknown project (libcxxabi) won't be configured automatically
libcxx and libcxxabi are literally what LLVM calls them, so I'm not sure what names to use if they are not correct.
I tried to examine configure for what the package names should be, but its not very helpful. See below for the logic.
How do I configure and build Clang with libc++ (when libc++ and libc++ ABI are in-tree)?
Configure logic for --with-XXX is shown below.
this is all I can find (its not very helpful):
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
eval with_$ac_package=\$ac_optarg ;;
Related links:
LLVM/Clang download page
LLVM's libc++ Standard Library page
And this Stack Overflow question is related: When is libc++ sources needed when building Clang from sources?
And this discussion of CFE-Dev mailing list: Questions about libc++ for linux and its git repository (if any). The thread says unpacking libcxx into llcm/projects ensures the headers are copied where Clang expects them during make install. But it does not address the --with-XXX question, it does not discuss why libc++ was not built, and it does not discuss how to get make install to actually install the libraries.
Recipe to fetch and build Clang. It works fine when not including libcxx and libcxxabi.
#! /bin/sh
# Clang 3.5 recipe.
# The script should be run from a scratch directory.
# Fetch
if [ ! -e llvm-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz
fi
if [ ! -e cfe-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz
fi
if [ ! -e compiler-rt-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz
fi
if [ ! -e libcxx-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/libcxx-3.5.0.src.tar.xz
fi
if [ ! -e libcxxabi-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/libcxxabi-3.5.0.src.tar.xz
fi
if [ ! -e clang-tools-extra-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/clang-tools-extra-3.5.0.src.tar.xz
fi
# Cleanup
echo "Cleaning up artifacts"
rm -rf llvm build llvm-3.5.0.src
# LLVM
echo "Unpacking LLVM"
tar xf llvm-3.5.0.src.tar.xz
mv llvm-3.5.0.src/ llvm
# Clang Front End
echo "Unpacking Clang Front End"
cd llvm/tools
tar xf ../../cfe-3.5.0.src.tar.xz
mv cfe-3.5.0.src clang
cd ../../
# Compiler RT
echo "Unpacking Compiler RT"
cd llvm/projects
tar xf ../../compiler-rt-3.5.0.src.tar.xz
mv compiler-rt-3.5.0.src/ compiler-rt
cd ../../
# Extra Tools
echo "Unpacking Extra Tools"
cd llvm/tools/clang/tools/
tar xf ../../../../clang-tools-extra-3.5.0.src.tar.xz
mv clang-tools-extra-3.5.0.src extra
cd ../../../../
# libc++
echo "Unpacking libc++"
cd llvm/projects
tar xf ../../libcxx-3.5.0.src.tar.xz
mv libcxx-3.5.0.src/ libcxx
cd ../../
# libc++ ABI
echo "Unpacking libc++ ABI"
cd llvm/projects
tar xf ../../libcxxabi-3.5.0.src.tar.xz
mv libcxxabi-3.5.0.src/ libcxxabi
cd ../../
# Determine if Apple
IS_DARWIN=`uname -s | egrep -i -c "Darwin"`
if [ $IS_DARWIN -ne 0 ]; then
OTHER_OPTIONS=" --enable-libcpp"
fi
# Configure
echo "Configuring build"
mkdir -p build
cd build
../llvm/configure --enable-optimized --enable-cxx11 --with-libcxx --with-libcxxabi $OTHER_OPTIONS --prefix=/usr/local
# Build
# 'make cxx' for libc++ is from http://libcxx.llvm.org/
echo "Running make"
make cxx
make -j2
RET=$?
if [ $RET -eq 0 ];then
echo "****************************************"
read -p "Press [ENTER] to install, or [CTRL]+C to quit"
sudo make install
fi
# ****************************************
# ****************************************
# Install does not install scan-build and scan-view
# Perform the copy, and/or put them on-path
#sudo cp llvm/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py /usr/local/bin
#sudo 2to3 -w /usr/local/bin/asan_symbolize.py
#sudo mkdir /usr/local/bin/scan-build
#sudo cp -r llvm/tools/clang/tools/scan-build /usr/local/bin
#sudo mkdir /usr/local/bin/scan-view
#sudo cp -r llvm/tools/clang/tools/scan-view /usr/local/bin
This is script which I used to build libcxxabi and libcxx. It use previously built Clang (with GCC (4.8.3 in my case) and GCC STL):
if ( $#argv != 2 ) then
echo "Usage: [32|64] <directory>"
exit
endif
set echo on
set CMake=<CMake executable>
set GCCDir=<recent GCC directory>
set LLVMSourceDir=${PWD}/llvm-${LLVM_VERSION}.src
set LLVMOutOfTreeSourceDir=${PWD}
set LLVMPass1Dir=${PWD}/pass1
set PythonDir=<Python directory>
set InstallDir=${PWD}/$argv[2]
if ( $argv[1] == 32 ) then
set GCC_EHDir=${GCCDir}/lib/gcc/x86_64-redhat-linux/4.8.3/32
set BuildMode="-m32"
set LibDirSuffix=""
else
set GCC_EHDir=${GCCDir}/lib/gcc/x86_64-redhat-linux/4.8.3
set BuildMode="-m64"
set LibDirSuffix="64"
endif
set BuildDir=libcxxabi.build
if ( -d ${BuildDir} ) then
rm -rf ${BuildDir}
endif
mkdir ${BuildDir}
cd ${BuildDir}
${CMake} \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX:PATH=${InstallDir} \
-DCMAKE_C_COMPILER=${LLVMPass1Dir}/bin/clang \
-DCMAKE_C_FLAGS=${BuildMode} \
-DCMAKE_CXX_COMPILER=${LLVMPass1Dir}/bin/clang++ \
-DCMAKE_CXX_FLAGS=${BuildMode} \
-DCMAKE_SHARED_LINKER_FLAGS="-L ${GCC_EHDir}" \
-DCMAKE_STATIC_LINKER_FLAGS="${GCC_EHDir}/libgcc_eh.a" \
-DLLVM_FORCE_USE_OLD_TOOLCHAIN=YES \
-DLLVM_PATH=${LLVMSourceDir} \
-DLIBCXXABI_LIBCXX_INCLUDES=${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src/include \
-DLIBCXXABI_LIBCXX_PATH=${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src \
-DLIBCXXABI_LIBDIR_SUFFIX=${LibDirSuffix} \
${LLVMOutOfTreeSourceDir}/libcxxabi-${LLVM_VERSION}.src
make
make install
cd ..
set BuildDir=libcxx.build
if ( -d ${BuildDir} ) then
rm -rf ${BuildDir}
endif
mkdir ${BuildDir}
cd ${BuildDir}
${CMake} \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX:PATH=${InstallDir} \
-DCMAKE_C_COMPILER=${LLVMPass1Dir}/bin/clang \
-DCMAKE_C_FLAGS=${BuildMode} \
-DCMAKE_CXX_COMPILER=${LLVMPass1Dir}/bin/clang++ \
-DCMAKE_CXX_FLAGS=${BuildMode} \
-DCMAKE_SHARED_LINKER_FLAGS="-L ${GCCDir}/lib${LibDirSuffix}" \
-DLLVM_PATH=${LLVMSourceDir} \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${LLVMOutOfTreeSourceDir}/libcxxabi-${LLVM_VERSION}.src/include \
-DLIBCXX_CXX_ABI_LIBRARY_PATH=${InstallDir}/lib \
-DLIBCXX_LIBDIR_SUFFIX=${LibDirSuffix} \
-DLIT_EXECUTABLE=${LLVMSourceDir}/utils/lit/lit.py \
${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src
make
make install
cd ..
libc++ and libc++abi aren't maintained to work with configure. I think libc++ might work if you invoke it correctly, but there isn't even a configure script for libc++abi.
See our docs for using cmake with these projects:
# In-tree build:
# Check out libcxx and libcxxabi into llvm/projects
cd llvm
mkdir build && cd build
cmake .. # Linux may require -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
make cxx