How to compile an OpenJDK 7 debug build on Ubuntu 11.10 - debugging

Where can I find a simple set of instructions to compile an OpenJDK 7 debug build on Ubuntu 11.10 (Oneiric)? A debug build would make more JVM options available for troubleshooting purposes; for example, WizardMode. The developers' guide and build README have a lot of noise and are hard to follow.

Install relevant packages:
sudo apt-get install ant build-essential openjdk-6-jdk
sudo apt-get build-dep openjdk-6-jdk
Find the master OpenJDK Mercurial repository you want to start from. These instructions will use jdk7u2.
Command examples contain settings to allow Internet access through a proxy server; remove them if they are unnecessary for you.
Clone the Mercurial top-level forest repository:
$ mkdir jdk7u2
$ cd jdk7u2
$ hg --config http_proxy.host=proxy:1234 clone http://hg.openjdk.java.net/jdk7u/jdk7u2 forest
$ cd forest
$ sh ./get_source.sh
The build will fail while compiling the sound libraries. As suggested here, use the following to patch the appropriate Makefile:
$ echo -e "--- old/jdk/make/javax/sound/jsoundalsa/Makefile 2012-01-28 12:00:00.000000000 -0500\n+++ new/jdk/make/javax/sound/jsoundalsa/Makefile 2012-01-28 12:00:00.000000000 -0500\n## -65,7 +65,7 ##\n \t\$(MIDIFILES_export) \\\\\n \t\$(PORTFILES_export)\n\n-LDFLAGS += -lasound\n+EXTRA_LIBS += -lasound\n \n CPPFLAGS += \\\\\n \t-DUSE_DAUDIO=TRUE \\\\" | patch -p1
Compile:
$ export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=1234 -Dhttps.proxyHost=proxy -Dhttps.proxyPort=1234"
$ . jdk/make/jdk_generic_profile.sh
$ make ALLOW_DOWNLOADS=true fastdebug_build
The compile will take a while.
Verify the build:
$ build/linux-amd64-fastdebug/j2sdk-image/bin/java -version
openjdk version "1.7.0-internal-fastdebug"
OpenJDK Runtime Environment (build 1.7.0-internal-fastdebug-user_2012_01_28_13_25-b00)
OpenJDK 64-Bit Server VM (build 22.0-b10-fastdebug, mixed mode)
$ build/linux-amd64-fastdebug/j2sdk-image/bin/java -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -XX:+PrintFlagsWithComments -version
If you have problems along the way, begin by reading The OpenJDK Developers' Guide and the OpenJDK Build README.

Related

E: Unable to locate package openjdk-11-jdk

I try to create docker image:
It is my Dockerfile:
FROM maven:3-jdk-11
# Common files and utils for build
RUN apt-get update && apt-get install -y make fakeroot rpm dpkg-dev apt-utils wget unzip
RUN apt-get install -y -q software-properties-common desktop-file-utils
# Then Wine with all deps
RUN dpkg --add-architecture i386 && apt-get update
RUN apt-get install -y --install-recommends wine
RUN apt-cache search openjdk
RUN apt-get install -y openjdk-11-jdk
RUN apt install -y openjfx11 libopenjfx-java libopenjfx-jni
RUN apt-get install -y --install-recommends wine32
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV JAVAFX_HOME /usr/share/java/openjfx11
# And we ready to play with our code
ARG SRCDIR=.
ARG DSTDIR=/usr/src/CryptoStock
ARG CACHEDIR=./cache
# Subject to be used here but should be command line, sic!
# ADD ${CACHEDIR} /root/.m2
# ADD ${SRCDIR} /mnt/src
RUN mkdir -p /root/.m2/repository
COPY settings.xml /root/.m2/settings.xml
COPY settings-security.xml /root/.m2/settings-security.xml
COPY jdk11-build-in-docker.sh ${DSTDIR}/jdk11-build-in-docker.sh
COPY ./static/. ${DSTDIR}/static
COPY ./3rdparty/. ${DSTDIR}/3rdparty
COPY ./winjdk11/. ${DSTDIR}/winjdk
ENV SOURCES /usr/src/CryptoStock
ENV OUTSIDE /mnt/src
RUN dpkg -l '*openjfx*'
RUN dpkg -l '*jdk*'
WORKDIR ${DSTDIR}
CMD [ "sh", "/usr/src/CryptoStock/jdk11-build-in-docker.sh" ]
When I try to build I don't to watch java 11:
Step 6/27 : RUN apt-cache search openjdk
---> Running in e03b4c69fa69
jtreg - Regression Test Harness for the OpenJDK platform
openjdk-8-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-8-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-8-doc - OpenJDK Development Kit (JDK) documentation
openjdk-8-jdk - OpenJDK Development Kit (JDK)
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-8-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-8-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-8-source - OpenJDK Development Kit (JDK) source files
openjdk-8-jre-dcevm - Alternative VM for OpenJDK 8 with enhanced class redefinition
uwsgi-plugin-jvm-openjdk-8 - Java plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-jwsgi-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-ring-openjdk-8 - Closure/Ring plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-servlet-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
Removing intermediate container e03b4c69fa69
---> 1fae3b35c58b
Step 7/27 : RUN apt-get install -y openjdk-11-jdk
---> Running in 288fb5247ce6
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package openjdk-11-jdk
The command '/bin/sh -c apt-get install -y openjdk-11-jdk' returned a non-zero code: 100
There is only java 8, there is no java 11.
OpenJDK 11 is installed by default in the maven:3-jdk-11 image:
$ docker run maven:3-jdk-11 java --version
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment 18.9 (build 11.0.16+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.16+8, mixed mode, sharing)
It is also available via the Debian package system:
$ docker run maven:3-jdk-11 sh -c 'apt update && apt-cache search openjdk-11'
[...]
openjdk-11-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-11-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-11-doc - OpenJDK Development Kit (JDK) documentation
openjdk-11-jdk - OpenJDK Development Kit (JDK)
openjdk-11-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-11-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-11-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-11-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-11-source - OpenJDK Development Kit (JDK) source files
[...]
Today the maven:3-jdk-11 image is using Debian 11 (Bullseye), but when you wrote your question the maven:3-jdk-11 image was probably using a Debian 9 (Stretch) image with OpenJDK 11 installed but not available through the Debian package system. This explains your error.

Using Gradle with OpenJDK 1.9

I cannot seem to use Gradle with OpenJDK 1.9.
When I run the following command:
react-native run-android
I end up getting this error.
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '9-internal'.
Running java -version shows me:
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
Any ideas how I can fix this?
Which version of gradle are you using?
cd android
./gradlew -version
I think there was a bug determining versions for java 1.9 which was fixed in Gradle 2.10.
Another option is to try spoofing a java.version that Gradle can parse
export JAVA_TOOL_OPTIONS='-Djava.version=1.9'
react-native run-android
#see JavaVersion.java and JavaVersionSpec.groovy
This seems to be an incompatibility with your build of OpenJDK 9 and Gradle.
Your OpenJDK version is:
openjdk version "9-internal"
And it appears Gradle can't parse it:
Could not determine java version from '9-internal'.
Looks like gradle is prepared to accept 9-ea, but not 9-internal.
You will have to modify your build of OpenJDK to have it return "9-ea" or something similar for java -version.
The following configure options when building OpenJDK 9 should do the trick:
configure \
--with-version-pre="ea" \
--with-version-opt="" \
... your other options ...
I had the same exact issue and, in my case, it worked by removing OpenJDK:
sudo rm /var/lib/dpkg/info/openjdk-*
sudo apt-get purge openjdk-*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update
and installing the Oracle Java SDK:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
I know this is not the exact answer (using Gradle with OpenJDK 1.9), but I managed to keep going and run the app both in a virtual device and in my smartphone. Hope it helps.
Note: I am running react-native: 0.40.0 and react-native-cli: 2.0.1 in Ubuntu 16.04

gradle -v does not work and gives java errors

I can't seem to get gradle to install on work on opensuse 13.2.
Installed by:
sudo unzip -oq gradle-2.2.1-all.zip -d /opt/gradle
sudo ln -sfn gradle-2.2.1 /opt/gradle/latest
export GRADLE_HOME=/opt/gradle/latest
export PATH=$GRADLE_HOME/bin:$PATH
running gradle:
$gradle -v
java.lang.NoClassDefFoundError: org.gradle.util.CollectionUtils
at java.lang.Class.initializeClass(libgcj.so.14)
at org.gradle.internal.classpath.DefaultClassPath.<init>(DefaultClassPath.java:37)
at org.gradle.api.internal.classpath.EffectiveClassPath.<init>(EffectiveClassPath.java:32)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.<init>(DefaultModuleRegistry.java:61)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.<init>(DefaultModuleRegistry.java:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:44)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/opt/gradle/gradle-2.2.1/lib/gradle-launcher-2.2.1.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.Class.initializeClass(libgcj.so.14)
...7 more
Have you tried adding the symlink in /usr/bin?
Like this:
sudo ln -s /opt/gradle/latest/bin/gradle /usr/bin/gradle
It worked for me in openSuse 13.2
Make sure gradle is using Java 1.8
> $JAVA_HOME/bin/java -version
Should return
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (IcedTea 3.8.0) (build 1.8.0_171-b11 suse-24.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
My box had $JAVA_HOME linked to Java 1.5

Installing Elasticsearch on OSX Mavericks

I'm trying to install Elasticsearch 1.1.0 on OSX Mavericks but i got the following errors when i'm trying to start:
:> ./elasticsearch
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.Version
at org.elasticsearch.bootstrap.Bootstrap.buildErrorMessage(Bootstrap.java:252)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:236)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Also when i'm executing the same command with -v arg, i got this error:
:> ./elasticsearch -v
Exception in thread "main" java.lang.NoSuchFieldError: LUCENE_36
at org.elasticsearch.Version.<clinit>(Version.java:42)
Here's my environment:
Java version
>: java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
Instalation path (downloaded .tar.gz archive from elasticsearch download page and extracted here):
/usr/local/elasticsearch-1.1.0
ENV vars:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
CLASSPATH=/usr/local/elasticsearch-1.1.0/lib/*.jar:/usr/local/elasticsearch-1.1.0/lib/sigar/*.jar
UPDATE
i finally make it working, unfortunally not sure how because i tried a lot of changes :). But here's a list of changes i made that can help:
i removed jdk and jre and reinstalled on a clean env.
http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096855
i deleted all the cache dirs.I suppose this can be the 'cause' for that it's working now
~/Library/Caches
/Library/Caches
i removed CLASSPATH env var.
ES_PATH and ES_HOME env vars are not set either, but i think this is not so important.
Note: now it's working also if i'm installing with brew.
Thanks.
You should really consider using brew. It's a great tool that will take care of dependencies, version control and much more.
To install Elasticsearch using brew, simply:
brew update
brew install elasticsearch
Boom! Done.
After that follow Elasticsearch instructions :
To have launchd start Elasticsearch at login:
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
Then to load Elasticsearch now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Or, if you don't want/need launchctl, you can just run:
elasticsearch
As there are not very good instructions for actually "installing" it onto a Mac:
Short Version:
Install Java (prefer latest supported release)
Set JAVA_HOME environment variable.
Download Elasticsearch version (tar or zip).
Extract Elasticsearch from the downloaded file.
Run bin/elasticsearch from the extracted directory.
Long version:
Download Java
Only need the JRE if you will not be writing code on the same machine.
I assume that you are getting the latest JDK, which is currently JDK 8 (as you appear to have, and I have installed working on my machine).
Download and extract Elasticsearch and extract it into some directory.
For example: mkdir -p ~/dev/elasticsearch
Optionally move the downloaded file to there:
mv Downloads/elasticsearch* ~/dev/elasticsearch
Extract the downloaded file:
cd ~/dev/elasticsearch (if you moved it in step 2)
If it's the zip, then unzip elasticsearch-1.1.0.zip (or if you don't want to cd into the directory, then just run unzip elasticsearch-1.1.0.zip -d ~/dev/elasticsearch)
If it's the tar, then tar -xvf elasticsearch-1.1.0.tar.gz (or if you don't want to cd into the directory, then just run tar -xvf elasticsearch-1.1.0.tar.gz -C ~/dev/elasticsearch)
Cleanup (if you want) by removing the downloaded file:
rm elasticsearch-1.1.0.*
Open your .bash_profile file for your bash profile settings:
vi ~/.bash_profile
In the file, export your environment variable(s)
export ES_HOME=~/dev/elasticsearch/elasticsearch-1.1.0
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
export PATH=$ES_HOME/bin:$JAVA_HOME/bin:$PATH
Close and re-open your Terminal OR
Run source ~/.bash_profile to update the environment variables
Run Elasticsearch:
elasticsearch
The more traditional way to run it is to do pretty much all of the above, but not add $ES_HOME/bin to the PATH. Then, just go to ES_PATH (cd $ES_PATH, then bin/elasticsearch) or run $ES_PATH/bin/elasticsearch.
Note: Do not setup your CLASSPATH without a very good reason. The scripts will do that for you.
You should try to using brew with last update:
brew update
And install Cask java:
brew cask install java
After that you can install elasticsearch:
brew install elasticsearch
And to have launched start elasticsearch now use:
brew services start elasticsearch
Or you can just run:
elasticsearch
To update ElasticSearch, just run brew upgrade elasticsearch
Update your java
brew update
brew cask install java
Install it with homebrew
brew install elasticsearch
install gpg &&
install java or jdk
1-Import the repository’s GPG key:
wget -qO - https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
2-this is code repository elasticserach in linux for download
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
3-link download elasticsearch
https://www.elastic.co/downloads/elasticsearch
if error
"Job for elasticsearch.service failed because a timeout was exceeded.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details."
solution:
1-sudo journalctl -f
2-sudo systemctl enable elasticsearch.service
3-sudo systemctl start elasticsearch

Linphone compiling problems on osx

I'm trying to compile linphone on mountain lion. I have downloaded the sources and followed all the instructions in the README.macos file. The first time, when I got to '$ port install ige-mac-integration' an error occurred. It said gtk2 had to be installed with x11, however, the instructions said to install it with quartz and no_x11. I tried installing gtk2 again, this time with x11, but when I get to the compiling process it tells me quartz is needed. I can't install both, because the gtk2 installation will complain about it, and it seems I need both to complete the entire process of installing and compiling linphone.
I have tried these steps with the downloadable sources, as well as the git sources, both gave me the same problems. Linphone does not have a forum, so I couldn't ask it on their site.
I just need to get the sources and start using them, so any recommendations on how to open the linphone source, edit it, and compile/run it would be very welcome. The ideal situation would be where I can just open an xcode project file.
This is the readme file:
**********************************
* Compiling linphone on macos X *
**********************************
You need:
- Xcode (download from apple or using appstore application)
- Macports: http://www.macports.org/
Download and install macports using its user friendly installer.
- Install build time dependencies
$ port install automake autoconf libtool intltool
- Install some linphone dependencies with macports
$ port install speex
$ port install libosip2 # WARNING: currently outdated in macport
$ port install libeXosip2 #WARNING: currently outdated in macport
$ port install ffmpeg-devel
$ port install libvpx
- Install srtp (optional) for call encryption
$ port install srtp
If that fails, get from source:
$ git clone git://git.linphone.org/srtp.git
$ cd srtp && autoconf && ./configure --prefix=/opt/local && make libsrtp.a
$ sudo make install
- Install zrtpcpp (optional), for unbreakable call encryption
$ port install cmake
$ git clone git://git.linphone.org/zrtpcpp.git
$ cd zrtpcpp && cmake -Denable_ccrtp=false . && make
$ sudo make install
- Install gtk. It is recommended to use the quartz backend for better integration.
$ port install gtk2 +quartz +no_x11
$ port install hicolor-icon-theme
- Compile and install the tunnelsu
If you got the source code from git, run ./autogen.sh first
Then or otherwise, do:
$ ./configure --prefix=/opt/local && make && sudo make install
- Compile linphone
If you got the source code from git, run ./autogen.sh first.
Then or otherwise, do:
$ ./configure --prefix=/opt/local --with-readline=/opt/local --disable-strict --disable-x11 --with-srtp=/opt/local --with-gsm=/opt/local --enable-zrtp && make
Install to /opt/local
$ sudo make install
Done.
If you want to generate a portable bundle, then install gtk-mac-bundler.
Use git:
$ git clone https://github.com/jralls/gtk-mac-bundler.git
$ cd gtk-mac-bundler && make install
$ export PATH=$PATH:~/.local/bin
#make this dummy charset.alias file for the bundler to be happy:
$ sudo touch touch /opt/local/lib/charset.alias
Then run, inside linphone source tree:
1. Run configure as told before but with "--enable-relativeprefix" appended.
$ make
$ make bundle
The resulting bundle is located in linphone build directory, together with a zipped version.
For a better appearance, you can install the gtk-quartz-engine (a gtk theme) that make gtk application more similar to other mac applications (but not perfect).
$ git clone https://github.com/jralls/gtk-quartz-engine.git
$ cd gtk-quartz-engine
$ autoreconf -i
$ ./configure --prefix=/opt/local && make
$ sudo make install
Generate a new bundle to have it included.
Below is the details to configure the dependencies and build linphone.
==============================================================
Step: 1:- Dependency configuration:
I just followed the instruction which is available in "README.macos" upto sqlite3 configuration. I had some problem with dependancies configuration.
Because of macport version, srtp configuration is failed. So I have downloaded "MacPorts-2.1.3-10.8-MountainLion.pkg" and installed manually.
Because of GTK version, libsoup is failed. So I have downloaded "GTK_2.18.5-X11.pkg" and installed manually.
After the manual installation, I have followed "README.macos" again for reconfiguration.
NOTE: Sometime terminal won't recognize "wget".
--> Solution: just execute below command.
echo 'alias wget="curl -O"' >> ~/.bash_profile
Step: 2:- Compile and Install:
I got some problem related to intltool while compiling.
Solution: just I set the path by executing below commands
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
Now it is successfully compiled and installed.
Step: 3:- Creating bundle to run the app:
Just I followed below commands to make the build.
If you want to generate a portable bundle, then install gtk-mac-bundler.
Use git:
$ git clone https://github.com/jralls/gtk-mac-bundler.git
$ cd gtk-mac-bundler && make install
$ export PATH=$PATH:~/.local/bin
#make this dummy charset.alias file for the bundler to be happy:
$ sudo touch touch /opt/local/lib/charset.alias
Then run, inside linphone source tree:
1. Run configure as told before but with "--enable-relativeprefix" appended.
$ make
$ make bundle
It will create "linphone.app" file in current linphone directory. It will support only for "Mountain Lion".
Step: 4:- Support for lower version: (e.g.: Lion, Snow Leopard...)
We have to configure "libiconv hack" to supporting for lower version
I think it will help you.
I wrote an answer here. It's a bit long but I sincerely hope it is clear enough and will help you.
It contains the build settings and other libs you need to include.
Cool stuff I didn't need to run the make :)
Best,

Resources