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

Building cdds failed (Maven & Java version) #6

Closed
Theosakamg opened this issue Jun 22, 2018 · 5 comments
Closed

Building cdds failed (Maven & Java version) #6

Theosakamg opened this issue Jun 22, 2018 · 5 comments

Comments

@Theosakamg
Copy link
Contributor

Theosakamg commented Jun 22, 2018

Hi,

I tried compiling the cdds.

Context :

Debian Buster GNU/linux

GCC : Debian 7.3.0-21
cmake : version 3.11.2
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"

Java :

openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

maven :

Apache Maven 3.5.3
Maven home: /usr/share/maven
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: fr_FR, platform encoding: UTF-8

but on make

[  1%] Building JAR file /..../cyclonedds/build/idlc/target/idlc-jar-with-dependencies.jar
---------------------------------------------------
constituent[0]: file:/usr/share/maven/conf/logging/
constituent[1]: file:/usr/share/maven/lib/maven-embedder-3.x.jar
constituent[2]: file:/usr/share/maven/lib/plexus-cipher.jar
constituent[3]: file:/usr/share/maven/lib/sisu-plexus.jar
constituent[4]: file:/usr/share/maven/lib/maven-model-builder-3.x.jar
constituent[5]: file:/usr/share/maven/lib/maven-compat-3.x.jar
constituent[6]: file:/usr/share/maven/lib/slf4j-api.jar
constituent[7]: file:/usr/share/maven/lib/aopalliance.jar
constituent[8]: file:/usr/share/maven/lib/maven-resolver-transport-wagon.jar
constituent[9]: file:/usr/share/maven/lib/maven-slf4j-provider-3.x.jar
constituent[10]: file:/usr/share/maven/lib/jsr250-api.jar
constituent[11]: file:/usr/share/maven/lib/maven-plugin-api-3.x.jar
constituent[12]: file:/usr/share/maven/lib/plexus-component-annotations.jar
constituent[13]: file:/usr/share/maven/lib/wagon-file.jar
constituent[14]: file:/usr/share/maven/lib/maven-builder-support-3.x.jar
constituent[15]: file:/usr/share/maven/lib/sisu-inject.jar
constituent[16]: file:/usr/share/maven/lib/commons-io.jar
constituent[17]: file:/usr/share/maven/lib/plexus-interpolation.jar
constituent[18]: file:/usr/share/maven/lib/maven-repository-metadata-3.x.jar
constituent[19]: file:/usr/share/maven/lib/maven-core-3.x.jar
constituent[20]: file:/usr/share/maven/lib/cdi-api.jar
constituent[21]: file:/usr/share/maven/lib/maven-resolver-impl.jar
constituent[22]: file:/usr/share/maven/lib/maven-resolver-util.jar
constituent[23]: file:/usr/share/maven/lib/plexus-utils.jar
constituent[24]: file:/usr/share/maven/lib/wagon-provider-api.jar
constituent[25]: file:/usr/share/maven/lib/maven-model-3.x.jar
constituent[26]: file:/usr/share/maven/lib/commons-cli.jar
constituent[27]: file:/usr/share/maven/lib/maven-settings-builder-3.x.jar
constituent[28]: file:/usr/share/maven/lib/plexus-sec-dispatcher.jar
constituent[29]: file:/usr/share/maven/lib/guava.jar
constituent[30]: file:/usr/share/maven/lib/maven-settings-3.x.jar
constituent[31]: file:/usr/share/maven/lib/commons-lang3.jar
constituent[32]: file:/usr/share/maven/lib/maven-shared-utils.jar
constituent[33]: file:/usr/share/maven/lib/jcl-over-slf4j.jar
constituent[34]: file:/usr/share/maven/lib/wagon-http-shaded.jar
constituent[35]: file:/usr/share/maven/lib/guice.jar
constituent[36]: file:/usr/share/maven/lib/maven-artifact-3.x.jar
constituent[37]: file:/usr/share/maven/lib/maven-resolver-provider-3.x.jar
constituent[38]: file:/usr/share/maven/lib/maven-resolver-api.jar
constituent[39]: file:/usr/share/maven/lib/jansi.jar
constituent[40]: file:/usr/share/maven/lib/maven-resolver-connector-basic.jar
constituent[41]: file:/usr/share/maven/lib/maven-resolver-spi.jar
constituent[42]: file:/usr/share/maven/lib/javax.inject.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.mark()Ljava/nio/ByteBuffer;
	at org.eclipse.aether.connector.basic.ChecksumCalculator.update(ChecksumCalculator.java:202)
	at org.eclipse.aether.connector.basic.TransferTransportListener.transportProgressed(TransferTransportListener.java:90)
	at org.eclipse.aether.transport.wagon.WagonTransferListener.transferProgress(WagonTransferListener.java:64)
	at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress(TransferEventSupport.java:121)
	at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:594)
	at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:579)
	at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:372)
	at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:315)
	at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:284)
	at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:97)
	at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
	at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:567)
	at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:435)
	at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:412)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:453)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:360)
	at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:75)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:583)
	at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:259)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:498)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:399)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:224)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:201)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:261)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:192)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:253)
	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:182)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:286)
	at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:244)
	at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169)
	at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:154)
	at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:130)
	at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:144)
	at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:97)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:111)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
idlc/CMakeFiles/idlc.dir/build.make:160 : la recette pour la cible « idlc/target/idlc-jar-with-dependencies.jar » a échouée
make[2]: *** [idlc/target/idlc-jar-with-dependencies.jar] Erreur 1
CMakeFiles/Makefile2:85 : la recette pour la cible « idlc/CMakeFiles/idlc.dir/all » a échouée
make[1]: *** [idlc/CMakeFiles/idlc.dir/all] Erreur 2
Makefile:151 : la recette pour la cible « all » a échouée
make: *** [all] Erreur 2
@eboasson
Copy link
Contributor

My apologies for having misinterpreted some of the stack trace when you reported this against the old atolab/cdds repository. I am not so well-versed in Java/Maven issues, but I do know that I have no issues building it using the Oracle JDK, and that the README points there as well.

Is it possible that this is an OpenJDK-specific issue?

@Theosakamg
Copy link
Contributor Author

Same issue :

export J2SDKDIR=/usr/lib/jvm/java-8-oracle
export J2REDIR=/usr/lib/jvm/java-8-oracle/jre
export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db

Java :

java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Java check :

$ whereis javac java
javac: /usr/bin/javac /usr/lib/jvm/java-8-oracle/bin/javac /usr/share/man/man1/javac.1.gz
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /usr/lib/jvm/java-8-oracle/bin/java /usr/lib/jvm/java-8-oracle/jre/bin/java /usr/share/man/man1/java.1.gz
$ ls -lFa /usr/bin/javac
lrwxrwxrwx 1 root root 23 août  18  2017 /usr/bin/javac -> /etc/alternatives/javac*
$ ls -lFa /etc/alternatives/javac
lrwxrwxrwx 1 root root 36 juin  23 15:41 /etc/alternatives/javac -> /usr/lib/jvm/java-8-oracle/bin/javac*

@Theosakamg
Copy link
Contributor Author

Theosakamg commented Jun 23, 2018

seem to be a issue in Debian Maven...

Connected to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901881

@Theosakamg Theosakamg changed the title Building cdds failed Building cdds failed (Maven & Java version) Jun 23, 2018
@Theosakamg
Copy link
Contributor Author

And after upgrade to java >= 1.9

Scanning dependencies of target idlc
[  1%] Building JAR file /.../cyclonedds/build/idlc/target/idlc-jar-with-dependencies.jar
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[ERROR] COMPILATION ERROR : 
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project idlc: Compilation failure: Compilation failure: 
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
idlc/CMakeFiles/idlc.dir/build.make:183 : la recette pour la cible « idlc/target/idlc-jar-with-dependencies.jar » a échouée
make[2]: *** [idlc/target/idlc-jar-with-dependencies.jar] Erreur 1
CMakeFiles/Makefile2:85 : la recette pour la cible « idlc/CMakeFiles/idlc.dir/all » a échouée
make[1]: *** [idlc/CMakeFiles/idlc.dir/all] Erreur 2
Makefile:151 : la recette pour la cible « all » a échouée
make: *** [all] Erreur 2

@eboasson
Copy link
Contributor

Thank you for figuring all this out!

eboasson added a commit to eboasson/cyclonedds that referenced this issue Dec 7, 2023
This fixes a global buffer overflow (underflow?) reported by ASAN as
follows:

==93535==ERROR: AddressSanitizer: global-buffer-overflow on address \
  0x000100144e3f at pc 0x000100084424 bp 0x00016fdfd380 sp 0x00016fdfd378
READ of size 1 at 0x000100144e3f thread T0
    #0 0x100084420 in put_a_line main.c:975
    #1 0x100082974 in putout main.c:895
    eclipse-cyclonedds#2 0x100080ab4 in mcpp_main main.c:753
    eclipse-cyclonedds#3 0x10007d3fc in mcpp_lib_main main.c:430
    eclipse-cyclonedds#4 0x10000a230 in idlc_parse idlc.c:375
    eclipse-cyclonedds#5 0x100006f1c in main idlc.c:772
    eclipse-cyclonedds#6 0x181d51054  (<unknown module>)

0x000100144e3f is located 1 bytes before global variable 'output' \
  defined in '/Users/erik/C/cdds/src/tools/idlpp/src/main.c' (0x100144e40) of size 262144
0x000100144e3f is located 23 bytes after global variable 'src_col' \
  defined in '/Users/erik/C/cdds/src/tools/idlpp/src/main.c' (0x100144e20) of size 8

Triggered by the following input:

hexdump -C ~/Downloads/asan-global-bof.idl
00000000  23 fc ff 0a 23 64 65 66  69 6e 65 20 69 0a 23 64  |#...#define i.#d|
00000010  65 66 69 6e 65 20 4a 00  0a 20 4a 00 0a 23 64 69  |efine J.. J..#di|
00000020  44 66 7f f8 ff ff 66 00  32 44 0a 23 64 69 69 6e  |Df....f.2D.#diin|
00000030  65 20 4a 32 32 32 44 12  64 27 ff 7f ff 23 3e 69  |e J222D.d'...#>i|
00000040  0a                                                |.|
00000041

(I gave up trying to reduce it further.)

The problem is caused by scanning for the last non-whitespace character
just before outputting a line without accounting for the case where the
line consists solely of whitespace.

Credits for finding the bug:
- Carlos Andres Ramirez (https://carlos.engineer)
- Goktug Serez (https://github.com/g0ku704)
- Xin Huang (https://github.com/xinhuang)

Signed-off-by: Erik Boasson <eb@ilities.com>
eboasson added a commit to eboasson/cyclonedds that referenced this issue Dec 8, 2023
This fixes a global buffer overflow (underflow?) reported by ASAN as
follows:
```
ERROR: AddressSanitizer: global-buffer-overflow on address \
  0x000100144e3f at pc 0x000100084424 bp 0x00016fdfd380 sp 0x00016fdfd378
READ of size 1 at 0x000100144e3f thread T0
    #0 0x100084420 in put_a_line main.c:975
    #1 0x100082974 in putout main.c:895
    eclipse-cyclonedds#2 0x100080ab4 in mcpp_main main.c:753
    eclipse-cyclonedds#3 0x10007d3fc in mcpp_lib_main main.c:430
    eclipse-cyclonedds#4 0x10000a230 in idlc_parse idlc.c:375
    eclipse-cyclonedds#5 0x100006f1c in main idlc.c:772
    eclipse-cyclonedds#6 0x181d51054  (<unknown module>)

0x000100144e3f is located 1 bytes before global variable 'output' \
  defined in 'src/tools/idlpp/src/main.c' (0x100144e40) of size 262144
0x000100144e3f is located 23 bytes after global variable 'src_col' \
  defined in 'src/tools/idlpp/src/main.c' (0x100144e20) of size 8
```

Triggered by the following input (`hexdump -C` output):
```
00000000  23 fc ff 0a 23 64 65 66  69 6e 65 20 69 0a 23 64  |#...#define i.#d|
00000010  65 66 69 6e 65 20 4a 00  0a 20 4a 00 0a 23 64 69  |efine J.. J..#di|
00000020  44 66 7f f8 ff ff 66 00  32 44 0a 23 64 69 69 6e  |Df....f.2D.#diin|
00000030  65 20 4a 32 32 32 44 12  64 27 ff 7f ff 23 3e 69  |e J222D.d'...#>i|
00000040  0a                                                |.|
00000041
```
(I tried to reduce it further, but gave up.)

The problem is caused by scanning for the last non-whitespace character
just before outputting a line without accounting for the case where the
line consists solely of whitespace.

Credits for finding the bug:
- Carlos Andres Ramirez (https://carlos.engineer)
- Goktug Serez (https://github.com/g0ku704)
- Xin Huang (https://github.com/xinhuang)

Signed-off-by: Erik Boasson <eb@ilities.com>
eboasson added a commit to eboasson/cyclonedds that referenced this issue Dec 8, 2023
This fixes a global buffer overflow (underflow?) reported by ASAN as
follows:

ERROR: AddressSanitizer: global-buffer-overflow on address \
  0x000100144e3f at pc 0x000100084424 bp 0x00016fdfd380 sp 0x00016fdfd378
READ of size 1 at 0x000100144e3f thread T0
    #0 0x100084420 in put_a_line main.c:975
    #1 0x100082974 in putout main.c:895
    eclipse-cyclonedds#2 0x100080ab4 in mcpp_main main.c:753
    eclipse-cyclonedds#3 0x10007d3fc in mcpp_lib_main main.c:430
    eclipse-cyclonedds#4 0x10000a230 in idlc_parse idlc.c:375
    eclipse-cyclonedds#5 0x100006f1c in main idlc.c:772
    eclipse-cyclonedds#6 0x181d51054  (<unknown module>)

0x000100144e3f is located 1 bytes before global variable 'output' \
  defined in 'src/tools/idlpp/src/main.c' (0x100144e40) of size 262144
0x000100144e3f is located 23 bytes after global variable 'src_col' \
  defined in 'src/tools/idlpp/src/main.c' (0x100144e20) of size 8

Triggered by the following input ("hexdump -C" output):
00000000  23 fc ff 0a 23 64 65 66  69 6e 65 20 69 0a 23 64  |#...#define i.#d|
00000010  65 66 69 6e 65 20 4a 00  0a 20 4a 00 0a 23 64 69  |efine J.. J..#di|
00000020  44 66 7f f8 ff ff 66 00  32 44 0a 23 64 69 69 6e  |Df....f.2D.#diin|
00000030  65 20 4a 32 32 32 44 12  64 27 ff 7f ff 23 3e 69  |e J222D.d'...#>i|
00000040  0a                                                |.|
00000041
(I tried to reduce it further, but gave up.)

The problem is caused by scanning for the last non-whitespace character
just before outputting a line without accounting for the case where the
line consists solely of whitespace.

Credits for finding the bug:
- Carlos Andres Ramirez (https://carlos.engineer)
- Goktug Serez (https://github.com/g0ku704)
- Xin Huang (https://github.com/xinhuang)

Signed-off-by: Erik Boasson <eb@ilities.com>
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