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

please add bear package. #7411

Closed
anlexN opened this issue Sep 14, 2020 · 11 comments
Closed

please add bear package. #7411

anlexN opened this issue Sep 14, 2020 · 11 comments

Comments

@anlexN
Copy link

anlexN commented Sep 14, 2020

bear, i need it very much to generates a compilation database

@lazka lazka transferred this issue from msys2/msys2.github.io Dec 8, 2020
@Biswa96
Copy link
Member

Biswa96 commented Dec 8, 2020

Is it possible to compile that project in Windows? The docs only mention Unix-like environment.

@kimim
Copy link

kimim commented Sep 17, 2021

come across compilation error :(

Bear\source\libsys\source\Os.cc:49:2: error: #error "System call "confstr" not exists."
   49 | #error "System call "confstr" not exists."
      |  ^~~~~

@1480c1
Copy link
Contributor

1480c1 commented Sep 17, 2021

Loosely looking at it, it seems it calls confstr with _CS_PATH, which would be A value for the PATH variable which indicates where all the POSIX.2 standard utilities can be found., so I am curious if we can just return the windows path to the /usr/bin dir of msys2, but I'm also not sure due to that constraint if bear should be in MINGW-packages and I think it might be better off in MSYS2-packages

@rizsotto
Copy link

Hi, I am the author of Bear. Just wanna say that I am happy to merge changes to support MSYS2. Or would start to add a CI job to the existing Bear jobs, which runs on MSYS2. (I just have no experience on the platform to set it up) That would help here to catch problems on the upstream.

@FrostKiwi
Copy link

Sry to cross contaminate issues, though this might be a good place to ask...
...whilst working on this issue: rizsotto/Bear#431 I question came up for me:
The docs state: All the other environments inherit from the MSYS environment and add various things on top. This obviously refers to the actual binaries and programs provided, but by my logic it does not extend to includes (.h, .hpp) and libraries (.lib or .a, .so or .dll).
So if I compile something in the MinGW64 environemnt, then the MSYS2 includes are not seen. Is my understanding correct?

@mati865
Copy link
Collaborator

mati865 commented Nov 28, 2021

Correct, compilers from MINGW64 environment will look only for /mingw64/include unless there is a bug (like hardcoded /usr/include) somewhere.

@FrostKiwi
Copy link

@mati865 Thx for confirming!
Whilst I'm at it... as seen in rizsotto/Bear#431 (comment) an obstacle to making Bear work in MSYS with the MinGW64 environment is the lack of posix fork() and the corresponding spawn.h.
Am I also correct with the following thought train? Are the following points correct or a misunderstanding by me? Especially facts marked with (?) are a bit of a guess by me:

  • The MinGW64 environment does not get you posix fork(), since MinGW64 is a Windows native toolchain.
  • The MSYS environment does(?) give you posix fork(), since MSYS is based on Cygwin, which emulates these posix style calls. However there is no spawn.h and you have to include something else(?) to get posix style fork() in the MSYS environment.
  • Since Bear is a tool mainly for the step of programming and compilation, it does not need to be Windows native and should(?) be built within the MSYS environment as suggested by @1480c1 please add bear package. #7411 (comment)

@mati865
Copy link
Collaborator

mati865 commented Nov 28, 2021

The MinGW64 environment does not get you posix fork(), since MinGW64 is a Windows native toolchain.

👍🏻

The MSYS environment does(?) give you posix fork(), since MSYS is based on Cygwin, which emulates these posix style calls. However there is no spawn.h and you have to include something else(?) to get posix style fork() in the MSYS environment.

I don't know, I don't build packages for MSYS2.

Since Bear is a tool mainly for the step of programming and compilation, it does not need to be Windows native and should(?) be built within the MSYS environment as suggested by 1480c1

Native tools are preferred when possible but it doesn't seem doable here so I think it should be ok.

@Biswa96
Copy link
Member

Biswa96 commented Jan 1, 2023

It seems that Bear project does not support native Windows platform (as mentioned in previous comments). I have tried to build it and got many *nix like build errors in mingw

Bear/source/libsys/include/libsys/Signal.h:39:9: error: 'pid_t' does not name a type
   39 |         pid_t pid_;
      |         ^~~~~
Bear/source/libsys/source/Signal.cc: In function 'constexpr bool {anonymous}::shall_forward(int)':
Bear/source/libsys/source/Signal.cc:30:18: error: 'SIGKILL' was not declared in this scope; did you mean 'SIGILL'?
   30 |             case SIGKILL:
      |                  ^~~~~~~
      |                  SIGILL
Bear/source/libsys/source/Signal.cc:31:18: error: 'SIGCHLD' was not declared in this scope
   31 |             case SIGCHLD:
      |                  ^~~~~~~

So, it can not be added here, I guess. Native Windows programs are preferred. Feel free to open this when the project will support it.

If cmake is used in a project, set CMAKE_EXPORT_COMPILE_COMMANDS variable and cmake will generate compile_commands.json in build directory.

@Biswa96 Biswa96 closed this as completed Jan 1, 2023
@FrostKiwi
Copy link

FrostKiwi commented Jan 1, 2023

So, it can not be added here, I guess. Native Windows programs are preferred. Feel free to open this when the project will support it.

Ohh, I thought an issue may be added as a suggestion here, even if the package does not compile yet. Sry for making you go down this rabbit hole^^ edit: Ohh just noticed, I didn't create this issue :D

Just some info to document the state as of Bear on 2023.01.01:

  • all compile errors are diagnosed and most were solved in Nov 21 by @rizsotto : Bear not building on MinGW64 rizsotto/Bear#431
  • With the exception of one, spawn.h is used, but does not exist in MinGW64: Bear not building on MinGW64 rizsotto/Bear#431 (comment)
  • To solve this, the spawn system calls should be replaced with fork + child, but no one found time to do so yet
  • Just checked, interestingly, there is a mingw64/include/glib-2.0/glib/gspawn.h but I don't know if it's valid or not...
  • The workarounds are using clang's -MG flag (But the generated json files have to be merged, not done automatically), using CMAKE, as suggested by @Biswa96 or writing the a project wide list of flags, as supported in .ccls by CCLS or compile_flags.txt by clangd
  • Finally, many text editors have this built in to get basic Linting and LSP support going. Eg. in VScode you may provide the include paths and compiler -DVARIABLES in the GUI to get Linting and LSP support going

@Biswa96 Wow, Morning of January 1st... I guess your new year's resolution is to solve stale Github issues :P

@Biswa96
Copy link
Member

Biswa96 commented Jan 1, 2023

I guess your new year's resolution is to solve stale Github issues :P

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants