OpenIntelWireless / itlwm

Intel Wi-Fi Drivers for macOS
https://OpenIntelWireless.github.io/itlwm/
GNU General Public License v2.0
6.74k stars 643 forks source link

compile with xcode issus (show wifi but not connect) #926

Open alighafourian opened 8 months ago

alighafourian commented 8 months ago

Have You Read Our Docs Yes

Are You Reporting A Bug Yes Environment

Description I download code file and compiler . compile done but show wifi and dosnt connect

Bug Report Archive

Screenshot 2023-10-24 at 12 50 05 Screenshot 2023-10-24 at 12 52 24 Screenshot 2023-10-24 at 12 54 37

kext log: Log_2023-10-24_12-41-37.log

Kext Download Source

ShroomKing commented 8 months ago

Same when building from source with latest Xcode, GitHub release build works fine though.

alighafourian commented 8 months ago

@ShroomKing only way fork on github and run xcode Workflow

diepeterpan commented 8 months ago

I just did a test, downloaded the source, compiled it, and verified the resulting .kext in Sonoma and everything seems fine. Here is a breakdown of how I compiled it. It is just my way, not necessarily the correct way, but it worked :-)

1)    Download and install Xcode from the App Store

2)    Download the latest OpenIntelWireless source If you prefer using Git command line or Desktop app and am comfortable using them then by all means use it to download the source and fork where required

3)    Unzip the source OpenIntelWireless to e.g. itlwm-master



4)    Download the latest MacKernelSDK

5)    Unzip to source to OpenIntelWireless root e.g. itlwm-master PS. Ensure it is named MacKernelSDK image

6)    Now open itlwm.xcodeproj using XCode



7)    Click menu item [Product] and choose [Build] It should build without errors, at least mine did

8)    By default it seems to build itlwm.kext image

9)    To build AirportItlwm change the scheme in the [Product] menu to [AirportItlwm (all)] image

I did test the resulting kext and it is working. image

alighafourian commented 8 months ago

@diepeterpan ok i close issus

ShroomKing commented 8 months ago

I did more tests. This appears to be a compiler code optimisation problem.

When creating a debug build it uses optimisation level 0 and the kext works.

But when creating an optimised build (Release build type / Product->Archive) the kext can't connect to wifi.

The highest optimisation level that works right now is 1, so I assume some flag in level 2 is breaking the code (more info here: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html)

You can disable optimisation flags by using -fno-(flag-name) so for example to disable -falign-functions add -fno-align-functions to CFLAGS, this way we can keep the other optimisations but I don't know if there's a better way to debug this than trying to disable all the flags one by one.

usr-sse2 commented 3 months ago

The highest optimisation level that works right now is 1, so I assume some flag in level 2 is breaking the code (more info here: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html)

It's better to look options in Clang documentation because Xcode compiles with Clang, not GCC.

zxystd commented 3 months ago

The highest optimisation level that works right now is 1, so I assume some flag in level 2 is breaking the code (more info here: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html)

It's better to look options in Clang documentation because Xcode compiles with Clang, not GCC.

@usr-sse2 You are right, but I don't have the time and environment(no Sonoma/new XCode) to investigate this, if you have discoveries please let me know or open an PR, thank you!

zxystd commented 3 months ago

From the log I can see the root issue is that the optimization breaks function ieee80211_get_assoc_req, with invalid assoc request(RSN invalid), for what's the differences I can't see with the decompiled code.

vanyasem commented 3 months ago

@zxystd I can confirm that the issue is resolved with the latest commits. Release builds are now able to connect to Wi-Fi successfully. Tested on Sonoma 14.4

alighafourian commented 3 months ago

@zxystd I can confirm that the issue is resolved with the latest commits. Release builds are now able to connect to Wi-Fi successfully. Tested on Sonoma 14.4

Compile with xcode app If use terminal for build wifi can not connect but show If use xcode app work good