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

Error when building from source (Native Build) on Linux Mint: FAILED: ssl/CMakeFiles/ssl.dir/extensions.cc.o #81

Open
presentformyfriends opened this issue Oct 27, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@presentformyfriends
Copy link

Followed Native build instructions for Ubuntu (I am running Linux Mint 21.3 Virginia). When I run make chrome-build I get the following:

FAILED: ssl/CMakeFiles/ssl.dir/extensions.cc.o 
/usr/bin/g++ -DBORINGSSL_IMPLEMENTATION -I/home/user/curl-impersonate/build/boringssl/include -Werror -Wformat=2 -Wsign-compare -Wwrite-strings -Wvla -Wshadow -Wtype-limits -ggdb -Wall -fvisibility=hidden -fno-common -Wno-free-nonheap-object -Wimplicit-fallthrough -Wformat-signedness -Wmissing-declarations -fno-exceptions -fno-rtti -O3 -DNDEBUG -fPIC -std=gnu++14 -MD -MT ssl/CMakeFiles/ssl.dir/extensions.cc.o -MF ssl/CMakeFiles/ssl.dir/extensions.cc.o.d -o ssl/CMakeFiles/ssl.dir/extensions.cc.o -c /home/user/curl-impersonate/build/boringssl/ssl/extensions.cc
/home/user/curl-impersonate/build/boringssl/ssl/extensions.cc: In function ‘bool bssl::ssl_set_extension_order(bssl::SSL_HANDSHAKE*)’:
/home/user/curl-impersonate/build/boringssl/ssl/extensions.cc:3374:16: error: ‘ext_index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 3374 |     order[idx] = ext_index;
cc1plus: all warnings being treated as errors
[7/56] Building CXX object ssl/CMakeFiles/ssl.dir/ssl_transcript.cc.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:167: /home/user/curl-impersonate/build/boringssl/build/lib/libssl.a] Error 1

Googling the error messages has produced nothing for me.

@sohaib17
Copy link

sohaib17 commented Nov 1, 2024

The problem seems to be in the BoringSSL patch

+  while (ext != nullptr) {
+    unsigned ext_index;
+    tls_extension_find(&ext_index, atoi(ext));

unsigned ext_index should be initialized here.

Setting it to unsigned ext_index = 0; in chrome/patches/boringssl.patch:94 worked and build completed successfully but not sure if it is a valid initial value.

@ghost ghost mentioned this issue Nov 6, 2024
@lexiforest lexiforest self-assigned this Dec 2, 2024
@lexiforest lexiforest added the bug Something isn't working label Dec 2, 2024
@EZaykov
Copy link

EZaykov commented Dec 19, 2024

So it that a correct fix or no? Anyone know?

@Schievel1
Copy link

So it that a correct fix or no? Anyone know?

yes it is. -Werror-maybe-initialized is only sometimes a problem. In this case the declared memory for ext_index is only used as a placeholder for tls_extension_find to fill, but the compiler could not figure out if tls_extension_find actually reads the value of ext_index.
Giving it a dummy value just to please the compiler is the correct way to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants