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

Opening an Env must be unsafe #207

Closed
Kerollmops opened this issue Aug 24, 2023 · 3 comments · Fixed by #246
Closed

Opening an Env must be unsafe #207

Kerollmops opened this issue Aug 24, 2023 · 3 comments · Fixed by #246
Labels
breaking A change that is breaking the semver good first issue Good for newcomers
Milestone

Comments

@Kerollmops
Copy link
Member

According to some comments, we should mark the opening of the LMDB environment as unsafe. I found out that most people agree on that, and we could list the issues that opening an environment with memory-mapping could bring by using the official documentation.

@Kerollmops Kerollmops added good first issue Good for newcomers breaking A change that is breaking the semver labels Aug 24, 2023
@Kerollmops Kerollmops added this to the v0.20.0 milestone Aug 24, 2023
@zoo868e
Copy link

zoo868e commented Aug 27, 2023

Hi @Kerollmops, I would like to try this. However, I can't compile the project. Here is the output of cargo check

   Compiling lmdb-master-sys v0.1.0 (/home/matt_jan/heed/lmdb-master-sys)
The following warnings were emitted during compilation:

warning: In file included from /usr/local/include/linux/stat.h:6,
warning:                  from /usr/include/x86_64-linux-gnu/bits/statx.h:31,
warning:                  from /usr/include/x86_64-linux-gnu/sys/stat.h:465,
warning:                  from /home/matt_jan/heed/lmdb-master-sys/lmdb/libraries/liblmdb/mdb.c:102:
warning: /usr/local/include/asm/stat.h:8:10: fatal error: uapi/asm/stat.h: No such file or directory
warning:     8 | #include <uapi/asm/stat.h>
warning:       |          ^~~~~~~~~~~~~~~~~
warning: compilation terminated.

error: failed to run custom build command for `lmdb-master-sys v0.1.0 (/home/matt_jan/heed/lmdb-master-sys)`

Caused by:
  process didn't exit successfully: `/home/matt_jan/heed/target/debug/build/lmdb-master-sys-aca218c1dc508df9/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-Wno-unused-parameter" "-Wbad-function-cast" "-Wuninitialized" "-o" "/home/matt_jan/heed/target/debug/build/lmdb-master-sys-989ea626efd4ffd9/out/e361845b6c5e9f4f-mdb.o" "-c" "/home/matt_jan/heed/lmdb-master-sys/lmdb/libraries/liblmdb/mdb.c"
  cargo:warning=In file included from /usr/local/include/linux/stat.h:6,

  cargo:warning=                 from /usr/include/x86_64-linux-gnu/bits/statx.h:31,

  cargo:warning=                 from /usr/include/x86_64-linux-gnu/sys/stat.h:465,

  cargo:warning=                 from /home/matt_jan/heed/lmdb-master-sys/lmdb/libraries/liblmdb/mdb.c:102:

  cargo:warning=/usr/local/include/asm/stat.h:8:10: fatal error: uapi/asm/stat.h: No such file or directory

  cargo:warning=    8 | #include <uapi/asm/stat.h>

  cargo:warning=      |          ^~~~~~~~~~~~~~~~~

  cargo:warning=compilation terminated.

  exit status: 1

  --- stderr


  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-Wno-unused-parameter" "-Wbad-function-cast" "-Wuninitialized" "-o" "/home/matt_jan/heed/target/debug/build/lmdb-master-sys-989ea626efd4ffd9/out/e361845b6c5e9f4f-mdb.o" "-c" "/home/matt_jan/heed/lmdb-master-sys/lmdb/libraries/liblmdb/mdb.c" with args "cc" did not execute successfully (status code exit status: 1).

There is no directory uapi/asm/stat.h in my laptop, are there any suggestion?

@Kerollmops
Copy link
Member Author

Thank you @zoo868e,

I really don't know. Have you read the README in details and pulled the git submodules?

If so, you are basically trying to compile LMDB. So, you should be looking at discussion mentioning the issue you have.

@zoo868e
Copy link

zoo868e commented Aug 27, 2023

Yes, I had clone the repo recursively and also git submodule update --recursive. Seems is the issue of the LMDB, I'm trying to figure out the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A change that is breaking the semver good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants