-
Notifications
You must be signed in to change notification settings - Fork 177
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
Fix cross build #1174
base: master
Are you sure you want to change the base?
Fix cross build #1174
Conversation
dffdae4
to
d232fa6
Compare
Argh, no, |
If you need particular configure-detected variable substitutions in include/krb5-types.h, which is all that config.h has, why can't you do it with AC_SUBST? |
roken.h appears to have the same issue, and it is a public header file. It is generated by roken-h-process.pl but that script appears to be somewhat broken in a way I haven't diagnosed yet:
For some reason even though HAVE_SSIZE_T is defined in config.h, roken-h-process.pl doesn't figure it out. Passing a file with the output of That said, I suspect it will be better to define autoconf substitutions to generate both krb5-types.h and roken.h uniformly with a simple templating mechanism, and ditch the Perl script that tries to heuristically compute a partial evaluation of the cpp directives in roken.h.in. |
if !CROSS_COMPILE | ||
$(ASN1_COMPILE_DEP): asn1_compile | ||
endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confused, what does this do? Was this supposed to be a variable assignment, ASN1_COMPILE_DEP = asn1_compile
?
(Might want asn1_compile$(BUILD_EXEEXT)
too, with BUILD_EXEEXT = @BUILD_EXEEXT@
substituted by configure through AX_PROG_CC_FOR_BUILD in case building on Windows is ever relevant here. Not important to me but it might bite you later if it is important to you.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is because ASN1_COMPILE_DEP
expands to a relative path with ..
s in it and make
doesn't seem to understand that it's a path to ./asn1_compile
. This was a hack I did to make it work. Because we use a recursive makefile setup, we could just only set ASN1_COMPILE_DEP = asn1_compile
and use that only in lib/asn1/Makefile.am
, and in lib/hdb/Makefile.am
not use it at all.
IOW, this hack convinces make that it's built the thing (asn1_compile
) that targets depend on via a relative path.
I'd need to have every macro that uses |
Trying it out, no |
d232fa6
to
68fc6f1
Compare
Ah, I think I got it: build |
This is a bit inefficient -- it'd be better to not build We should also have a GitHub Action workflow that tests cross-compilation. |
Examination of roken.h, and of the output of roken-h-process.pl, shows that it has treated essentially all the macros as undefined, despite things like |
That's on NetBSD? Yeah, I've not tackled |
Do you know of a way to run NetBSD builds in GitHub Actions? |
I don't think GHA supports NetBSD, but you can easily do a NetBSD cross-build on your own system as long as it's reasonably POSIXish (*BSD, GNU/Linux, macOS, possibly even Cygwin or similar):
Then obj/destdir.evbarm is a sysroot, and tools/bin/ has the cross-compiler toolchain (aarch64--netbsd-gcc and stuff). |
Apparently there is this, according to random web searching: https://github.com/marketplace/actions/netbsd-vm (No idea who set it up or whether it works.) |
Since the only things I've ever cross-built are for MingW, I'm trying that. One of the first things I ran into is the need to modify |
Well, this is fun:
I need to include There has to be a better way to do this... EDIT: At least I can see that EDIT: Still, I might be able to commit an EDIT: Not using |
Some versions of autoconf-archive have a broken AX_PROG_CC_FOR_BUILD.
In order to use `./configure --host=... --with-tools=DIR ...` one needs a directory in which to find: `slc`, `compile_et`, and `asn1_compile`. `slc` already gets installed into `${libexecdir}/`, and `asn1_compile` gets installed into `${bindir}/`, but `compile_et` does not and should not get installed because it would conflict with the system's com_err. So let's install a `heim_compile_et` into `${bindir}`.
🥳
Oh my. Well, and OpenSSL has its own ASN.1 stack (but no compiler, just error-prone hand-coded translations of ASN.1 modules to C using a bunch of macros). IMO Heimdal's is the nicest ASN.1->C compiler out there. |
A mingw build will need some code in BTW @riastradh thanks for the clues on how to make cross-compilation work again! |
Some quirks currently prevent an installed Heimdal from working with --with-cross-tools:
Side note: |
I would like others to discover and use
It can't be called
As for the other two, There is a separate problem with
If you build with dynamic linking you can use
Add As you might have noticed, Heimdal is not just about Kerberos. It has: an ASN.1 compiler and library, an x.509 library and command-line tool, a The If there is a way to describe this generically for a bunch of packaging systems, I'd love to see it and include an instance in-tree. |
Add lib/roken/getline.c based on the in-tree libedit, with slight alterations: - grow buffer by 1.5x (+ 16 bytes) when needed, not 4KB - don't use SSIZE_MAX as the max line size; use 32KB instead
483681f
to
c5933ad
Compare
There is at least one suspect commit here, c5933ad Currently I'm able to build up to |
We don't use RW locks in Heimdal, and we should never use RW locks in Heimdal because RW locks are terrible. Instead we should import a user-land RCU library if ever we need RW locks. TODO: Just remove all RW locks functions/macros in include/heim_threads.h.
I'm getting past |
Ah right, the |
c5933ad
to
808ecbe
Compare
Current state of the branch at 808ecbe fails in a native build for me with this error:
Looks like you defined |
Looks like you defined `simple_exec_c` but referenced `simple_exec`.
Yup, that's fixed in my unpushed changes. I also need to fix the Windows build. That means I need to separate all my mingw changes. I probably won't get to it today.
|
Let's see if this builds on Windows, and then let's see if we can do a cross-build w/ MingW at least part of the way through. To do a cross-build one has to first build native, then
make install
, then manually installslc
,compile_et
, andasn1_compile
(yes, I mean to fix that so they get installed) into a bindir that will be referenced in./configure --host=... --with-cross-tools=that-bindir ...
.What this PR does:
ASN1_COMPILE_DEP
makefile macroAX_PROG_CC_FOR_BUILD
macro (it's broken in some versions of autoconf-archive)--disable-readline
and--disable-editline
for cross-compilation for Windows using MingW$(CC_FOR_BUILD)
to buildinclude/bits
and use it to buildkrb5-types.h
when cross-compilingAC_TYPE_PID_T
andAC_TYPE_UID_T
-- just check for those types and letinclude/bits
deal with their absenseAX_COMPILE_CHECK_SIZEOF
instead ofAC_CHECK_SIZEOF
(the former does not run the code it generates and compiles)AX_COMPILE_CHECK_SIZEOF
can be usedheim_compile_et
to get installedThis cross-compilation instructions then would be:
./configure --prefix=/tmp/h5l ...
(or similar install location)mkdir /tmp/cross-tools
cp -p /tmp/h5l/bin/asn1_compile /tmp/h5l/bin/heim_compile_et /tmp/h5l/libexec/slc /tmp/cross-tools/
cp -p /tmp/h5l/bin/heim_compile_et /tmp/cross-tools/compile_et
./configure --with-cross-tools=/tmp/cross-tools --host=... ...