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

Crosscompile julia with aarch64 about flisp #56887

Open
billfang2024 opened this issue Dec 22, 2024 · 4 comments
Open

Crosscompile julia with aarch64 about flisp #56887

billfang2024 opened this issue Dec 22, 2024 · 4 comments
Labels
building Build system, or building Julia or its dependencies

Comments

@billfang2024
Copy link

billfang2024 commented Dec 22, 2024

On my host crosscompile julia v1.10.6,found exec file flisp format error,i think here should call host exec format, is my crosscompile env setting is not right?

####################
$(BUILDDIR)/julia_flisp.boot: $(addprefix $(SRCDIR)/,jlfrontend.scm flisp/aliases.scm flisp/profile.scm \
		julia-parser.scm julia-syntax.scm match.scm utils.scm ast.scm macroexpand.scm mk_julia_flisp_boot.scm) \
		$(FLISP_EXECUTABLE_release)
	@$(call PRINT_FLISP, $(call spawn,**$(FLISP_EXECUTABLE_release**)) \
		$(call cygpath_w,$(SRCDIR)/mk_julia_flisp_boot.scm) $(call cygpath_w,$(dir $<)) $(notdir $<) $(call cygpath_w,$@))

####################
FLISP src/julia_flisp.boot
/bin/sh: 1: ./flisp/flisp: Exec format error
make[1]: *** [Makefile:292: julia_flisp.boot] Error 126
make: *** [Makefile:62: julia_flisp.boot.inc.phony] Error 2
###################
file flisp
flisp: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, with debug_info, not stripped
file flisp.o
flisp.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), with debug_info, not strippe
file utf8.o
utf8.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), with debug_info, not stripped
####################

My host setting is :
Linux 0e1c06154882 5.10.0-153.56.0.134.oe2203sp2.x86_64 #1 SMP Wed May 29 14:04:28 CST 2024 x86_64 x86_64 x86_64 GNU/Linux
Crosscompile setting is:
SRCDIR=`pwd`
GCCDIR="${SRCDIR}/musl-cross-make/output/bin"
JULIADIR="${SRCDIR}/julia-1.10.6"
target_host=aarch64-linux-musleabi

export AR=$GCCDIR/$target_host-ar
export AS=$GCCDIR/$target_host-as
export CC=$GCCDIR/$target_host-gcc
export CXX=$GCCDIR/$target_host-g++
export FORTRAN=$GCCDIR/$target_host-gfortran
export LD=$GCCDIR/$target_host-ld
export RANLIB=$GCCDIR/$target_host-ranlib
export STRIP=$GCCDIR/$target_host-strip
export OBJDUMP=$GCCDIR/$target_host-objdump
export OBJCOPY=$GCCDIR/$target_host-objcopy
export NM=$GCCDIR/$target_host-nm

export CPPFLAGS="-I${JULIADIR}/usr/include"
export CFLAGS="-fPIC -D__MUSL__=1 -I${JULIADIR}/usr/include"
export CXXFLAGS="-fPIC -D__MUSL__=1 -I${JULIADIR}/usr/include"
export LDFLAGS="-L${JULIADIR}/usr/lib"

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${JULIADIR}/usr/lib
@ufechner7
Copy link

Is cross-compilation of Julia supported? I could not find any documentation about it.

@ViralBShah
Copy link
Member

ViralBShah commented Dec 23, 2024

Is cross-compilation of Julia supported? I could not find any documentation about it.

Not really. Cross compiling the Julia binary and shared libraries itself is not sufficient, because you also need the cross compilation to extend to the LLVM codegen for the target platform.

My understanding is that we aren't too far from cross compilation. However, with tools like qemu being so good, that may suffice for many use cases.

@vtjnash
Copy link
Member

vtjnash commented Dec 23, 2024

It is supported (mostly via qemu and cygwin), though you have to enable it with setting XC_HOST. We document it only for a few common configurations such as riscv

XC_HOST=riscv64-unknown-linux-gnu

@inkydragon inkydragon added the building Build system, or building Julia or its dependencies label Dec 23, 2024
@ViralBShah
Copy link
Member

Should we add a cross compilation label?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies
Projects
None yet
Development

No branches or pull requests

5 participants