./configure don't find htobe32 - linux

working on an embedded Linux i get a strange error.
conftest.c:37:10: warning: implicit declaration of function 'htobe32'
[-Wimplicit-function-declaration]
n_be = htobe32(n_uint32);<br>
/tmp/cckbgVe5.o: In function main:
conftest.c:(.text+0x18): undefined reference to `htobe32'
collect2: error: ld returned 1 exit status
I guess anything is proper installed, because i can find the endian-Headers. Although, i don't know which Library is actually needed.
/usr/share/man/man3/endian.3.gz
/usr/include/bits/endian.h
/usr/include/linux/byteorder/little_endian.h
/usr/include/linux/byteorder/big_endian.h
/usr/include/endian.h
This is my path:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bi/vendor_perl:/usr/bin/core_perl
Is a lib missing?

Related

When install riscv-linux environment, tar exit with failure and make ARCH=riscv error

During these days, I have tried to install riscv environment in Ubuntu System. According to the page, https://github.com/riscv/riscv-tools, I installed the toolchain successfully.
Then I tried to build the Linux Kernel, using this way:
$ cd $TOP
$ git clone https://github.com/riscv/riscv-linux.git linux-3.14.33
$ curl -L https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.33.tar.xz | tar -xJkf -
When I execute this line, tar exists with failure, like this:
tar: linux-3.14.33/virt/kvm/arm/vgic.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/assigned-dev.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/async_pf.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/async_pf.h: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/coalesced_mmio.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/coalesced_mmio.h: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/eventfd.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/ioapic.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/ioapic.h: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/iodev.h: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/iommu.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/irq_comm.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/irqchip.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/kvm_main.c: Cannot open: File exists
tar: linux-3.14.33/virt/kvm/vfio.c: Cannot open: File exists
tar: Exiting with failure status due to previous errors
I ignored this failure, and executed this:
$ cd linux-3.14.33
$ make ARCH=riscv defconfig
$ make ARCH=riscv menuconfig
$ make -j8 ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-
Then, some errors appeared:
crypto/kpp.c: In function 'crypto_kpp_report':
crypto/kpp.c:31:27: error: storage size of 'rkpp' isn't known
struct crypto_report_kpp rkpp;
^~~~
crypto/kpp.c:35:19: error: 'CRYPTOCFGA_REPORT_KPP' undeclared (first use in this function); did you mean 'CRYPTOCFGA_REPORT_RNG'?
if (nla_put(skb, CRYPTOCFGA_REPORT_KPP,
^~~~~~~~~~~~~~~~~~~~~
CRYPTOCFGA_REPORT_RNG
crypto/kpp.c:35:19: note: each undeclared identifier is reported only once for each function it appears in
crypto/kpp.c:36:14: error: invalid application of 'sizeof' to incomplete type 'struct crypto_report_kpp'
sizeof(struct crypto_report_kpp), &rkpp))
^~~~~~
crypto/kpp.c:31:27: warning: unused variable 'rkpp' [-Wunused-variable]
struct crypto_report_kpp rkpp;
^~~~
crypto/akcipher.c: In function 'crypto_akcipher_report':
crypto/akcipher.c:31:32: error: storage size of 'rakcipher' isn't known
struct crypto_report_akcipher rakcipher;
^~~~~~~~~
crypto/akcipher.c:35:19: error: 'CRYPTOCFGA_REPORT_AKCIPHER' undeclared (first use in this function); did you mean 'CRYPTOCFGA_REPORT_CIPHER'?
if (nla_put(skb, CRYPTOCFGA_REPORT_AKCIPHER,
^~~~~~~~~~~~~~~~~~~~~~~~~~
CRYPTOCFGA_REPORT_CIPHER
crypto/akcipher.c:35:19: note: each undeclared identifier is reported only once for each function it appears in
crypto/akcipher.c:36:14: error: invalid application of 'sizeof' to incomplete type 'struct crypto_report_akcipher'
sizeof(struct crypto_report_akcipher), &rakcipher))
^~~~~~
crypto/akcipher.c:31:32: warning: unused variable 'rakcipher' [-Wunused-variable]
struct crypto_report_akcipher rakcipher;
^~~~~~~~~
scripts/Makefile.build:302: recipe for target 'crypto/kpp.o' failed
make[1]: *** [crypto/kpp.o] Error 1
make[1]: *** Waiting for unfinished jobs....
scripts/Makefile.build:302: recipe for target 'crypto/akcipher.o' failed
make[1]: *** [crypto/akcipher.o] Error 1
crypto/acompress.c: In function 'crypto_acomp_report':
crypto/acompress.c:34:29: error: storage size of 'racomp' isn't known
struct crypto_report_acomp racomp;
^~~~~~
crypto/acompress.c:38:19: error: 'CRYPTOCFGA_REPORT_ACOMP' undeclared (first use in this function); did you mean 'CRYPTOCFGA_REPORT_AEAD'?
if (nla_put(skb, CRYPTOCFGA_REPORT_ACOMP,
^~~~~~~~~~~~~~~~~~~~~~~
CRYPTOCFGA_REPORT_AEAD
crypto/acompress.c:38:19: note: each undeclared identifier is reported only once for each function it appears in
crypto/acompress.c:39:14: error: invalid application of 'sizeof' to incomplete type 'struct crypto_report_acomp'
sizeof(struct crypto_report_acomp), &racomp))
^~~~~~
crypto/acompress.c:34:29: warning: unused variable 'racomp' [-Wunused-variable]
struct crypto_report_acomp racomp;
^~~~~~
scripts/Makefile.build:302: recipe for target 'crypto/acompress.o' failed
Thanks for your attention, and looking forward to your reply.
As we known, the repository of rocket-chip employs a specific version of riscv-tools, which is another repository. And in the homepage for the specific version of riscv-tools, there will be the version of the Linux kernel needed.
Actually, the tool-chain is tightly related to the hardware implementation. Therefore, we must use the only version specified in rocket-chip.
Use git to update the riscv-tools in rocket-chip.
git submodule update --init --recursive

How can i make the busybox1.23.2 Compile success?

package: busybox
version: 1.23.2
when i make busybox , it produces unexpected results.
the crosschaintool i use is ARM/uClinux Toolchain arm-2010q1-189-arm- uclinuxeabi-i686-pc-linux-gnu,but i can't make the busybox,like this:
root#ubuntu:/busybox/busybox-1.23.2# make
SPLIT include/autoconf.h -> include/config/*
GEN include/bbconfigopts.h
HOSTCC applets/usage
applets/usage.c: In function ‘main’:
applets/usage.c:52:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
^
GEN include/usage_compressed.h
HOSTCC applets/applet_tables
applets/applet_tables.c: In function ‘main’:
applets/applet_tables.c:161:4: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(line_old, sizeof(line_old), fp);
^
GEN include/applet_tables.h
CC applets/applets.o
LD applets/built-in.o
HOSTCC applets/usage_pod
applets/usage_pod.c: In function ‘main’:
applets/usage_pod.c:74:3: warning: format not a string literal and no format arguments [-Wformat-security]
printf(usage_array[i].aname);
^
CC libbb/appletlib.o
CC libbb/vfork_daemon_rexec.o
AR libbb/lib.a
CC shell/hush.o
shell/hush.c: In function 'builtin_source':
shell/hush.c:8901: warning: 'sv.sv_g_malloced' may be used uninitialized in this function
shell/hush.c:8901: warning: 'sv.sv_g_argc' may be used uninitialized in this function
shell/hush.c:8901: warning: 'sv.sv_g_argv' may be used uninitialized in this function
shell/hush.c:8901: warning: 'sv.sv_argv0' may be used uninitialized in this function
AR shell/lib.a
LINK busybox_unstripped
Trying libraries: crypt m
Library crypt is not needed, excluding it
Library m is not needed, excluding it
Final link with: <none>
arm-uclinuxeabi-strip:busybox_unstripped: File format not recognized
Makefile:723: recipe for target 'busybox' failed
make: *** [busybox] Error 1
how should i do? is the busybox can't use the ARM/uClinux Toolchain? how should i do ?we'll really appreciate it if you can give us some advice and some pieces of guidance,thanks!
LINK busybox_unstripped Trying libraries: crypt m Library crypt
is not needed, excluding it Library m is not needed, excluding it
Final link with: arm-uclinuxeabi-strip:busybox_unstripped: File
format not recognized Makefile:723: recipe for target 'busybox' failed
make: *** [busybox] Error 1
As there is only a piece of the whole compiling log, some suggestions are:
1) Please check the compiling log from the beginning whether there are other important warnings or errors.
2) busybox_unstripped file is generated or not? Check the makefile dependencies to find out whether all dependencies files are successfully generated. From the log, some libraries are excluded so that you may have to check the busybox configuration file.
3) If busybox_unstripped file is generated, check the makefile about the link grammar of "Final link with:". For the cross-tool chain to link successfully, please make sure the link command is correct.
Good luck!

reference console_loglevel ERROR in kernel module

I have a Linux module, which has a debug function and I just want to call that function in debug mode.
Now I have code like this:
if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG)
dump_my_message(dev, my_msg);
But when build this code in linux-next, it will throw below error:
CHK include/generated/uapi/linux/version.h
Kernel: arch/x86/boot/bzImage is ready (#2)
Building modules, stage 2.
MODPOST 2738 modules
ERROR: "console_printk" [drivers/mymodule.ko] undefined!
scripts/Makefile.modpost:91: recipe for target '__modpost' failed
make[1]: *** [__modpost] Error 1
Makefile:1117: recipe for target 'modules' failed
make: *** [modules] Error 2
Can you help to find out how to make this work? thanks!!!
The compilation error is caused by the fact that console_printk symbol is not exported so it cannot be used by modules.
What you really should use, however, is Dynamic debug functionality and its pr_debug()/dev_dbg() functions.
Basically what you need is to ensure that CONFIG_DYNAMIC_DEBUG is enabled in your kernel, use dev_dbg() in all places where you want to write some debugging code and then dynamically enable your debug messages, for example:
To enable all the messages in your module, add dyndbg=+p at the end of your insmod/modprobe call.
To selectively enable only some of the messages, use query language described in the documentation. For example, to only enable messages from functions foo() and bar() in your module, use:
insmod mymodule.ko dyndbg="func foo +p; func bar +p"

BusyBox: Error during make

I try to install BusyBox 1.20.2 on a embedded system with PowerPc. At first I want to try it with the default config.
So this are the commands
make defconfig
make
And this is the result:
ma-bash-3.2# make
CC miscutils/ubi_tools.o
miscutils/ubi_tools.c: In function 'ubi_tools_main':
miscutils/ubi_tools.c:137: error: 'UBI_DEV_NUM_AUTO' undeclared (first use in this function)
miscutils/ubi_tools.c:137: error: (Each undeclared identifier is reported only once
miscutils/ubi_tools.c:137: error: for each function it appears in.)
miscutils/ubi_tools.c:157: error: storage size of 'req' isn't known
miscutils/ubi_tools.c:165: error: 'UBI_IOCATT' undeclared (first use in this function)
miscutils/ubi_tools.c:157: warning: unused variable 'req'
miscutils/ubi_tools.c:171: error: 'UBI_IOCDET' undeclared (first use in this function)
make[1]: *** [miscutils/ubi_tools.o] Error 1
make: *** [miscutils] Error 2
How is it possible to solve that Error?
Can I disable this ubi_tool ? What effects will that have and how to do that?
Remove these lines in .config:
CONFIG_UBIATTACH=y
CONFIG_UBIDETACH=y
CONFIG_UBIMKVOL=y
CONFIG_UBIRMVOL=y
CONFIG_UBIRSVOL=y
CONFIG_UBIUPDATEVOL=y
you won't have support for ubifs.

compile vmci program

I'm trying to compile the vmware vmci example program. The program is divided into two parts
a) kernel module
b) example datagram program
When i compiled that datagram program i get these errors :
gcc -I headers_path datagramApp.c
/tmp/cc6KkQ4a.o: In function `main':
datagramApp.c:(.text+0x16c): undefined reference to `VMCI_InitApp'
datagramApp.c:(.text+0x1be): undefined reference to `VMCI_CleanupApp'
/tmp/cc6KkQ4a.o: In function `DoDatagramServer':
datagramApp.c:(.text+0x1e6): undefined reference to `VMCIDatagram_CreateHnd'
datagramApp.c:(.text+0x24f): undefined reference to `VMCIDs_Lookup'
datagramApp.c:(.text+0x2d7): undefined reference to `VMCIResource_AddClientPrivileges'
datagramApp.c:(.text+0x333): undefined reference to `VMCIDs_Register'
datagramApp.c:(.text+0x3bf): undefined reference to `VMCIDatagram_RecvFrom'
datagramApp.c:(.text+0x44f): undefined reference to `VMCIDatagram_SendTo'
datagramApp.c:(.text+0x4a8): undefined reference to `VMCIDs_Unregister'
datagramApp.c:(.text+0x4c0): undefined reference to `VMCIDatagram_DestroyHnd'
/tmp/cc6KkQ4a.o: In function `DoDatagramClient':
datagramApp.c:(.text+0x505): undefined reference to `VMCIDs_Lookup'
datagramApp.c:(.text+0x563): undefined reference to `VMCIDatagram_CreateHnd'
datagramApp.c:(.text+0x608): undefined reference to `VMCIResource_AddClientPrivileges'
datagramApp.c:(.text+0x680): undefined reference to `VMCIDatagram_SendTo'
datagramApp.c:(.text+0x6b8): undefined reference to `VMCIDatagram_RecvFrom'
datagramApp.c:(.text+0x6f7): undefined reference to `VMCIDatagram_DestroyHnd'
TNX
You need to link with a (shared) object to get the userland interface of VMCI
AFAICT this is a propriatary API from Vmware(?) that you should install [1]
The typical compile line would then look more like:
gcc -I <headers_path> datagramApp.c -lvmci
Notes
replace header_path with something like (depending on where the module was built)
/usr/src/linux/include
/opt/vmware/include
-lvmci would suggest the availability of a libvmci.so in your library path (remember to sudo ldconfig -a, optionally include -L/path/to/libs in order to make gcc/ld find)them
[1] perhaps as part of the Custom Installation of VMware Tools?

Resources