lwthiker / curl-impersonate

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox
MIT License
3.45k stars 229 forks source link

compile error on boringssl - [-Werror,-Wunused-but-set-variable] #213

Open ChinW opened 6 months ago

ChinW commented 6 months ago

i am trying to compile the library from apple/M1 chip, but keep getting below error about boringSSL, i wonder if there is any pointer here, tried to search around but didnt get a quick shot yet.

# See https://everything.curl.dev/source/build/tls/boringssl
mkdir -p lib
ln -sf ../crypto/libcrypto.a lib/libcrypto.a
ln -sf ../ssl/libssl.a lib/libssl.a
cp -Rf ../include .
-- The C compiler identification is AppleClang 15.0.0.15000040
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Perl: /usr/bin/perl (found version "5.30.3")
-- The ASM compiler identification is AppleClang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/gcc
-- Configuring done (1.8s)
-- Generating done (0.5s)
-- Build files have been written to: /curl-impersonate/build/boringssl/build
[189/424] Building C object crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o
FAILED: crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o
/usr/bin/gcc -DBORINGSSL_IMPLEMENTATION -Icurl-impersonate/build/boringssl/third_party/googletest/include -I/curl-impersonate/build/boringssl/crypto/../include -Wno-unknown-warning-option -Wno-stringop-overflow -Wno-array-bounds -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -Wshadow -ggdb -Wall -fvisibility=hidden -fno-common -Wnewline-eof -fcolor-diagnostics -Wimplicit-fallthrough -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -D_XOPEN_SOURCE=700 -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -fPIC -MD -MT crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o -MF crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o.d -o crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o -c /curl-impersonate/build/boringssl/crypto/x509/t_x509.c
/curl-impersonate/build/boringssl/crypto/x509/t_x509.c:321:18: error: variable 'l' set but not used [-Werror,-Wunused-but-set-variable]
    int ret = 0, l, i;
ChinW commented 6 months ago

seems also related to https://github.com/lwthiker/curl-impersonate/issues/201

will give a try

infostud commented 5 months ago

Also occurs with FreeBSD and clang. Work around is to correct the source code and remove the unused variable 'l' It is declared, on the left of an assignment operation, and l-- decremented in two locations. Its value isn't used anywhere. There are more errors unfortunately.

lwthiker commented 4 months ago

@ChinW @infostud It would be great if you could test #217 to see if the compilation errors are solved on your machines.