This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TDA2: VISION SDK - Build tidl_model_import for Linux

Part Number: TDA2

Tool/software: Linux

Is there a way to get tidl model input converter working on Linux OS?

In PROCESSOR_SDK_VISION/ti_components/algorithms/REL.TIDL.01.01.01.00/modules/ti_dl/utils/tidlModelImport
there is make file, but make does not work, its full of errors I can't fix.

Can anyone help me with this?

Regards.

  • Hi,

    can you share the build log?

    Regards,
    Yordan
  • Hi,
    here it is:

    compiling tidl_import_common.cpp
    In file included from ti_dl.h:76:0,
    from tidl_import_common.cpp:88:
    ../../inc/itidl_ti.h:81:0: warning: "USE_IVISION" redefined
    #define USE_IVISION (0)
    ^
    ../../inc/itidl_ti.h:78:0: note: this is the location of the previous definition
    #define USE_IVISION (1)
    ^
    tidl_import_common.cpp: In function ‘int32_t TIDL_QuantizeUnsignedMax(uint8_t*, float*, int32_t, float, float, int32_t, int32_t, int32_t*)’:
    tidl_import_common.cpp:109:33: error: call of overloaded ‘abs(float)’ is ambiguous
    float absRange = abs(max - min);
    ^
    In file included from /usr/local/include/google/protobuf/stubs/port.h:35:0,
    from /usr/local/include/google/protobuf/stubs/common.h:40,
    from /usr/local/include/google/protobuf/io/coded_stream.h:134,
    from tidl_import_common.cpp:63:
    /usr/include/stdlib.h:774:12: note: candidate: int abs(int)
    extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
    ^
    In file included from /usr/include/c++/5/bits/stl_algo.h:59:0,
    from /usr/include/c++/5/algorithm:62,
    from /usr/local/include/google/protobuf/stubs/shared_ptr.h:38,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl_lite.h:49,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl.h:46,
    from tidl_import_common.cpp:64:
    /usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
    abs(long long __x) { return __builtin_llabs (__x); }
    ^
    /usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
    abs(long __i) { return __builtin_labs(__i); }
    ^
    tidl_import_common.cpp: In function ‘int32_t TIDL_normalize(float, float, float)’:
    tidl_import_common.cpp:186:33: error: call of overloaded ‘abs(float)’ is ambiguous
    float absRange = abs(max - min);
    ^
    In file included from /usr/local/include/google/protobuf/stubs/port.h:35:0,
    from /usr/local/include/google/protobuf/stubs/common.h:40,
    from /usr/local/include/google/protobuf/io/coded_stream.h:134,
    from tidl_import_common.cpp:63:
    /usr/include/stdlib.h:774:12: note: candidate: int abs(int)
    extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
    ^
    In file included from /usr/include/c++/5/bits/stl_algo.h:59:0,
    from /usr/include/c++/5/algorithm:62,
    from /usr/local/include/google/protobuf/stubs/shared_ptr.h:38,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl_lite.h:49,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl.h:46,
    from tidl_import_common.cpp:64:
    /usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
    abs(long long __x) { return __builtin_llabs (__x); }
    ^
    /usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
    abs(long __i) { return __builtin_labs(__i); }
    ^
    tidl_import_common.cpp: In function ‘bool TIDL_readProtoFromTextFile(const char*, google::protobuf::Message*)’:
    tidl_import_common.cpp:212:12: warning: NULL used in arithmetic [-Wpointer-arith]
    if(fd == NULL)
    ^
    tidl_import_common.cpp: In function ‘bool TIDL_readProtoFromBinaryFile(const char*, google::protobuf::Message*)’:
    tidl_import_common.cpp:238:12: warning: NULL used in arithmetic [-Wpointer-arith]
    if(fd == NULL)
    ^
    tidl_import_common.cpp: In function ‘int32_t TIDL_findSymQ(float, float)’:
    tidl_import_common.cpp:368:25: error: call of overloaded ‘abs(float&)’ is ambiguous
    float absMax = (abs(min) > abs(max)) ? abs(min) : abs(max);
    ^
    In file included from /usr/local/include/google/protobuf/stubs/port.h:35:0,
    from /usr/local/include/google/protobuf/stubs/common.h:40,
    from /usr/local/include/google/protobuf/io/coded_stream.h:134,
    from tidl_import_common.cpp:63:
    /usr/include/stdlib.h:774:12: note: candidate: int abs(int)
    extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
    ^
    In file included from /usr/include/c++/5/bits/stl_algo.h:59:0,
    from /usr/include/c++/5/algorithm:62,
    from /usr/local/include/google/protobuf/stubs/shared_ptr.h:38,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl_lite.h:49,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl.h:46,
    from tidl_import_common.cpp:64:
    /usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
    abs(long long __x) { return __builtin_llabs (__x); }
    ^
    /usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
    abs(long __i) { return __builtin_labs(__i); }
    ^
    tidl_import_common.cpp:368:36: error: call of overloaded ‘abs(float&)’ is ambiguous
    float absMax = (abs(min) > abs(max)) ? abs(min) : abs(max);
    ^
    In file included from /usr/local/include/google/protobuf/stubs/port.h:35:0,
    from /usr/local/include/google/protobuf/stubs/common.h:40,
    from /usr/local/include/google/protobuf/io/coded_stream.h:134,
    from tidl_import_common.cpp:63:
    /usr/include/stdlib.h:774:12: note: candidate: int abs(int)
    extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
    ^
    In file included from /usr/include/c++/5/bits/stl_algo.h:59:0,
    from /usr/include/c++/5/algorithm:62,
    from /usr/local/include/google/protobuf/stubs/shared_ptr.h:38,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl_lite.h:49,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl.h:46,
    from tidl_import_common.cpp:64:
    /usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
    abs(long long __x) { return __builtin_llabs (__x); }
    ^
    /usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
    abs(long __i) { return __builtin_labs(__i); }
    ^
    tidl_import_common.cpp:368:48: error: call of overloaded ‘abs(float&)’ is ambiguous
    float absMax = (abs(min) > abs(max)) ? abs(min) : abs(max);
    ^
    In file included from /usr/local/include/google/protobuf/stubs/port.h:35:0,
    from /usr/local/include/google/protobuf/stubs/common.h:40,
    from /usr/local/include/google/protobuf/io/coded_stream.h:134,
    from tidl_import_common.cpp:63:
    /usr/include/stdlib.h:774:12: note: candidate: int abs(int)
    extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
    ^
    In file included from /usr/include/c++/5/bits/stl_algo.h:59:0,
    from /usr/include/c++/5/algorithm:62,
    from /usr/local/include/google/protobuf/stubs/shared_ptr.h:38,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl_lite.h:49,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl.h:46,
    from tidl_import_common.cpp:64:
    /usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
    abs(long long __x) { return __builtin_llabs (__x); }
    ^
    /usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
    abs(long __i) { return __builtin_labs(__i); }
    ^
    tidl_import_common.cpp:368:59: error: call of overloaded ‘abs(float&)’ is ambiguous
    float absMax = (abs(min) > abs(max)) ? abs(min) : abs(max);
    ^
    In file included from /usr/local/include/google/protobuf/stubs/port.h:35:0,
    from /usr/local/include/google/protobuf/stubs/common.h:40,
    from /usr/local/include/google/protobuf/io/coded_stream.h:134,
    from tidl_import_common.cpp:63:
    /usr/include/stdlib.h:774:12: note: candidate: int abs(int)
    extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
    ^
    In file included from /usr/include/c++/5/bits/stl_algo.h:59:0,
    from /usr/include/c++/5/algorithm:62,
    from /usr/local/include/google/protobuf/stubs/shared_ptr.h:38,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl_lite.h:49,
    from /usr/local/include/google/protobuf/io/zero_copy_stream_impl.h:46,
    from tidl_import_common.cpp:64:
    /usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
    abs(long long __x) { return __builtin_llabs (__x); }
    ^
    /usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
    abs(long __i) { return __builtin_labs(__i); }
    ^
    /home/rtrk/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/algorithms/REL.TIDL.01.01.01.00/makerules/rules.mk:450: recipe for target '/home/rtrk/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/algorithms/REL.TIDL.01.01.01.00/out/PC/dsp/debug/modules/ti_dl/utils/tidlModelImport/tidl_import_common.obj' failed
    make: *** [/home/rtrk/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/algorithms/REL.TIDL.01.01.01.00/out/PC/dsp/debug/modules/ti_dl/utils/tidlModelImport/tidl_import_common.obj] Error 1

    Regards.
  • Hi Yordan,

    I'll add more details about my software:

    - Ubuntu 16.04

    -PROCESSOR_SDK_VISION_03_04_00_00

    And more details on what am I doing and what i did:

    -I'm trying to use tidlModelImport as a module in project that uses TIDL in VISION SDK.

    --Project is designed to work on Ubuntu 16.04

    -First when i looked at build log I added "-std=gnu++11" to CFLAGS in `makefile`

    --and then changed include <math.h> to <cmath> in `tidl_import_common.cpp`


    -After that passed, got new compile arrors about protobuf library:

    --Forums say that libprotobuf-dev is outdated on official Ubuntu

    ---then I manualy build protobuf v3.2.0

    ---updated makefile to use those libs


    -After that passed, got new errors where:

    --"compiling ../caffeImport/caffe.pb.cc" complained about:

    ---"/protobuf/src/google/protobuf/arena.h:xxx: undefined reference to ..." many things

    ---You will find whole output in `build_log`


    That confused me hence every file in "../tfImport/proto_cc/tensorflow/core/framework/"

    includes that `arena.h` file but compiling them passes with no errors.


    The clean build log output (where I did not modify anything) can be found in `build_log_clean`.


    Regards,

    Uros.makefile.doctidl_import_common.cppbuild_log.docbuild_log_clean.doc

  • Hi Uros,

    in your makefile can you add to LDFLAGS also "-lstdc++ -m32 -static" flags and give a try?
    They should be added if PLATFORM_BUILD == 'x86', but I am not sure it happens.

    Regards,
    Yordan
  • Hi Yordan,

    As you suggested i modified makefile:

    CFLAGS+=-DTIDL_IMPORT_TOOL
    LDFLAGS= -L $(PROTOBUF_LIB_DIR)
    LDFLAGS+= -lprotoc 
    LDFLAGS+= -lprotobuf
    LDFLAGS+= -lpthread
    
    CFLAGS+= -m32
    LDFLAGS+= -lstdc++ -m32 -static
    
    # ifeq ($(PLATFORM_BUILD), x86)
    # CFLAGS+= -m32
    # LDFLAGS+= -lstdc++ -m32 -static
    # else
    # LDFLAGS+= -lstdc++ -lz
    # endif

    Build still fails, but now when compiling caffeImport occurs I get this:

    compiling ../caffeImport/caffe.pb.cc
    /usr/bin/ld: skipping incompatible /home/rtrk/protobuf/src/.libs/libprotoc.a when searching for -lprotoc
    /usr/bin/ld: skipping incompatible //usr/local/lib/libprotoc.a when searching for -lprotoc
    /usr/bin/ld: cannot find -lprotoc
    /usr/bin/ld: skipping incompatible /home/rtrk/protobuf/src/.libs/libprotobuf.a when searching for -lprotobuf
    /usr/bin/ld: skipping incompatible //usr/local/lib/libprotobuf.a when searching for -lprotobuf
    /usr/bin/ld: cannot find -lprotobuf
    collect2: error: ld returned 1 exit status
    /home/rtrk/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/algorithms/REL.TIDL.01.01.01.00/makerules/rules.mk:603: recipe for target 'outfile' failed
    make: *** [outfile] Error 1

    You can find whole output in `build.log.doc` attachment.

    Regards,
    Uros.
    build.log.doc

  • Hi Uros,

    can you try to rebuild protobuf and protoc libraries with '-m32' flag added to their CFLAGS and LDFLAGS?

    Regards,
    Yordan
  • Hi, Yordan,

    I tried that, and everything is still the same.

    Regards,
    Uros
  • Hi Uros,

    I do not have more ideas and pinged TIDL experts to provide help.

    Regards,
    Yordan
  • Hi Yordan,

    I want to inform You that I have successfully build tidl_model_converer for Linux OS.

    Make flags for protobuf and protoc libs needed more additions:
    build=i686-pc-linux-gnu CFLAGS=-m32 -DNDEBUG CXXFLAGS=-m32 -DNDEBUG LDFLAGS=-m32

    Like this library is sure to be 32-bit.

    Regards,
    Uros

  • Hi Uros,

    Thanks for updating the thread.

    Regards,
    Yordan