Git Product home page Git Product logo

Comments (13)

briansmith avatar briansmith commented on July 20, 2024

This is what I get when I do cargo build:

warning: [email protected]: cc1.exe: warning: C:\ring-main\ring-main\pregenerated: No such file or directory [-Wmissing-include-dirs]

It looks like you're building ring from source, but not from within a Git checkout. Thus, build.rs doesn't see .git/ and so it is expecting some files in pregenerated/. But they are not there, because they only exist in the package that's uploaded to crates.io.

cargo build

What is the exact command line of cargo build. As you can see in BUILDING.md, you need to set TARGET_CC and TARGET_AR to the correct C compiler.

from ring.

lorenzo-pirchio avatar lorenzo-pirchio commented on July 20, 2024

Everytime I set from cmd:

  • CARGO_TARGET_DIR
  • CC to MinGW\bin\gcc.exe
  • TARGET_CC to xtensa-esp32s3-elf-gcc.exe
  • TARGET_AR to xtensa-esp32s3-elf-ar.exe

And finally I do cargo build.
I changed the dependencies in cargo.toml adding ring={git="https://github.com/briansmith/ring.git", features =[ "less-safe-getrandom-espidf"]} but I have all these warnings.

warning: [email protected]: In file included from C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\include/ring-core/base.h:74,
warning: [email protected]: from C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\include/ring-core/mem.h:60,
warning: [email protected]: from C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto/curve25519/curve25519.c:22:
warning: [email protected]: C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\include/ring-core/target.h:53:2: error: #error "Unknown target CPU"
warning: [email protected]: #error "Unknown target CPU"
warning: [email protected]: ^~~~~
warning: [email protected]: In file included from C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto/curve25519/internal.h:20,
warning: [email protected]: from C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto/curve25519/curve25519.c:24:
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:219:2: error: #error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
warning: [email protected]: #error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
warning: [email protected]: ^~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:232:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t value_barrier_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:232:45: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t value_barrier_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:244:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:244:49: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_msb_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:249:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:249:53: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_is_zero_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:264:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_is_nonzero_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:264:56: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_is_nonzero_w(crypto_word_t a) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:269:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_eq_w(crypto_word_t a,
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:269:48: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_eq_w(crypto_word_t a,
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:270:48: error: unknown type name 'crypto_word_t'
warning: [email protected]: crypto_word_t b) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:277:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_select_w(crypto_word_t mask,
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:277:52: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_select_w(crypto_word_t mask,
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:278:52: error: unknown type name 'crypto_word_t'
warning: [email protected]: crypto_word_t a,
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:279:52: error: unknown type name 'crypto_word_t'
warning: [email protected]: crypto_word_t b) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:291:46: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline uint8_t constant_time_select_8(crypto_word_t mask, uint8_t a,
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:308:59: error: unknown type name 'crypto_word_t'
warning: [email protected]: const crypto_word_t mask) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h: In function 'constant_time_conditional_memcpy':
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:313:14: error: implicit declaration of function 'constant_time_select_8'; did you mean 'bssl_constant_time_test_main'? [-Werror=implicit-function-declaration]
warning: [email protected]: out[i] = constant_time_select_8(mask, in[i], out[i]);
warning: [email protected]: ^~~~~~~~~~~~~~~~~~~~~~
warning: [email protected]: bssl_constant_time_test_main
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:313:14: error: nested extern declaration of 'constant_time_select_8' [-Werror=nested-externs]
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h: At top level:
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:322:59: error: unknown type name 'crypto_word_t'
warning: [email protected]: const crypto_word_t mask) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h: In function 'constant_time_conditional_memxor':
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:327:15: error: implicit declaration of function 'value_barrier_w' [-Werror=implicit-function-declaration]
warning: [email protected]: out[i] ^= value_barrier_w(mask) & in[i];
warning: [email protected]: ^~~~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:327:15: error: nested extern declaration of 'value_barrier_w' [-Werror=nested-externs]
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h: At top level:
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:359:15: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: c:\users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto\internal.h:359:56: error: unknown type name 'crypto_word_t'
warning: [email protected]: static inline crypto_word_t constant_time_declassify_w(crypto_word_t v) {
warning: [email protected]: ^~~~~~~~~~~~~
warning: [email protected]: C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto/curve25519/curve25519.c: In function 'x25519_ge_scalarmult_small_precomp':
warning: [email protected]: C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto/curve25519/curve25519.c:721:35: error: implicit declaration of function 'constant_time_eq_w'; did you mean 'bssl_constant_time_test_main'? [-Werror=implicit-function-declaration]
warning: [email protected]: cmov(&e, &multiples[j-1], 1&constant_time_eq_w(index, j));
warning: [email protected]: ^~~~~~~~~~~~~~~~~~
warning: [email protected]: bssl_constant_time_test_main
warning: [email protected]: C:\Users\lpirc.cargo\git\checkouts\ring-51509f604a4fd25b\70b59d6\crypto/curve25519/curve25519.c:721:35: error: nested extern declaration of 'constant_time_eq_w' [-Werror=nested-externs]
warning: [email protected]: cc1.exe: all warnings being treated as errors

error: failed to run custom build command for ring v0.17.8 (https://github.com/briansmith/ring.git#70b59d6e)

It's the same error as #2008 (comment)

from ring.

briansmith avatar briansmith commented on July 20, 2024

What does xtensa-esp32s3-elf-gcc.exe --version output?

from ring.

lorenzo-pirchio avatar lorenzo-pirchio commented on July 20, 2024

This is xtensa-esp32s3-elf-gcc.exe --version output:

xtensa-esp32s3-elf-gcc.exe (crosstool-NG esp-2021r2-patch5) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I added this to target.h:
#elif defined(XTENSA)
#define OPENSSL_32_BIT

Now, when I compile it, I don't get any errors or warnings, but I don't know actually if it will work fine.

from ring.

briansmith avatar briansmith commented on July 20, 2024

In target.h, you can see:

// Versions of GCC before 10.0 didn't define `__ILP32__` for all 32-bit targets.
#elif defined(__MIPSEL__) || defined(__MIPSEB__) || defined(__PPC__) || defined(__powerpc__) || defined(__csky__)
#define OPENSSL_32_BIT

Ideally, you would upgrade to a newer version of GCC. Then it should "just work." Otherwise, you can find out what symbol to add to the above #elif and add it for xtensa. Note XTENSA isn't the right thing; the symbol we're looking for will start with '__' like the others in the list.

from ring.

lorenzo-pirchio avatar lorenzo-pirchio commented on July 20, 2024

Yes, I wrote Xtensa with '__' as the beginning and end as you said, but in markdown double underscores are used to format text as bold, as you can see in the previous message.

from ring.

briansmith avatar briansmith commented on July 20, 2024

OK, it looks like somebody just needs to submit the PR.

from ring.

lorenzo-pirchio avatar lorenzo-pirchio commented on July 20, 2024

Do you want me to submit a PR with the lines I added for xtensa?

from ring.

briansmith avatar briansmith commented on July 20, 2024

#elif defined(__MIPSEL__) || defined(__MIPSEB__) || defined(__PPC__) || defined(__powerpc__) || defined(__csky__)

^ Please extend that line.

Incidentally, is there no newer version of the xtensa SDK that lets you use GCC 10 or higher?

from ring.

lorenzo-pirchio avatar lorenzo-pirchio commented on July 20, 2024

I changed to GCC 12 because now I'm using esp-idf 5.1, which requires GCC 12.
But unfortunately I have problems with the linker and I have errors about ring.
Here they are:
Errors.txt
I have been trying to find possible solutions but I'm stuck doint this for a week.
If you have any suggestion, I'd be thankful to you.

from ring.

briansmith avatar briansmith commented on July 20, 2024

I changed to GCC 12 because now I'm using esp-idf 5.1, which requires GCC 12.
But unfortunately I have problems with the linker and I have errors about ring.
Here they are:
Errors.txt
I have been trying to find possible solutions but I'm stuck doint this for a week.
If you have any suggestion, I'd be thankful to you.

https://www.esp32.com/viewtopic.php?t=1612 and other things seem to say that you may need CFLAGS=-mlongcalls when invoking cargo?

from ring.

juliankrieger avatar juliankrieger commented on July 20, 2024

@briansmith since I can't find a PR from @lorenzo-pirchio , I will create one myself.

Furthermore, I'm on GCC V 13 (via crosstools) and still encounter the same error.

from ring.

juliankrieger avatar juliankrieger commented on July 20, 2024

@briansmith I can confirm building works with

  • espup install (installs toolchains for esp32)
  • the recent patch
  • The following .cargo/config.toml section:
TARGET_CC="xtensa-esp32s3-elf-cc"
TARGET_AR="xtensa-esp32s3-elf-ar"
TARGET_CFLAGS="-mlongcalls"

from ring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.