Git Product home page Git Product logo

Comments (10)

cfircohen avatar cfircohen commented on April 30, 2024

Thanks for submitting this issue.

What Emscripten SDK version are you using? Try dl the latest one from https://emscripten.org/docs/getting_started/downloads.html. I successfully compiled this project using the latest Emscripten SDK a couple of weeks ago.

What cmake version are you using?

from tpm-js.

AlbertnQ avatar AlbertnQ commented on April 30, 2024

Yes, I used the latest Emscripten SDK. And my cmake version is 3.13.3.

Now I can compile by using 'emcmake cmake..', but when I 'make -j4' ,it reported many errors:
(it seems to be caused by dependency library, such as boringssl?)

In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/AlgorithmCap.c:67:
In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/Tpm.h:67:
In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/LibSupport.h:90:
In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/TpmToOsslHash.h:72:
In file included from /home/samfisher/test/tpm-js/third_party/boringssl/include/openssl/evp.h:60:
/home/samfisher/test/tpm-js/third_party/boringssl/include/openssl/base.h:122:2: error: 
      "Unknown target CPU"
#error "Unknown target CPU"
 ^
In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/AlgorithmCap.c:67:
In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/Tpm.h:67:
In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/LibSupport.h:100:
In file included from /home/samfisher/test/tpm-js/third_party/ibmswtpm2/src/TpmToOsslSym.h:75:
/home/samfisher/test/tpm-js/third_party/boringssl/include/openssl/bn.h:165:2: error: 
      "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
#error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
 ^
/home/samfisher/test/tpm-js/third_party/boringssl/include/openssl/bn.h:219:44: error: 
      unknown type name 'BN_ULONG'
OPENSSL_EXPORT int BN_set_word(BIGNUM *bn, BN_ULONG value);
                                           ^
/home/samfisher/test/tpm-js/third_party/boringssl/include/openssl/bn.h:309:16: error: 
      unknown type name 'BN_ULONG'
OPENSSL_EXPORT BN_ULONG BN_get_word(const BIGNUM *bn);
               ^
/home/samfisher/test/tpm-js/third_party/boringssl/include/openssl/bn.h:377:43: error: 
      unknown type name 'BN_ULONG'
OPENSSL_EXPORT int BN_add_word(BIGNUM *a, BN_ULONG w);
fatal error: too many errors emitted, stopping now [-ferror-limit=]
In file included from /home/samfisher/test/tpm-js/third_party/boringssl/crypto/fipsmodule/bcm.c:31:
/home/samfisher/test/tpm-js/third_party/boringssl/crypto/fipsmodule/../internal.h:252:2: error: 
      "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
#error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT"
 ^
/home/samfisher/test/tpm-js/third_party/boringssl/crypto/fipsmodule/../internal.h:267:15: error: 
      unknown type name 'crypto_word_t'
static inline crypto_word_t value_barrier_w(crypto_word_t a) {
              ^
/home/samfisher/test/tpm-js/third_party/boringssl/crypto/fipsmodule/../internal.h:267:45: error: 
      unknown type name 'crypto_word_t'
static inline crypto_word_t value_barrier_w(crypto_word_t a) {
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting
/home/samfisher/test/tpm-js/third_party/googletest/googletest/include/gtest/internal/gtest-type-util.h:43:12: fatal error: 'cxxabi.h' file not found
#  include <cxxabi.h>
           ^

from tpm-js.

cfircohen avatar cfircohen commented on April 30, 2024

I'm having difficulty reproducing your errors. I updated emsdk to the latest version (per https://emscripten.org/docs/getting_started/downloads.html, I pulled the latest changed and ran "./emsdk install latest", "./emsdk activate latest", "source ./emsdk_env.sh"). Cloned a clean copy of tpm-js, initialized submodules ("git submodule update --init"), and built it with:
mkdir bulid-web
cd build-web
emcmake cmake ..
make -j4

You were right about changing "emconfigure cmake .." to "emcmake cmake ..", I also got that error.
But after that, the build completed successfully.

Maybe you're missing "build-essential" package?
I can maybe move the build process to a docker image. Would that work for you?

Note that if you only want to go through the code-labs, TPM-JS live web site is at: https://google.github.io/tpm-js/. Unless you want to change the codelabs, there's no real need to rebuild the project.

from tpm-js.

AlbertnQ avatar AlbertnQ commented on April 30, 2024

Thanks for your help. If it's convenient for you, please provide docker image to me. I want to learn this framework, but I met lots of problems when building, even though I used the same instructions as you did above. Sorry for bothering.

from tpm-js.

cfircohen avatar cfircohen commented on April 30, 2024

I added an emsdk Dockerfile and a couple of helper shell scripts in 77d7b80.

Please pull, delete your "build-web" dir if you have any and run:
$ ./dcmake
$ ./dmake -j4

The first prepares the Docker image, creates 'build-web' directory, and invokes cmake in the Docker image. You need to run this only once.

The second runs make in the Docker image.

Please give it a try.

from tpm-js.

AlbertnQ avatar AlbertnQ commented on April 30, 2024
RUN groupadd -g $group builder \
    && useradd -u $user -g $group builder \
    && mkdir -p /home/builder \
    && chown -R builder:builder /home/builder

I think groupadd command use -g to add a new group that has a new gid, but $group gid may have been used, will it cause an error?And the second command useradd -u may be the same.

from tpm-js.

cfircohen avatar cfircohen commented on April 30, 2024

These are arguments set by dcmake.sh and dmake.sh. Please look at the shell scripts.

from tpm-js.

cfircohen avatar cfircohen commented on April 30, 2024

Sorry, arguments set by dinit.sh when it builds the image:

docker build
--build-arg user="$(id -u "${USER}")"
--build-arg group="$(id -g "${USER}")"
-t tpm-js-builder-image .

from tpm-js.

AlbertnQ avatar AlbertnQ commented on April 30, 2024

Yes.
In dinit.sh,

docker build
--build-arg user="$(id -u "${USER}")"
--build-arg group="$(id -g "${USER}")"
-t tpm-js-builder-image .

User is current user's uid, and group is current user's gid, so in dockerfile,useradd and groupadd may cause error 'uid is not unique' and 'gid is not unique'.Because they are used.When I compile ,it's actually like this. After I change them, it can work normally now and I can run the web.
Thank you very much!Thanks for your help!

from tpm-js.

cfircohen avatar cfircohen commented on April 30, 2024

I'm glad it works for you. Thanks for your interest in this project.

from tpm-js.

Related Issues (12)

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.