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

Cannot open include file: 'pthread.h' #11596

Open
daprose-dotcom opened this issue May 28, 2023 · 28 comments
Open

Cannot open include file: 'pthread.h' #11596

daprose-dotcom opened this issue May 28, 2023 · 28 comments

Comments

@daprose-dotcom
Copy link

Bug Description

While compiling, I get this error message. How do I solve this problem?

fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

Version

2.3.5

OS

Windows 10, Visual Studio Community 2019

@ronso0
Copy link
Member

ronso0 commented May 28, 2023

Not a Mixxx issue.

@ronso0 ronso0 closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2023
@daschuer daschuer reopened this Jun 5, 2023
@daschuer
Copy link
Member

daschuer commented Jun 5, 2023

@ikr83 has reported the same issue here: #11621 (comment) Even if we know that it works if all is "correctly" configured it seems to be hard to find out what is correct.
Maybe it is possible to fail with a better message or make is work instantly.

@daschuer
Copy link
Member

daschuer commented Jun 5, 2023

Related:
#11597

@ikr83
Copy link

ikr83 commented Jun 5, 2023

I followed instructions here ...

https://github.com/mixxxdj/mixxx/wiki/Compiling%20on%20Windows
#11597

... and it works even if I didn't understand everything.

@daschuer
Copy link
Member

daschuer commented Jun 5, 2023

Fine, now it is working. Can you reproduce your original issue? My idea is to make it initially work for new contributors or at least give less obscure error messages.

@ikr83
Copy link

ikr83 commented Jun 5, 2023

The biggest difference is that I used CMake directly from VS2019 instead of using the command line method.

To be more specific:

At the beginning,

Download Visual Studio Community
https://aka.ms/vs/16/release/vs_community.exe

1-Visual Studio Install Detail
I didn't start VS2019 after installation.

Download Rust + Install
https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe

Installation sccache
CMD + cargo install --git https://github.com/Be-ing/sccache.git --branch fix_msvc_fp

Download Mixxx source code
GitHub mixxxdj/mixxx

I tried with this code first:
https://github.com/mixxxdj/mixxx/releases/tag/2.3.5

Then I tried with this code:
https://github.com/mixxxdj/mixxx/archive/refs/heads/main.zip

Same results at the end...

Download + UNZIP code

Download buildenv
x64 Native Tools Command Prompt for VS 2019

mixxx/tools/windows_buildenv.bat

Visual Studio

Open a local folder "mixxx folder"

Change the configuration and wait for CMake to finish each time:
x_64 legacy
x_64 native
x_64 off
x_64 portable

Press CTRL+SHIFT+B to generate everything.

After that, I can load Mixxx/build from the portable folder, but I can't find the Windows installer. The portable version of Mixxx works with my default preinstalled settings folder.

Originally, everything started from bug #11621.
So, I tried a third time after I overwrote the autodjprocessor.cpp in the Mixxx 2.3.5 code source folder.
https://github.com/mixxxdj/mixxx/blob/c03d885e975d342f38dae22efde7b2cd21d5a3d9/src/library/autodj/autodjprocessor.cpp
I regenerated to test and it works without the bug #11621. :)

During CMake, I saw error messages appearing, but they did not halt the generation process. However, only the "portable" folder contains a mixxx.exe executable. Maybe this is normal, I'm not sure...

x_64_portable cmake sortie.txt

@ikr83
Copy link

ikr83 commented Jun 5, 2023

In build/portable some folders are missing. There is juste the script folder in fact

Few dll doesn't appear into my build/portable folder but appear in my "program files"

DLL

These dll appear into my build/portable folder but doesn't appear in my "program files"
Qt5Test.dll

@daschuer
Copy link
Member

daschuer commented Jun 6, 2023

The x_64_portable.cmake.sortie.txt looks good.
It should fail when something is missing. It looks like this was not the case in you very fist attempt.

Can you remember what was the issue? Maybe you could remember what you did and reproduce this in a fresh build directory?

In your current build we have two minor issues:

  • The installer can be generated manually:cpack -G WIX
    Where did you expect to find these information? How did you original expect it should work?
  • If you plan to start contributing, it is mandatory to use git. So instead if unzipping an archive, follow
    https://github.com/mixxxdj/mixxx/wiki/Bugfix-Workflow

@ikr83
Copy link

ikr83 commented Jun 6, 2023

**What didn't work for me

Use Windows Command line (instead of VS2019) + don't install rust + install sccache with scoop

**What worked better

Download Rust + Install
https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe

Installation sccache
CMD + cargo install --git https://github.com/Be-ing/sccache.git --branch fix_msvc_fp

Use VS2019 to build


First time I build, so I didn't expect anything ... I knew cpack is necessary to generate a package but I didn't know how to use it.
Now I know the theory. :)

I'm not ready to start contributing for the moment but I will because I want to add the option to use a custom settings folder.

If during the installation of Mixxx, I can choose the folder where I place my configuration files, then I will place them in a folder connected to the cloud so that I can use Mixxx with different computers. Currently, I use robocopy and it works well, but it's still a makeshift solution.

Next Episode... :)

Thanks a lot, I'll read the Bugfix Workflow.

@daschuer
Copy link
Member

daschuer commented Jun 6, 2023

Ok, thank you. I will have a look how to improve this.
A early error when you are not in the right terminal will help a lot I think.

I want to add the option to use a custom settings folder.

This can already be done with a modified link on the desktop. You can add there any '--settingsPath` not sure if the database file itself works from a cloud though.

A solution that makes this feature more discoverable would be a nice addition.

@ikr83
Copy link

ikr83 commented Jun 7, 2023

Hi,

I haven't given up, I retried everything and I still can't build.

I reinstalled a clean environment
Visual Studio 2019 (C++) + Python + Git + Rustup + Sccache
I'm sharing a video of my command line procedure.
I don't see why it's not working...

VS2019.mp4

:/

@ikr83
Copy link

ikr83 commented Jun 7, 2023

CMakeError.log

@ikr83
Copy link

ikr83 commented Jun 7, 2023

If a make a second "cmake .." just after the first one, there is less errors.
CMakeError.log

And the error at the end "cmake --build ." become:
..\src\controllers\bulk\bulkcontroller.cpp(55): error C2061: erreur de syntaxe: identificateur 'u_int8_t'
..\src\controllers\bulk\bulkcontroller.cpp(58): error C2065: 'id': identificateur non dclar
..\src\controllers\bulk\bulkcontroller.cpp(59): error C2065: 'id': identificateur non dclar
..\src\controllers\bulk\bulkcontroller.cpp(69): error C2660: 'get_string': la fonction ne prend pas 2 arguments
..\src\controllers\bulk\bulkcontroller.cpp(55): note: voir la dclaration de 'get_string'
..\src\controllers\bulk\bulkcontroller.cpp(70): error C2660: 'get_string': la fonction ne prend pas 2 arguments
..\src\controllers\bulk\bulkcontroller.cpp(55): note: voir la dclaration de 'get_string'
..\src\controllers\bulk\bulkcontroller.cpp(68): error C2512: 'Controller::Controller': aucun constructeur par dfaut appropri disponible
..\src\controllers\bulk\bulkcontroller.cpp(78): error C2660: 'get_string': la fonction ne prend pas 2 arguments
..\src\controllers\bulk\bulkcontroller.cpp(55): note: voir la dclaration de 'get_string'
..\src\controllers\bulk\bulkcontroller.cpp(79): error C2660: 'get_string': la fonction ne prend pas 2 arguments
..\src\controllers\bulk\bulkcontroller.cpp(55): note: voir la dclaration de 'get_string'
..\src\controllers\bulk\bulkcontroller.cpp(80): error C2660: 'get_string': la fonction ne prend pas 2 arguments
..\src\controllers\bulk\bulkcontroller.cpp(55): note: voir la dclaration de 'get_string'
ninja: build stopped: subcommand failed.

@ikr83
Copy link

ikr83 commented Jun 7, 2023

Here's a CHATGPT analysis of the specific errors:

\src\controllers\bulk\bulkcontroller.cpp(55): error C2061: syntax error: identifier 'u_int8_t'
This error indicates a syntax problem with the identifier 'u_int8_t'. Make sure you have included the necessary headers to declare this type.

\src\controllers\bulk\bulkcontroller.cpp(58): error C2065: 'id': undeclared identifier
This means that the variable 'id' has not been declared before it is being used. Check if you have properly declared and initialized all the required variables.

\src\controllers\bulk\bulkcontroller.cpp(69): error C2660: 'get_string': function does not take 2 arguments
This error suggests that you are calling the 'get_string' function with an incorrect number of arguments. Make sure you are calling the function with the appropriate arguments according to its signature.

\src\controllers\bulk\bulkcontroller.cpp(68): error C2512: 'Controller::Controller': no appropriate default constructor available
This error indicates that there is a missing appropriate default constructor for the 'Controller' class. Ensure that you have defined a default constructor for this class or use an existing constructor correctly.

\src\controllers\bulk\bulkcontroller.cpp(78): error C2660: 'get_string': function does not take 2 arguments
This error is similar to error 3. Make sure you are calling the 'get_string' function correctly with the required arguments.

@daschuer
Copy link
Member

daschuer commented Jun 7, 2023

Cool, I consider your build correctly configured. During the first cmake run it probes various things where some are failing.
This is OK if cmake has a workaround and finishes the configuration request without a fatal error.
In the second run, cmake reads the results form CMakeCache.txt, without probing again.

The issue with "u_int8_t" looks like a typo. I have no idea why our CI did not detect it. Try to use uint8_t instead.
I will prepare a Pull request.

@daschuer
Copy link
Member

daschuer commented Jun 8, 2023

Please pull my patch and check if anything else is failing:

git pull https://github.com/daschuer/mixxx.git u_int

@ikr83
Copy link

ikr83 commented Jun 8, 2023

I fix u_int8_t, the build completes successfully, I start mixxx.exe and it works!

:D


Next step,
I run cpack. cpack alerts me that NSIS is missing, so I install NSIS. I restart cpack.

In VS2019
CPack Error: Problem running NSIS command: "C:/Program Files (x86)/NSIS/makensis.exe" "C:/Users/david/Desktop/mixxx/build/_CPack_Packages/win64/NSIS/project.nsi"
Please check C:/Users/david/Desktop/mixxx/build/_CPack_Packages/win64/NSIS/NSISOutput.log for errors
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: mixxx

In NSISOutput.log
File: "C:/Users/david/Desktop/mixxx/res/images/mixxx_install_logo.bmp" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in macro MUI_HEADERIMAGE_INIT on macroline 25
Error in macro MUI_GUIINIT on macroline 3
Error in macro MUI_FUNCTION_GUIINIT on macroline 4
Error in macro MUI_INSERT on macroline 11
Error in macro MUI_LANGUAGE on macroline 14
Error in script "C:/Users/david/Desktop/mixxx/build/_CPack_Packages/win64/NSIS/project.nsi" on line 571 -- aborting creation process

I can see mixxx_install_logo.bmp in my explorer...

project.nsi" on line 571
!insertmacro MUI_LANGUAGE "English" ;first language is the default language


I delete the _CPack_Packages folder, and I remember you had advised me to use "cpack -G WIX," but I don't have WIX installed.
I install .NET SDK (7.0).
I install Wix.
dotnet tool install --global wix.
I verify by checking the version: wix --version.
It's okay (4.0.1+6e6eb478).

CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/Internal/CPack/CPackWIX.cmake:12 (message):
Could not find the WiX candle executable.

I run cpack -G WIX

CPack Error: Error while executing CPackWIX.cmake
CPack Error: Fatal WiX Generator Error
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: mixxx

I think there is a problem with new Wix Version
https://wixtoolset.org/docs/fourthree/
"A lot about WiX has changed between v3 and v4"

"For command-line afficionados, most executables have been merged into a single wix.exe tool with commands. For example, in WiX v3, you might build by calling Candle.exe one or more times to compile your authoring and then calling Light.exe to link and bind the compiled authoring into an .msi package. In WiX v4 using wix.exe, that's one command: wix build -o product.msi product.wxs."

:/

@JoergAtGithub
Copy link
Member

The issue with "u_int8_t" looks like a typo. I have no idea why our CI did not detect it.

This is because this affects only bulkcontroller.cpp and the Windows CI builds are with BULK=OFF.

@daschuer
Copy link
Member

daschuer commented Jun 8, 2023

Is that correct? I think we should as as align our home builds with the CI defaults.

@daschuer
Copy link
Member

daschuer commented Jun 8, 2023

cpack alerts me that NSIS

Another pitfall, sorry.

Thank you for all the hints. I will take a look.

@JoergAtGithub
Copy link
Member

JoergAtGithub commented Jun 8, 2023

Yes, because BULK USB can't be used for security reasons without installing additional drivers on Windows, it's not useable for normal users.
The CMakeSettings.txt and CI are in sync. If you compile from command line, you need to specify these yourself.
The real solution is using CMake Presets instead of CMakeSettings.txt, because these can be used from commandline, CI and IDE builds and work accross all platforms.

@daschuer
Copy link
Member

daschuer commented Jun 8, 2023

Presets are very welcome to build different configurations on the same host. This allows a lot more than just "Debug" and Release. We can also auto generate a CMakeUserPreset.json like we currently do with "CMakeSettings.json"

Apart CMake presets, we should also choose reasonable defaults when starting cmake without "--preset"
I think in this case here we need switch off BULK by default.

@ikr83
Copy link

ikr83 commented Jun 8, 2023

Sorry for using the same page to address all my little issues to achieve the build+pack... but since I started, I feel obligated to continue... Regarding my "build issue", changing "u_int8_t" to "uint8_t" was enough... Tonight, I will uninstall Wix 4, install Wix 3, and see if "cpack -G WIX" works better.

@daschuer
Copy link
Member

daschuer commented Jun 8, 2023

This is issue is the perfect place for such things. I expect that there are are number of users suffer like you, but instead of analyzing the issue they give up.

@ikr83
Copy link

ikr83 commented Jun 8, 2023

Oki!

cpack -G WIX with Wix4 doesn't work for me ( because there is the candle issue https://wixtoolset.org/docs/fourthree/ ).
cpack -G WIX works better with WiX Toolset v3.11

Finally

Thank you very much!

@ikr83
Copy link

ikr83 commented Jun 8, 2023

To resume,

Windows environment setup

To build
Install Visual Studio 2019 Community

Visual Studio 2019 Community

Optionnal
Installation of Rustup with the installer
https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
Installation of Sccache with cargo (Rustup)
cargo install --git https://github.com/Be-ing/sccache.git --branch fix_msvc_fp

To make an installer after building
Install WiX Toolset v3.11 (Wix 4 doesn't work because there is a candle issue https://wixtoolset.org/docs/fourthree/)

Run x64 Native Tools Command Prompt for VS 2019

cd c:/users/david/Desktop
git clone https://github.com/mixxxdj/mixxx.git
cd mixxx/tools
windows_buildenv.bat

corrections
#11596 mixxx\src\controllers\bulk\bulkcontroller.cpp (this one is necessary for the building)
#11621 mixxx\src\library\autodj\autodjprocessor.cpp (this one is about the autodj transition isue)

cd ../build
cmake ..
cmake --build .
cpack -G WIX

:D

@daschuer
Copy link
Member

daschuer commented Jun 9, 2023

This means we are done, once the pending PRs are merged?

I am sure the scoop installation of sccache will also work.
Does this mean less hassle compared to the cargo installation? Does cargo build sccache from the source?

Maybe we should describe the scoop way as recommended. @JoergAtGithub what do you think?

sccache is by the way optional, it is strongly recommend for contributors that build different branches though.
For a single branch it has no advantages.

@ikr83
Copy link

ikr83 commented Jun 9, 2023

Indeed, when the source code is up to date, it will be fine! But be careful with the cpack -G WIX command, which requires the installation of WIX v3. The latest version of WIX (v4) doesn't work (candle issue). I don't think Rustup installs from source code (the same goes for Scoop).

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

6 participants