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

Can't compile on Debian aarch64 #607

Open
Cicorione opened this issue Aug 19, 2024 · 8 comments
Open

Can't compile on Debian aarch64 #607

Cicorione opened this issue Aug 19, 2024 · 8 comments

Comments

@Cicorione
Copy link

Hi @pgundlach,

I got stuck here when I try to compile on aarch64:

SDPRO=yes rake buildlib
go install -ldflags "-X main.basedir=/home/cicorione/git/publisher -s"  speedatapublisher/sphelper/sphelper
/home/cicorione/git/publisher/bin/sphelper buildlib
arm64
Building dynamic library for linux arm64
Building dynamic lua glue library for linux arm64

exec: no command
rake aborted!
Command failed with status (255): [/home/cicorione/git/publisher/bin/sphelper bu...]
/home/cicorione/git/publisher/Rakefile:42:in `block in <top (required)>'
Tasks: TOP => buildlib
(See full trace by running task with --trace)

Here with --trace enabled:

SDPRO=yes rake buildlib --trace
** Invoke buildlib (first_time)
** Invoke sphelper (first_time)
** Execute sphelper
go install -ldflags "-X main.basedir=/home/cicorione/git/publisher -s"  speedatapublisher/sphelper/sphelper
** Execute buildlib
/home/cicorione/git/publisher/bin/sphelper buildlib
arm64
Building dynamic library for linux arm64
Building dynamic lua glue library for linux arm64

exec: no command
rake aborted!
Command failed with status (255): [/home/cicorione/git/publisher/bin/sphelper bu...]
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/file_utils.rb:67:in `block in create_shell_runner'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/file_utils.rb:57:in `sh'
/home/cicorione/git/publisher/Rakefile:42:in `block in <top (required)>'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/usr/lib/ruby/gems/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/bin/rake:25:in `load'
/usr/bin/rake:25:in `<main>'
Tasks: TOP => buildlib

Thanks… 🙏

@pgundlach
Copy link
Member

I think that ccenv has no valid entry for this case in buildlib.go. You need to set the environment variable

CC_" + goarch + "_" + goos

in your case probably CC_ arm64_linux

to a path to clang or cc.

@Cicorione
Copy link
Author

Hi Patrick, I didn't really understand what you wrote, but it looks like that arm64 is already contemplated, I found this:

		switch goarch {
		case "amd64":
			cmd = exec.Command(ccenv, "-shared", "-fPIC", "-o", filepath.Join(dylibbuild, "luaglue.so"), "luaglue.c", "-I/usr/include/lua5.3/")
		case "arm64":
			cmd = exec.Command(ccenv, "-shared", "-fPIC", "-o", filepath.Join(dylibbuild, "luaglue.so"), "luaglue.c", "-I/usr/include/lua5.3/")
		}

🤔

@pgundlach
Copy link
Member

Sorry. Set the environment variable CC_arm64_linux to some kind of c-compiler (clang or cc). For example I have

export CC_arm64_linux=/usr/bin/aarch64-linux-gnu-gcc

in my setup. Then run rake buildlib.

@Cicorione
Copy link
Author

Cicorione commented Aug 21, 2024

Thank you, it worked! 🙏

Unfortunately I found another obstacle, here my steps:

$ export CC_arm64_linux=/usr/bin/aarch64-linux-gnu-gcc
$ export CGO_CFLAGS="-I /usr/include/texlua53"
$ publisher ) SDPRO=yes rake build

go install -ldflags "-X main.basedir=/home/cicorione/git/publisher -s"  speedatapublisher/sphelper/sphelper
/home/cicorione/git/publisher/bin/sphelper build
build pro

$ SDPRO=yes rake buildlib

go install -ldflags "-X main.basedir=/home/cicorione/git/publisher -s"  speedatapublisher/sphelper/sphelper
/home/cicorione/git/publisher/bin/sphelper buildlib
arm64
Building dynamic library for linux arm64
Building dynamic lua glue library for linux arm64

then

~/git/publisher/bin/./sp --layout=idx.xml --jobname=idx04 --runs=2
Run speedata publisher 4.19.20 (Pro)
Can't find sdluatex binary

What's wrong now? 😭

@Cicorione
Copy link
Author

Hi Patrick I tried with your binary but it looks like it is for AMD64 architecture...
I had a similar issue with FreeBSD, I believe I need to create a symlink to /usr/bin/sdluatex, this is what I have installed:

locate lua53
/usr/include/texlua53
/usr/include/texlua53/lauxlib.h
/usr/include/texlua53/lua.h
/usr/include/texlua53/lua.hpp
/usr/include/texlua53/luaconf.h
/usr/include/texlua53/lualib.h
/usr/lib/aarch64-linux-gnu/libtexlua53.a
/usr/lib/aarch64-linux-gnu/libtexlua53.so
/usr/lib/aarch64-linux-gnu/libtexlua53.so.5
/usr/lib/aarch64-linux-gnu/libtexlua53.so.5.3.6
/usr/lib/aarch64-linux-gnu/pkgconfig/lua53-c++.pc
/usr/lib/aarch64-linux-gnu/pkgconfig/lua53.pc
/usr/lib/aarch64-linux-gnu/pkgconfig/texlua53.pc
/usr/share/doc/libtexlua53-5
/usr/share/doc/libtexlua53-5/changelog.Debian.gz
/usr/share/doc/libtexlua53-5/changelog.gz
/usr/share/doc/libtexlua53-5/copyright
/var/lib/dpkg/info/libtexlua53-5:arm64.list
/var/lib/dpkg/info/libtexlua53-5:arm64.md5sums
/var/lib/dpkg/info/libtexlua53-5:arm64.shlibs
/var/lib/dpkg/info/libtexlua53-5:arm64.triggers

Perhaps /usr/lib/aarch64-linux-gnu/libtexlua53.so to /usr/bin/sdluatex 🤔

@Cicorione
Copy link
Author

Cicorione commented Aug 22, 2024

I solved it:

  1. sudo ln -s /usr/bin/luatex /usr/bin/luahbtex
  2. export CC_arm64_linux=/usr/bin/aarch64-linux-gnu-gcc
  3. export CGO_CFLAGS="-I /usr/include/texlua53"
  4. rake build
  5. rake buildlib

Maybe you can change the instruction to look for sdluatex and luahbtex... 🤔

Thanks! 🙏

@pgundlach
Copy link
Member

Reopen for documentation reminder

@pgundlach pgundlach reopened this Aug 29, 2024
@Cicorione
Copy link
Author

I updated the instructions here: #607 (comment)

I replaced luatex with luahbtex, thanks.

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

No branches or pull requests

2 participants