Open kerner1000 opened 2 years ago
You have to use --configure-args
to pass in arbitrary OpenJDK build args to that script.
./makejdk-any-platform.sh --docker --clean-docker-build jdk18u --configure-args --openjdk-target=x86_64-unknown-linux
docker/dockerfile-generator.sh: line 134: ((: ---=86_64--: syntax error: operand expected (error token is "-=86_64--")
Please input a JDK between 8 & 20, or 'jdk'
Try ./makejdk-any-platform.sh --docker --clean-docker-build jdk18u --configure-args "--openjdk-target=x86_64-unknown-linux"
./makejdk-any-platform.sh --docker --clean-docker-build jdk18u --configure-args "--openjdk-target=x86_64-unknown-linux"
Starting ./makejdk-any-platform.sh to configure, build (Adoptium)OpenJDK binary
Parsing opt: --docker
Possible opt arg: --clean-docker-build
Parsing opt: --clean-docker-build
Possible opt arg: jdk18u
Working dir is ./build/
[debug] COPY_MACOSX_FREE_FONT_LIB_FOR_JDK_FLAG=false
[debug] COPY_MACOSX_FREE_FONT_LIB_FOR_JRE_FLAG=false
JDK Image folder name: jdk-bundle/jdk-*.jdk
JRE Image folder name: jre-bundle/jre-*.jre
Skipping setting boot JDK on docker host machine
docker/dockerfile-generator.sh: line 134: ((: ---=86_64--: syntax error: operand expected (error token is "-=86_64--")
Please input a JDK between 8 & 20, or 'jdk'
./makejdk-any-platform.sh --docker --clean-docker-build --configure-args "--openjdk-target=x86_64-unknown-linux" jdk18u
Thank you @karianna ! This works, the build starts, but fails later with an error:
checking whether the C compiler works... no
configure: error: in `/openjdk/build/src':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure exiting with result code 77
/openjdk/build/src/make/Init.gmk:124: *** Cannot continue. Stop.
Error: No configurations found for /openjdk/build/src.
Please run 'bash configure' to create a configuration.
OpenJDK make failed, archiving make failed logs
Archiving and compressing with gzip
Your archive was created as /openjdk/build/src/build/linux-x86_64-server-release/OpenJDK.tar.gz
Moving the artifact to location /openjdk//target//OpenJDK-makefailurelogs.tar.gz
real 0m0.002s
user 0m0.001s
sys 0m0.001s
archive done.
Failed to make the JDK, exiting
Maybe ./makejdk-any-platform.sh --docker --configure-args "--openjdk-target=x86_64-unknown-linux" jdk18u
- otherwise I'm not too sure, it works for me locally.
Note to self - we should update the README.md etc on how to use --configure-args with the ""
Maybe
./makejdk-any-platform.sh --docker --configure-args "--openjdk-target=x86_64-unknown-linux" jdk18u
- otherwise I'm not too sure, it works for me locally.
Do you also build on aarm64
?
For me it doesn't work.
No I'm on x86-64 Mac might be worth posting on our slack channel to see if someone can replicate.
Where do I find the Slack channel?
@kerner1000 - https://adoptium.net/slack to send yourself an invitation to the Adoptium Slack workspace, once in, the #build
channel is a good place to ask these questions.
I tried following this instructions https://github.com/adoptium/temurin-build/wiki/Building-OpenJDK-using-temurin-build-scripts-within-the-adopt-build-docker-container
but this builds aarch64
, I could not figure out how to build for x86_64
.
From those instructions, there are 2 different images indicated:
Pull the build docker image for your environment:
For a x64 architecture use docker image: docker pull adoptopenjdk/centos6_build_image
For a arm64 architecture use docker image: docker pull adoptopenjdk/centos7_build_image
@smlambert thanks for the hint! I tried it with the centos6 image.
I get the following error:
ERROR: Build failed for targets 'product-images test-image static-libs-image' in configuration 'linux-x86_64-server-release' (exit code 2)
Any additional logs apart from that? Perhaps in the file system of the container?
This is from the build.log
:
Compiling 71 files for COMPILE_CREATE_SYMBOLS
Gendata.gmk:52: recipe for target '/Users/alex/Workspaces/OpenJDK/temurin-build/workspace/build/src/build/linux-x86_64-server-release/buildtools/create_symbols_javadoc/_the.COMPILE_CREATE_SYMBOLS_batch' failed
gmake[3]: *** [/Users/alex/Workspaces/OpenJDK/temurin-build/workspace/build/src/build/linux-x86_64-server-release/buildtools/create_symbols_javadoc/_the.COMPILE_CREATE_SYMBOLS_batch] Error 1
make/Main.gmk:147: recipe for target 'jdk.javadoc-gendata' failed
gmake[2]: *** [jdk.javadoc-gendata] Error 1
gmake[2]: *** Waiting for unfinished jobs....
ERROR: Build failed for targets 'product-images test-image static-libs-image' in configuration 'linux-x86_64-server-release' (exit code 2)
FYI @andrew-m-leonard
@kerner1000 can you elaborate what the intention is here? Are you trying to build openjdk for Mac aarch64 on a Mac x64 ? is that even possible?
@kerner1000 can you elaborate what the intention is here?
Are you trying to build openjdk for Mac aarch64 on a Mac x64 ? is that even possible?
Im trying to build on aarch64 for Mac Intel x86_64.
@gdams you've done cross compiles before, is this possible? I didn't think Xcode on Mac aarch64 could produce byte code for x64 ?
I am following this instructions https://github.com/adoptium/temurin-build/wiki/Building-OpenJDK-using-temurin-build-scripts-within-the-adopt-build-docker-container To build inside Docker.
Those docker images are x64 Linux and aarch64 Linux respectively, not Mac
@kerner1000 just to be clear:
@kerner1000 just to be clear:
- You have a physical Mac aarch64 (M1) laptop ?
- You are trying to cross compile build OpenJDK for Mac x86_64 on this laptop ?
correct!
@kerner1000 so from doing a bit of searching, it seems Mac x64 to aarch64 is possible as implied by this https://bugs.openjdk.org/browse/JDK-8264650 but it's not clear the other way around. Based on this you might want to try this configure arg:
--openjdk-target=x64-apple-darwin
thanks @andrew-m-leonard for the hint! I tried
./makejdk-any-platform.sh --docker --configure-args "--openjdk-target=x86_64-apple-darwin" jdk18u
and get the following error:
checking for patch... /usr/bin/patch
checking for dsymutil... [not found]
configure: error: Could not find required tool for DSYMUTIL
configure exiting with result code 1
/openjdk/build/src/make/Init.gmk:124: *** Cannot continue. Stop.
Error: No configurations found for /openjdk/build/src.
Please run 'bash configure' to create a configuration.
@kerner1000 dsymutil is part of Xcode, have you setup your Xcode path?
sudo xcode-select --switch "/Applications/Xcode.app"
XCode is installed. I executed your command and tried again, same error.
Can you check if you have all the Xcode tools installed?
which dsymutil
% which dsymutil
/usr/bin/dsymutil
@kerner1000 What version of Xcode are you using?
@kerner1000 ah don't specify --docker, you aren't using that on Mac Use just:
./makejdk-any-platform.sh --configure-args "--openjdk-target=x86_64-apple-darwin" jdk18u
@andrew-m-leonard Thanks! Looks better but still:
Build performance summary:
* Build jobs: 10
* Memory limit: 32768 MB
The following warnings were produced. Repeated here for convenience:
WARNING: using cross tools not prefixed with host triplet
make: *** /Volumes: Is a directory. Stop.
OpenJDK make failed, archiving make failed logs
Archiving and compressing with gzip
@kerner1000 So i've just tried the following on my Mac M1 laptop, which works, i'm using the build-farm make file which is my prefered way:
Note, I am using Xcode 13.3.1 on Mac OS 12.4 Monterey
export VARIANT=temurin
export JAVA_TO_BUILD=jdk18u
export CONFIGURE_ARGS="--openjdk-target=x86_64-apple-darwin"
build-farm/make-adopt-build-farm.sh
@andrew-m-leonard thanks, I tried that. I get the following error:
Build performance summary:
* Build jobs: 10
* Memory limit: 32768 MB
The following warnings were produced. Repeated here for convenience:
WARNING: using cross tools not prefixed with host triplet
make: *** /Volumes: Is a directory. Stop.
OpenJDK make failed, archiving make failed logs
Archiving and compressing with gzip
For me this looks like a problem with a path provided to make
, maybe a whitespace, but I could not figure it out.
@kerner1000 is /Volumes on your PATH maybe? Can you remove /Volumes from whichever path it is in?
Thanks @andrew-m-leonard, I think it is not defined:
% printenv
__CFBundleIdentifier=com.apple.Terminal
TMPDIR=/var/folders/wh/h_c77h1x42n4b64pk8g08mvw0000gn/T/
XPC_FLAGS=0x0
TERM=xterm-256color
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.mFMCxxUYxf/Listeners
XPC_SERVICE_NAME=0
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=445
TERM_SESSION_ID=6E93F076-FDE2-4EA4-9316-D6912FE78B92
SHELL=/bin/zsh
HOME=/Users/alex
LOGNAME=alex
USER=alex
PATH=/opt/homebrew/opt/node@14/bin:/Users/alex/.gem/ruby/3.0.0/bin:/Users/alex/.rbenv/shims:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
SHLVL=1
PWD=/Users/alex/sources/temurin-build
OLDPWD=/Users/alex
HOMEBREW_NO_AUTO_UPDATE=1
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
MANPATH=/opt/homebrew/share/man::
INFOPATH=/opt/homebrew/share/info:
JAVA_8_HOME=/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home
JAVA_11_HOME=/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
JAVA_17_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
JAVA_18_HOME=/Library/Java/JavaVirtualMachines/temurin-18.jdk/Contents/Home
JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-18.jdk/Contents/Home
RBENV_SHELL=zsh
VARIANT=temurin
JAVA_TO_BUILD=jdk18u
CONFIGURE_ARGS=--openjdk-target=x86_64-apple-darwin
LC_CTYPE=UTF-8
_=/usr/bin/printenv
It's not obvious looking at that where /Volumes is coming from? Can you check the configure output for any clues?
Already checked, cannot find any clue. Can you point me to the make call, maybe this can give more infos.
% pwd
/Users/alex/sources/temurin-build
% grep -r "/Volumes" .
./workspace/build/src/test/jdk/java/nio/file/etc/MacVolumesTest.java: private static final String DATA_VOLUME = "/System/Volumes/Data";
Hi @andrew-m-leonard ,
Thanks again for helping out! According to this 10 years old bug, make
indeed has problems with whitespaces in path names: https://savannah.gnu.org/bugs/?712
I moved the sources directory to another path, now it almost succeeds:
Creating directory structure for static libs 'Contents/Home/lib/static/darwin-arm64'
~/sources/temurin-build/workspace/build/src/build/macosx-x86_64-server-release/images
moving static-libs to jdk-18.0.2+9-static-libs
Copying found debug symbols to jdk-18.0.2+9-debug-image
321532 blocks
find: jdk-18.0.2+9-jre: No such file or directory
find: jdk-18.0.2+9-jre: No such file or directory
Finished cleaning and moving archive files from jdk-18.0.2+9
From /Users/alex/sources/temurin-build/workspace/./build//src
* branch HEAD -> FETCH_HEAD
PERFORM_COPYING=false
Skipping copying of the free font library to jdk-18.0.2+9, does not apply for this version of the JDK.
From /Users/alex/sources/temurin-build/workspace/./build//src
* branch HEAD -> FETCH_HEAD
From /Users/alex/sources/temurin-build/workspace/./build//src
* branch HEAD -> FETCH_HEAD
cp: jdk-18.0.2+9/Contents/home//NOTICE: No such file or directory
@kerner1000 that should be copying sbin/NOTICE.template to the output, it's running this line: https://github.com/adoptium/temurin-build/blob/2e346aac60c09bf36d487638f00d7eb1e17c41e7/sbin/build.sh#L1176 Maybe you can check sbin/NOTICE.template exists?
@kerner1000 put some debug print's in your local copy of sbin/build.sh to figure why....
@kerner1000 that should be copying sbin/NOTICE.template to the output, it's running this line:
Maybe you can check sbin/NOTICE.template exists?
Thanks @andrew-m-leonard The file exists, so somehow the target dir does not exist.
ls sbin/
NOTICE.template build.sh build.template common prepareWorkspace.sh sig_check
cp: jdk-18.0.2+9/Contents/home//NOTICE: No such file or directory
Those double slashes are ok? Where should the target directory jdk-18.0.2+9
be located?
There are jdk-17
andjdk-10
folders.
temurin-build % ls
10.tgz NOTICE configureBuild.sh jdk-17 security
CHANGELOG.md README.md cyclonedx-lib makejdk-any-platform.1 serverTimestamp.properties
CODE_OF_CONDUCT.md RELEASING.md docker makejdk-any-platform.sh sign.sh
CONTRIBUTING.md SmokeTesting.md docker-build.sh native-build.sh signalhandler.sh
FAQ.md Testing.md entitlements.plist pipelines test
LICENSE build-farm jdk-10 sbin workspace
I added some debug to the build script, here is the result:
Home dir is /Volumes/Case-sensitive-Volume/sources/temurin-build/workspace/build/src/build/macosx-x86_64-server-release/images/jdk-18.0.2+9/Contents/home
Interestingly, when I print the directory content I see this:
ls /Volumes/Case-sensitive-Volume/sources/temurin-build/workspace/build/src/build/macosx-x86_64-server-release/images/jdk-18.0.2+9/Contents/
Home Info.plist MacOS
The error was the following:
cp: jdk-18.0.2+9/Contents/home/NOTICE: No such file or directory
You can see that the actual folder name is Home
with a capital H
, whereas the script prints and expects home
with a lower case h
.
My sources are located on a case sensitive volume (Mac's root volume is per default case insensitive)
After moving the sources back to the case insensitive default volume, it all worked!
Moving the artifact to location /Users/alex/sources/temurin-build/workspace/target//jdk18u-hotspot.tar.gz
archive done.
build.sh : 14:21:14 : All done!
So to sum up:
Thanks guys for your support, that's highly appreciated!
Will keep this open as there's some doc improvements to learn from here.
@kerner1000 glad you're working, I noticed the lower case "home" too, but didn't matter on my case insensitive drive. I will raise an issue to correct build.sh for that. Issue: https://github.com/adoptium/temurin-build/issues/3066
Thanks @andrew-m-leonard! One more question: How can I configure or disable codesigning?
@kerner1000 So the default codesign identity used by the openjdk make files is "openjdk_codesign", as long as a certificate for that does not exist in your build environment then codesigning will be disabled. If openjdk_codesign certificate exists (or the one you specify by configure arg --with-macosx-codesign-identity) and the codesign tool is in the path, then the openjdk make files will invoke "codesign"...
Note, however Eclipse Temurin builds actually do this slightly differently, because we need to sign using a bespoke Eclipse Foundation signing service. We actually do a two pass make process, running the default build exploded image, then we sign, then we do a full make of the images.
@andrew-m-leonard ok, then I assume my code is not code signed.
But why do the binaries then contain an embedded Info.plist
?
How can I disable this or define another value for CFBundleIdentifier
?
I am trying to cross-build on
aarm64
for Mac IntelX86_64
.I use the following command:
./makejdk-any-platform.sh --docker --clean-docker-build --openjdk-target=x86_64-unknown-linux jdk18u
(I don't know what the right target for Mac Intel is, so I wanted to try it with
x86_64-unknown-linux
)I get the following error:
Invalid build.sh option: --openjdk-target=x86_64-unknown-linux