-
Notifications
You must be signed in to change notification settings - Fork 9
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
IntelliSense doesn’t work correctly with M1 macs #10
Comments
It looks like I might be able to do this automatic using: https://stackoverflow.com/questions/65146751/detecting-apple-silicon-mac-in-javascript If there are problems I could do the same thing as I do with the c++14 standard setting where you can set it in the extension settings to force it. |
I released a potential fix. Let me know if it fixes the problem. You can check the extension logs to see what it shows. If the fix still doesn't work you can post it here:
|
@boocs you rock. I will check with the students as I don't have the machine. Thanks for making a patch so quickly. |
The compiler path definitely needs to be set to |
I'll probably do a path setting that puts whatever path you want in the c_cpp_properties.json. Would that work? I know on Windows, to get clang to work, I also have to change the compiler paths in the compile commands file as well. |
It just needed I assumed it would already be set to that on macOS as clang (specifically Apple Clang) is the native compiler on macOS. So it's a bit odd that it's set to g++. |
Ok, thanks for the info! |
I updated the extension so it automatically includes the correct compiler path in c_cpp_properties for Mac M1. You can also modify the path in the extension settings if the path needs to be modified. Unfortunately for this release I updated dependencies(security) so for some reason it made the extension only support the latest release of VSCode 1.63.1. Hopefully it's not that big a deal. If you want to test this for me, after you install the new update close VSCode. Then right click on your project's uproject file and choose Generate Visual Studio Project Files... This will reset your project's VSCode config. Open VSCode for my extension to attempt to fix. Mac M1 users shouldn't have to change anything for it to fix it, unless you need to force c++14. You can do that in the extension settings. |
I don't have an M1 mac so I'm unable to test, unfortunately. |
I just started working with unreal engine on Mac and I am still having the IntelliSense issues where the includes errors will still exist, along with the library of IntelliSense being incomplete. Here is the message I got from the fixes plugin output.
One thing to note is when I try right-clicking on my uproject file on mac, I get no option to generate the vscode files. The only way I am able to do this is by refreshing the vscode project file within the unreal engine editor itself. |
First thing is you should change it back to force C++14. I only have the C++17 option there because if you have the full source you can add a C++17 flag to force UE to compile with it. The right-click thing is weird but you can run this command inside VSCode itself. You need to have the Microsoft C# extension installed with the correct things installed. Not sure if MacOS can or not though. The C++14 fix probably isn't the bug though. I have been running into a bug where the *.generated.h files path isn't being added to the *.rsp file. I'm not sure which option you choose when Building when, in VSCode, you choose Terminal->Run Build Task...? I choose MyProjectNameEditor (note the Editor suffix) and also Win64 Development Build. If *.generated.h files don't get created choose Rebuild. The bug comes with the Intellisense *.rsp files the compile command uses. The *.generated.h directory won't be included in the list of include paths. After you Build, creating genrated.h, you'll have to run Generate Project Files again to add the *.generated.h path to the rsp files. Edit: I am looking into a warning and fix for this. |
I've tested this and it seems correct. You have to Build with the Editor suffix and then Generate Project Files to fix the Intellisense bugs. This is how I usually build. With editor suffix and Development. I don't know if Win64 is different on Mac but just choose whatever is appropriate. I forgot to mention you can also Refresh Visual Studio Project in the Tools menu of UE5. So if you can Build and Run your project then you can also refresh your project. If you can it's more convenient to do it from VSCode though: |
It also could be that the extension automatically sets the M1 compiler path to /usr/bin/clang yet in the log it says the compile command uses /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ You can force the compiler path, in my extension settings, so that everything will use: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ or set it to whichever clang path you want. |
Whoa, I guess I'm wrong about c++14. UE5 now uses c++17 stuff? I had an error in one of my project files about align_val_t not being in namespace std and setting Intellisense to c++17 fixed it. Strange that this isn't more widely reported! |
This makes a lot more sense. I thought the /usr/bin/clang was the right path since that is what came up when I type in "where clang" in my terminal. Thank you for all of the other advice, especially since I didn't know you could generate project files within the visual studio code itself. I am experimenting with different platforms for creating AR content for work, so I will let you know when I end up testing it again and see if the fixes you suggested worked. |
Sorry for the spam. Last one! I forgot to mention in my extension it's the 'strict path' setting you have to enable. With it enabled, my extension's path setting will be copied over to the compile command files. |
Well, I tried building to mac, generating new files, and setting the clang compile path to be different things still with no luck, along with changing several c++ extension settings. I am thinking I might just use the unreal engine on my windows laptop instead since this has been giving me so many problems. Was just hoping to have it work on the M1 macs since that is what all of my colleges use. |
Can you post a pastebin link of some c++ logs? You don't need to sign up: https://pastebin.com/ Switch to one of your project's cpp files that's giving an error. Now go to VSCode's Command Palette and type Log and choose this option: Select all the text, from the log, and paste it into pastebin and post the link. Note: Some paths may contain your name so if you want to copy it into a word processor and find/replace your name then you should do that first. |
https://pastebin.com/mW7kbngz Here you go, hopefully it helps. Appreciate you taking the time to look into this. |
I guess I'll remember to do the diagnostic earlier. Looking at the pastebin it shows the wrong c++ standard. In my extension's settings force the cpp standard to c++14 for UE 4.2# and force it to c++17 for UE 5.0+ Hopefully that's the only thing wrong! |
I just tried setting it to c++17 and c++14 on your extensions settings but neither of them fixes the issues I am having. I check the logs after I generate project files and then restart vscode. One thing I notice is that cStandard stays at c17 regardless of when I set it to cpp 14 or 17. Unsure if it is related to the issues or not. |
After I force c++ 17, all of the cpp standard variables switched to c++ 17 as intended. I created the template using the AR example to test see if building AR apps on mac would work well for us. It didn't give an option to create the project using c++, so I assume it started off with just blueprints? I later then generated a random character c++ document to test to see if IDE would work well with unreal c++ code. And yes, UnrealARTest is the name of the project. I have also created a c++ project using the FPS base to test to see if it would work better, but I got the same results. Also, I actually didn't strip out the included paths, the log I showed you is what I got. Do I need to manually add all of the include paths from the engine and where would I find those? Here is the Pastebin of a new project I created with the FPS c++ template https://pastebin.com/eyCTcJiE and here are the contents of the Build.cs file for this project
|
Thanks for the info! The log says it's using: Open that file up and go to the entry for CPPTestProjectile.cpp and paste the 'command:' for that entry here. The command should have a compiler path listed and an @path with an *.rsp file. |
Here is the command I got for CPPTestProjectile.cpp
and here is that pastebin for that rsp file https://pastebin.com/WpePMn6b |
Up above in your new log it says it's using "intelliSenseMode": "macos-clang-arm64" which is correct. Down farther is says it's really going to use IntelliSense Mode: macos-clang-x64 which is wrong. (in your previous version both were correct) My extension should automatically set the correct "intelliSenseMode" for M1 macs.
|
So just to be sure, you've closed/reopened VSCode and reran the log command and it still shows the wrong intellisense mode? The only thing I see is that the ops link above does show that they changed the compiler path to /usr/bin/clang to fix the m1 mac problem. You can leave out enabling the extensions strict path setting for now. Just see if changing the setting affects the log's 2nd intellisense mode. You can also try /usr/bin/clang++ and check again. Edit: I use clang++ on Window but try clang as well. If both don't work you can try forcing both compiler paths but with the strict setting. Just remember that if you use the strict setting and want to revert back you'll have to Generate Project Files. There is another way to get real time logs for the C++ extension. Maybe it'll show why it's reverting the intellisense mode. I'll put the info on how to do it in a separate post. |
Thanks for telling me all of these steps for setting up the proper way to send the logs. I ended up trying both /usr/bin/clang and /usr/bin/clang++, both toggling the force paths on and off for them while also generating the project files again and reloading vscode. Here is the pastebin of the log |
Yeah the log shows the correct Intellisense mode. It still shows that it's not reading the rsp file from the compile commands file. For the previous test I meant to do these four tests. You don't have to give logs for each. Just see if any of the settings below fixes anything. After changing each setting, make sure to restart VSCode, and open CPPTestProjectile.cpp, and wait for the default Intellisense, fire symbol, to disappear. |
I have tried all of these, and they haven't worked for me. After this, I tried compiling some code with just raw c++ with one external library, raylib. The strange thing about it was that while the IDE said that the library file could not be found, it was possible to find the definition of those classes within that h file, and then it had the specific IntelliSense working for that library. So that made me think that maybe all external libraries are not being recognized by the IDE. As I tried it with Unreal, I tried hovering over variables but it would just show them as "error types" like this. < error-type > ProjectileMovement |
You do have the mac framework path in the c_cpp_properties.json so it should be working. Pretty strange. Maybe there's some .NET SDK that needs to be installed that wasn't? Is this your first time using the Unreal Engine? One thing you did is you forgot to include your Tag Parser logs from these instructions #10 (comment) Here's an example what both should look like: I'm using Clang 12 on Windows and I mimicked your project: One thing that might have been lost above was to make sure to try a Rebuild Make sure it has the 'Editor' suffix and it's the 'Development' config. 'Win64' will probably be different for you.
It seems like it's not reading the rsp file and this extension does modify the rsp line:
This extension adds escape quotes to the compiler path \"
You'd think more M1 Mac users would be complaining if this was the case though.
Maybe your MacM1/Clang version doesn't like the spaces for the -I flag in your rsp file. You can try a find/replace to test this. Note: I have spaces and use Clang 12 and it works. Jut replace all -I " with -I" -I "/Users/Shared/Epic Games/UE_5.0/Engine/Source" The Clang docs show it with no space |
Needed to take a break from trying to get unreal engine to work on mac to work on some 3D art, but after trying some of my own stuff, I finally got it to work today! The engine automatically tries to set up project directories with spaces in them, so I decided to start fresh, remove all of the sample projects and create a new, fresh project again but making sure that the directory was UnrealProjects instead of Unreal Projects. Surprisingly enough doing this got IntelliSense to work. |
@ElDuderini Weirdly I didn't get notification of your latest message. |
I released a new version 3.4.0. I also rented a cloud M1 Mac to test. All I had to do was set the extension's path to /usr/bin/clang++ and I also forced a c++ standard and Intellisense worked. There is some problem with Intellisense when first booting VSCode. It's very slow trying to get compiler defaults from clang. After that though Intellisense seems to work as normal. I'm going to close this. Feel free to open another post if you have any more problems. |
IntelliSense doesn’t work correctly with M1 macs as seen here
https://community.gamedev.tv/t/after-install-intellisense-fix-getting-worse/181116/26
The following post describes how to fix it.
Presumably all that’s really needed is to set the IntelliSense mode in the c_cpp_properties.json to
“macos-clang-arm64”
A very quick gander, it looks like they’re already doing something with it.
https://github.com/boocs/ue4-intellisense-fixes/blob/master/src/extension/fixes/compilerPath.ts#L151-L165
The text was updated successfully, but these errors were encountered: