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

libsepol: ibpkeys.c: compiling error on Fedora 28 armv7l #108

Closed
aIecxs opened this issue Oct 30, 2018 · 5 comments
Closed

libsepol: ibpkeys.c: compiling error on Fedora 28 armv7l #108

aIecxs opened this issue Oct 30, 2018 · 5 comments

Comments

@aIecxs
Copy link

aIecxs commented Oct 30, 2018

I am not sure if this is an code issue or just wrong build environment setup, but i get the same error in Ubuntu 18.04 and Fedora 28 running on ARM device. How to fix makefile?

cc -O2 -Werror -Wall -Wextra -Wmissing-format-attribute -Wmissing-noreturn -Wpointer-arith -Wshadow -Wstrict-prototypes -Wundef -Wunused -Wwrite-strings -I/home/fedora/obj/usr/include -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o ibpkeys.o ibpkeys.c In file included from ibpkeys.c:4: ibpkeys.c: In function 'sepol_ibpkey_query': ibpkeys.c:179:14: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=] ERR(handle, "could not query ibpkey subnet prefix: %#lx range %u - %u exists", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subnet_prefix, low, high); ~~~~~~~~~~~~~ debug.h:46:15: note: in definition of macro 'msg_write' _sepol_h, __VA_ARGS__); \ ^~~~~~~~~~~ ibpkeys.c:179:2: note: in expansion of macro 'ERR' ERR(handle, "could not query ibpkey subnet prefix: %#lx range %u - %u exists", ^~~ ibpkeys.c: In function 'sepol_ibpkey_modify': ibpkeys.c:206:14: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=] ERR(handle, "could not load ibpkey subnet prefix: %#lx range %u - %u exists", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subnet_prefix, low, high); ~~~~~~~~~~~~~ debug.h:46:15: note: in definition of macro 'msg_write' _sepol_h, __VA_ARGS__); \ ^~~~~~~~~~~ ibpkeys.c:206:2: note: in expansion of macro 'ERR' ERR(handle, "could not load ibpkey subnet prefix: %#lx range %u - %u exists", ^~~ cc1: all warnings being treated as errors make[2]: *** [Makefile:76: ibpkeys.o] Error 1 make[2]: Leaving directory '/home/fedora/src/selinux/libsepol/src' make[1]: *** [Makefile:6: all] Error 2 make[1]: Leaving directory '/home/fedora/src/selinux/libsepol' make: *** [Makefile:34: all] Error 1 [fedora@localhost selinux]$

@aIecxs aIecxs changed the title libsepol: compiling error on Fedora 28 armv7l libsepol: ibpkeys.c: compiling error on Fedora 28 armv7l Oct 30, 2018
stephensmalley added a commit to stephensmalley/selinux that referenced this issue Nov 5, 2018
…refix

Use PRIx64 to print the subnet_prefix (which is a uint64_t) instead
of lx.

Fixes SELinuxProject#108

Signed-off-by: Stephen Smalley <[email protected]>
@stephensmalley
Copy link
Member

See if the referenced PR fixes this for you.

@aIecxs
Copy link
Author

aIecxs commented Nov 5, 2018

confirmed. it is compiling successful now, except for a simple warning. many thanks!
../cil/src/cil_lexer.c: In function ‘cil_yy_scan_bytes’: ../cil/src/cil_lexer.c:1595:17: warning: comparison of integer expressions of different signedness: ‘yy_size_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] for ( i = 0; i < _yybytes_len; ++i ) ^

fishilico pushed a commit to fishilico/selinux that referenced this issue Nov 5, 2018
…refix

Use PRIx64 to print the subnet_prefix (which is a uint64_t) instead
of lx.

Fixes SELinuxProject#108

Signed-off-by: Stephen Smalley <[email protected]>
@aIecxs
Copy link
Author

aIecxs commented Nov 5, 2018

now i have some other issues, maybe you can also fix?

libselinux: selinux_restorecon.c: compiling error on Fedora 28 armv7l
selinux_restorecon.c: In function ‘restorecon_sb’: selinux_restorecon.c:633:26: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=] fprintf(stdout, "\r%luk", fc_count / STAR_COUNT); ~~^ %llu

checkpolicy: checkpolicy.c: compiling error on Fedora 28 armv7l
compiles with -Wno-error=implicit-function-declaration -Wno-error=sign-compare but error persists
checkpolicy.c: In function ‘main’: checkpolicy.c:498:20: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘long int’ [-Werror=sign-compare] if (policyvers != n) ^~ checkpolicy.c:645:12: error: implicit declaration of function ‘policydb_sort_ocontexts’; did you mean ‘policydb_user_cache’? [-Werror=implicit-function-declaration] ret = policydb_sort_ocontexts(&policydb); ^~~~~~~~~~~~~~~~~~~~~~~ policydb_user_cache checkpolicy.o: In function main':
checkpolicy.c:(.text.startup+0x5e8): undefined reference to policydb_sort_ocontexts' collect2: error: ld returned 1 exit status

policycoreutils: semodule.c: compiling error on Fedora 28 armv7l
i have checked owner/permissions, compiles with -I~/src/selinux/libsemanage/include -L~/src/selinux/libsemanage/src but error persists
semodule.c:25:10: fatal error: semanage/modules.h: No such file or directory #include <semanage/modules.h> ^~~~~~~~~~~~~~~~~~~~ compilation terminated. /usr/bin/ld: cannot find -lsemanage collect2: error: ld returned 1 exit status

@aIecxs
Copy link
Author

aIecxs commented Nov 6, 2018

can be closed. seems i have messed up something. after fresh install Fedora 28 armv7l it works. it was my fault i was using export DESTDIR='~/obj' instead of DESTDIR=~/obj - apologizing :)

just for unskilled users like me, here is what i have done: (Note: setools-devel was not available)
`sudo -H yum install automake gcc gettext-devel git glibc-static libacl-devel libffi-devel make pcre-static perl-Pod-Html wget
sudo -H yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-devel flex-static glib2-devel libcap-devel libcap-ng-devel pam-devel pcre-devel python-devel setools swig xmlto redhat-rpm-config

git clone https://github.com/SELinuxProject/selinux.git

mkdir ~/obj
export DESTDIR=~/obj
export CFLAGS="-I/usr/include -I/usr/local/include -I${DESTDIR}/usr/include"
export LDFLAGS="-L/usr/lib -L/usr/local/lib -L${DESTDIR}/lib -L${DESTDIR}/usr/lib"

make install install-pywrap`

@stephensmalley
Copy link
Member

Don't overload a single issue with multiple separate issues. The restorecon one was an actual bug, to be fixed by https://lore.kernel.org/selinux/[email protected]/raw.
The other two appear to be due to missing/incorrect DESTDIR specification. If you build with make DESTDIR=~/obj, then it should automatically set CFLAGS and LDFLAGS for you to include the DESTDIR subdirs.

@aIecxs aIecxs closed this as completed Nov 6, 2018
fishilico pushed a commit to fishilico/selinux that referenced this issue Nov 11, 2018
…refix

Use PRIx64 to print the subnet_prefix (which is a uint64_t) instead
of lx.

Fixes SELinuxProject#108

Signed-off-by: Stephen Smalley <[email protected]>
fishilico pushed a commit to fishilico/selinux that referenced this issue Nov 23, 2018
…refix

Use PRIx64 to print the subnet_prefix (which is a uint64_t) instead
of lx.

Fixes SELinuxProject#108

Signed-off-by: Stephen Smalley <[email protected]>
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 a pull request may close this issue.

2 participants