Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dpdk: Add header files for MUSL run-time #9

Closed
wants to merge 1 commit into from

Conversation

pprindeville
Copy link
Contributor

Should be fixed upstream but for now, allow progress building with MUSL

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
@pprindeville
Copy link
Contributor Author

cc: @zokl

@zokl
Copy link
Contributor

zokl commented May 21, 2023

Should be fixed upstream but for now, allow progress building with MUSL

Thank you a will try it.

@zokl
Copy link
Contributor

zokl commented May 21, 2023

During the compilation, another place where it is needed include the unistd.h

cc-12.3.0_musl/lib/libc.so: warning: The fgetln() function cannot be safely ported, use getline(3) instead, as it is supported by GNU and POSIX.1-2008.
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o: in function `pci_vfio_set_bus_master':
pci_vfio.c:(.text+0x27): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: pci_vfio.c:(.text+0x73): undefined reference to `pwrite64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o: in function `pci_vfio_map_resource_primary':
pci_vfio.c:(.text+0x74f): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: pci_vfio.c:(.text+0x78c): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: pci_vfio.c:(.text+0x7c3): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: pci_vfio.c:(.text+0x810): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: pci_vfio.c:(.text+0x841): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o:pci_vfio.c:(.text+0x9cc): more undefined references to `pread64' follow
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o: in function `pci_vfio_map_resource_primary':
pci_vfio.c:(.text+0xcde): undefined reference to `pwrite64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o: in function `pci_vfio_read_config':
pci_vfio.c:(.text+0x13d3): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o: in function `pci_vfio_write_config':
pci_vfio.c:(.text+0x1413): undefined reference to `pwrite64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o: in function `pci_vfio_ioport_read':
pci_vfio.c:(.text+0x14c5): undefined reference to `pread64'
/home/votavon1/eshaper/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: drivers/libtmp_rte_bus_pci.a.p/bus_pci_linux_pci_vfio.c.o: in function `pci_vfio_ioport_write':
pci_vfio.c:(.text+0x1539): undefined reference to `pwrite64'
collect2: error: ld returned 1 exit status

@pprindeville
Copy link
Contributor Author

What’s the other place? They all seem to be in the same source file.

@zokl
Copy link
Contributor

zokl commented May 22, 2023

What’s the other place? They all seem to be in the same source file.

I apologize for my inaccuracy, yes it is the same pc_vfioi.c file but different functions.

@zokl
Copy link
Contributor

zokl commented May 22, 2023

What’s the other place? They all seem to be in the same source file.

I apologize for my inaccuracy, yes it is the same pc_vfioi.c file but different functions.

The problem is in _LARGEFILE64_SOURCE switch. It is disabled by default. If I enable it, the compilation successfully finishes.

TARGET_CFLAGS+=-D_LARGEFILE64_SOURCE in DPDK Makefile solve this problem.

@zokl
Copy link
Contributor

zokl commented May 22, 2023

Finaly, compilation flag TARGET_CFLAGS+=-D_GNU_SOURCE is the right way how to compile with MUSL.

@zokl zokl closed this May 22, 2023
@pprindeville
Copy link
Contributor Author

Do you have an example of the errors logs related to _LARGEFILE64_SOURCE?

@pprindeville
Copy link
Contributor Author

Finaly, compilation flag TARGET_CFLAGS+=-D_GNU_SOURCE is the right way how to compile with MUSL.

Using -D_LARGEFILE64_SOURCE didn't work? That's more POSIX standard and doesn't depend on GNU-isms in the headers...

@zokl
Copy link
Contributor

zokl commented May 23, 2023

Do you have an example of the errors logs related to _LARGEFILE64_SOURCE?

Finaly, compilation flag TARGET_CFLAGS+=-D_GNU_SOURCE is the right way how to compile with MUSL.

Using -D_LARGEFILE64_SOURCE didn't work? That's more POSIX standard and doesn't depend on GNU-isms in the headers...

Yes. It works with this flag. May I change it instead of GNU…?

@pprindeville
Copy link
Contributor Author

Using -D_LARGEFILE64_SOURCE didn't work? That's more POSIX standard and doesn't depend on GNU-isms in the headers...

Yes. It works with this flag. May I change it instead of GNU…?

I'd rather we stick with something portable.

@zokl
Copy link
Contributor

zokl commented May 23, 2023

Using -D_LARGEFILE64_SOURCE didn't work? That's more POSIX standard and doesn't depend on GNU-isms in the headers...

Yes. It works with this flag. May I change it instead of GNU…?

I'd rather we stick with something portable.

OK, I'll take advice from more experienced :-)

ifneq ($(CONFIG_USE_MUSL),)
TARGET_CFLAGS += -D_LARGEFILE64_SOURCE
endif

@pprindeville
Copy link
Contributor Author

OK, I'll take advice from more experienced :-)

ifneq ($(CONFIG_USE_MUSL),)
TARGET_CFLAGS += -D_LARGEFILE64_SOURCE
endif

I think it’s safe to set it unconditionally.

@pprindeville
Copy link
Contributor Author

Or use CONFIG_64BIT

@zokl
Copy link
Contributor

zokl commented May 24, 2023

OK, I'll take advice from more experienced :-)

ifneq ($(CONFIG_USE_MUSL),)
TARGET_CFLAGS += -D_LARGEFILE64_SOURCE
endif

I think it’s safe to set it unconditionally.

Other packages in the repository use this condition to enable this feature. I am not sure what it does with glibc. The compilation has finished, but I need to test it... https://github.com/search?q=repo%3Aopenwrt%2Fpackages%20D_LARGEFILE64_SOURCE&type=code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants