Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

build low version jdk have some errors #1

Open
SummerSec opened this issue Aug 20, 2021 · 9 comments
Open

build low version jdk have some errors #1

SummerSec opened this issue Aug 20, 2021 · 9 comments
Labels
awaiting-response Issue or pull request on which the response of the author is expected question Further information is requested

Comments

@SummerSec
Copy link

solved
https://stackoverflow.com/questions/54315646/failed-to-build-open-jdk-8-from-source-ubuntu-18-04-64bit
https://stackoverflow.com/questions/21246042/scrambled-arguments-when-building-openjdk

@Marcono1234
Copy link
Owner

Could you please provide the Git repository URL you used (and the commit SHA), as well as the JDK boot version and any other custom settings you used?

@SummerSec
Copy link
Author

Could you please provide the Git repository URL you used (and the commit SHA), as well as the JDK boot version and any other custom settings you used?

https://github.com/openjdk/jdk8u
BOOT JDK :
https://download.java.net/openjdk/jdk7u75/ri/jdk_ri-7u75-b13-linux-x64-18_dec_2014.tar.gz
The above problems are due to the fact that openjdk does not support low and high kernel versions, uname -r will not be compiled if it is 4.x or 5.x. This has nothing to do with codeql, it's just that jdk8u is only compiled with low versions.

@SummerSec
Copy link
Author

I have a question if you are in the same situation as me. After I compile and create jdk16 database with ubuntu, I move the database to windows for query, codeql will report that the version is different, please use the latest version. Later I compared the database configuration file and it did differ a bit, but I replaced the vscode-start-codeql file with the database file and then it worked without any problem.

@Marcono1234
Copy link
Owner

uname -r will not be compiled if it is 4.x or 5.x

Hmm, I am running with WSL2 kernel 5.4.72-microsoft-standard-WSL2 and it seems to work without any issues. The first StackOverflow link you mentioned refers to SUPPORTED_OS_VERSION but I am not able to find that for openjdk/jdk8u (at least not for Linux).

However, I got a compilation error:

[2021-08-22 19:23:56] [build-stderr] /codeql-jdk/jdk/hotspot/src/os/linux/vm/os_linux.cpp: In static member function 'static void os::Linux::check_signal_handler(int)':
[2021-08-22 19:23:56] [build-stderr] /codeql-jdk/jdk/hotspot/src/os/linux/vm/os_linux.cpp:4999:15: error: '%s' directive argument is null [-Werror=format-overflow=]
[2021-08-22 19:23:56] [build-stderr]  4999 |     tty->print("Warning: %s handler ", exception_name(sig, buf, O_BUFLEN));
[2021-08-22 19:23:56] [build-stderr]       |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This has been reported as JDK-8269388 and has already been fixed, however https://github.com/openjdk/jdk8u is apparently not updated anymore ("About" section on the right says "Read-only mirror of https://hg.openjdk.java.net/jdk8u until tag jdk8u292-b01").
Therefore I used https://github.com/adoptium/jdk8u as Git repository URI.

So in the end I used on Windows:

  • docker build ... --build-arg BOOT_JDK_VERSION=8 (edited build_database.cmd locally)
  • .\build_database.cmd --jdk-git-repo https://github.com/adoptium/jdk8u --make-target all --memory-limit 2500

Can you please check if a similar configuration on Linux allows you to build jdk8u?

@Marcono1234
Copy link
Owner

After I compile and create jdk16 database with ubuntu, I move the database to windows for query, codeql will report that the version is different, please use the latest version. Later I compared the database configuration file and it did differ a bit, but I replaced the vscode-start-codeql file with the database file and then it worked without any problem.

No, I have not noticed such a problem yet. I am using Windows with WSL2 and then using CodeQL through the VSCode extension. The scripts of this repository previously used CodeQL CLI 2.5.7 (have updated it to 2.5.9 in 17f530b). Maybe that is causing a warning; or maybe because the query pack layout and database schemas have been changed recently in https://github.com/github/codeql.

Could you please provide the exact error / warning you are seeing (ideally with screenshot), and the tool you are using (e.g. CodeQL CLI or VSCode extension)?

@SummerSec
Copy link
Author

After I compile and create jdk16 database with ubuntu, I move the database to windows for query, codeql will report that the version is different, please use the latest version. Later I compared the database configuration file and it did differ a bit, but I replaced the vscode-start-codeql file with the database file and then it worked without any problem.

No, I have not noticed such a problem yet. I am using Windows with WSL2 and then using CodeQL through the VSCode extension. The scripts of this repository previously used CodeQL CLI 2.5.7 (have updated it to 2.5.9 in 17f530b). Maybe that is causing a warning; or maybe because the query pack layout and database schemas have been changed recently in https://github.com/github/codeql.

Could you please provide the exact error / warning you are seeing (ideally with screenshot), and the tool you are using (e.g. CodeQL CLI or VSCode extension)?

Starting GitHub.vscode-codeql extension
Checking CodeQL version using CodeQL CLI: D:\codeql\codeql\codeql.exe version -v --log-to-stderr --format=terse...
[2021-08-23 10:54:24] This is codeql version -v --log-to-stderr --format=terse
[2021-08-23 10:54:24] Terminating normally.

CLI command succeeded.
CodeQL CLI is installed externally so could not be updated.
Checking CodeQL version using CodeQL CLI: D:\codeql\codeql\codeql.exe version -v --log-to-stderr --format=terse...
[2021-08-23 10:54:25] This is codeql version -v --log-to-stderr --format=terse
[2021-08-23 10:54:25] Terminating normally.

CLI command succeeded.
Found compatible version of CodeQL CLI (version 2.5.9)
Initializing configuration listener...
Initializing CodeQL cli server...
Initializing query server client.
Checking CodeQL version using CodeQL CLI: D:\codeql\codeql\codeql.exe version -v --log-to-stderr --format=terse...
Starting CodeQL CLI Server using CodeQL CLI: D:\codeql\codeql\codeql.exe execute cli-server -v --log-to-stderr
CodeQL CLI Server started on PID: 21340
Resolving RAM settings using CodeQL CLI: resolve ram -v --log-to-stderr --format json...
[2021-08-23 10:54:27] This is codeql version -v --log-to-stderr --format=terse
[2021-08-23 10:54:27] Terminating normally.

CLI command succeeded.
CLI command succeeded.
[2021-08-23 10:54:27] This is codeql execute cli-server -v --log-to-stderr

Initializing database manager.
Initializing database panel.
Registering database panel commands.
Initializing query history manager.
Registering query history panel commands.
Initializing results panel interface.
Initializing compare panel interface.
Initializing source archive filesystem provider.
Initializing CodeQL language server.
Initializing QLTest interface.
Registering CodeQL test panel commands.
Registering top-level command palette commands.
Starting language server.
Registering jump-to-definition handlers.
Removing orphaned databases from workspace storage.
Resolving tests using CodeQL CLI: resolve tests --strict-test-discovery -v --log-to-stderr --format json d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk...
No orphaned databases found.
Successfully finished extension initialization.
CLI command succeeded.

Resolving library paths using CodeQL CLI: resolve library-path -v --log-to-stderr --format json --query d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\demo.ql --additional-packs d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk...
CLI command succeeded.
[2021-08-23 10:54:38] [DETAILS] resolve library-path> Resolving query at normalized path D:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\demo.ql.
[2021-08-23 10:54:38] [DETAILS] resolve library-path> Found enclosing pack 'jdk' at D:\codeql\learning-codeql\codeql-java-vul\codeql-jdk.
[2021-08-23 10:54:38] [DETAILS] resolve library-path> Adding compilation cache at D:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\.cache.
[2021-08-23 10:54:38] [DETAILS] resolve library-path> Resolving library dependencies from D:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\qlpack.yml.
[2021-08-23 10:54:40] [DETAILS] resolve library-path> QL pack dependencies for D:\codeql\learning-codeql\codeql-java-vul\codeql-jdk resolved OK.
[2021-08-23 10:54:40] [DETAILS] resolve library-path> Found dbscheme through QL packs: D:\codeql\vscode-codeql-starter\ql\java\ql\src\config\semmlecode.dbscheme.

Resolving query metadata using CodeQL CLI: resolve metadata -v --log-to-stderr --format json d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\demo.ql...
CLI command succeeded.

Resolving database upgrade scripts using CodeQL CLI: resolve upgrades -v --log-to-stderr --format json --additional-packs d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk --dbscheme d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\codeql-jdk-java-db\db-java\semmlecode.dbscheme --target-dbscheme D:\codeql\vscode-codeql-starter\ql\java\ql\src\config\semmlecode.dbscheme --allow-downgrades...
CLI command succeeded.
[2021-08-23 10:54:40] [DETAILS] resolve upgrades> Searching for upgrades that apply to b4e689c90426b017ad550e30a439cab2763ff424.
[2021-08-23 10:54:40] [DETAILS] resolve upgrades> Scanning for qlpack.yml from D:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\
[2021-08-23 10:54:40] [DETAILS] resolve upgrades> Scanning for qlpack.yml from D:\codeql\codeql\.codeqlmanifest.json
[2021-08-23 10:54:40] [DETAILS] resolve upgrades> Scanning for qlpack.yml from D:\codeql\
[2021-08-23 10:54:40] [DETAILS] resolve upgrades> Scanning for qlpack.yml from D:\codeql\2\.codeqlmanifest.json
[2021-08-23 10:54:40] [DETAILS] resolve upgrades> Not scanning from D:\codeql\codeql which is already done.
[2021-08-23 10:54:40] [DETAILS] resolve upgrades> Scanning for qlpack.yml from D:\codeql\vscode-codeql-starter\.codeqlmanifest.json
[2021-08-23 10:54:41] [DETAILS] resolve upgrades> Scanning for qlpack.yml from D:\codeql\vscode-codeql-starter\codeql-go\.codeqlmanifest.json
[2021-08-23 10:54:41] [DETAILS] resolve upgrades> Scanning for qlpack.yml from D:\codeql\vscode-codeql-starter\ql\.codeqlmanifest.json
[2021-08-23 10:54:42] [DETAILS] resolve upgrades> Will look for upgrades in D:\codeql\codeql\legacy-upgrades\upgrades
[2021-08-23 10:54:42] [DETAILS] resolve upgrades> Will look for upgrades in D:\codeql\vscode-codeql-starter\codeql-go\upgrades
[2021-08-23 10:54:42] [DETAILS] resolve upgrades> Will look for upgrades in D:\codeql\vscode-codeql-starter\ql\cpp\upgrades
[2021-08-23 10:54:42] [DETAILS] resolve upgrades> Will look for upgrades in D:\codeql\vscode-codeql-starter\ql\csharp\upgrades
[2021-08-23 10:54:42] [DETAILS] resolve upgrades> Will look for upgrades in D:\codeql\vscode-codeql-starter\ql\java\upgrades
[2021-08-23 10:54:42] [DETAILS] resolve upgrades> Will look for upgrades in D:\codeql\vscode-codeql-starter\ql\javascript\upgrades
[2021-08-23 10:54:42] [DETAILS] resolve upgrades> Will look for upgrades in D:\codeql\vscode-codeql-starter\ql\python\upgrades

Query d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\demo.ql expects database scheme D:\codeql\vscode-codeql-starter\ql\java\ql\src\config\semmlecode.dbscheme, but the current database has a different scheme, and no database upgrades are available. The current database scheme may be newer than the CodeQL query libraries in your workspace.

Please try using a newer version of the query libraries. (codeQL.runQuery)
Error: Query d:\codeql\learning-codeql\codeql-java-vul\codeql-jdk\demo.ql expects database scheme D:\codeql\vscode-codeql-starter\ql\java\ql\src\config\semmlecode.dbscheme, but the current database has a different scheme, and no database upgrades are available. The current database scheme may be newer than the CodeQL query libraries in your workspace.

Please try using a newer version of the query libraries.
    at reportNoUpgradePath (c:\Users\Samny\.vscode\extensions\github.vscode-codeql-1.5.3\out\run-queries.js:281:11)
    at compileNonDestructiveUpgrade (c:\Users\Samny\.vscode\extensions\github.vscode-codeql-1.5.3\out\run-queries.js:294:9)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Object.compileAndRunQueryAgainstDatabase (c:\Users\Samny\.vscode\extensions\github.vscode-codeql-1.5.3\out\run-queries.js:463:26)
    at compileAndRunQuery (c:\Users\Samny\.vscode\extensions\github.vscode-codeql-1.5.3\out\extension.js:320:26)
    at ctx.subscriptions.push.commandRunner_1.commandRunnerWithProgress.title (c:\Users\Samny\.vscode\extensions\github.vscode-codeql-1.5.3\out\extension.js:365:121)

I am using codeql cli on Ubuntu with version 2.5.9

@SummerSec
Copy link
Author

Can you please check if a similar configuration on Linux allows you to build jdk8u?

ok,thinks!

@SummerSec
Copy link
Author

I replaced the database configuration file inside vscodeq-codeql-start below, and I don't have any problems.

1629687959409

@Marcono1234
Copy link
Owner

Marcono1234 commented Aug 23, 2021

Ah you are using the https://github.com/github/vscode-codeql-starter workspace. You might have to update the ql Git submodule of that workspace by running:

git submodule update --remote --merge

This will update the ql submodule to the latest changes from https://github.com/github/codeql.
Afterwards you should hopefully not see any errors anymore. Please let me know if that worked for you.

@Marcono1234 Marcono1234 added question Further information is requested awaiting-response Issue or pull request on which the response of the author is expected labels Aug 23, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
awaiting-response Issue or pull request on which the response of the author is expected question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants