Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Undefined symbols for arm64
Forum Updated to NodeBB v4.3 + New Features

Undefined symbols for arm64

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 5 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vcasado
    wrote on last edited by
    #1

    Hello,

    I am trying to implement the Tiny AES library for a proyect (Mobile Android and iOS) and when I try to compile, I get this errors:

    Undefined symbols for architecture arm64:
      "AES_ECB_encrypt(unsigned char*, unsigned char const*, unsigned char*, unsigned int)", referenced from:
          BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
      "AES_init(unsigned char)", referenced from:
          BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    The app has been working fine, this errors have appeared from the Tiny AES Lib import.
    I have searched that it could be a wrong CMake config, but I have the -DCMAKE_OSX_ARCHITECTURES:STRING=arm64

    Thank you

    jsulmJ JoeCFDJ 2 Replies Last reply
    0
    • V vcasado

      Hello,

      I am trying to implement the Tiny AES library for a proyect (Mobile Android and iOS) and when I try to compile, I get this errors:

      Undefined symbols for architecture arm64:
        "AES_ECB_encrypt(unsigned char*, unsigned char const*, unsigned char*, unsigned int)", referenced from:
            BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
        "AES_init(unsigned char)", referenced from:
            BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
      ld: symbol(s) not found for architecture arm64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      

      The app has been working fine, this errors have appeared from the Tiny AES Lib import.
      I have searched that it could be a wrong CMake config, but I have the -DCMAKE_OSX_ARCHITECTURES:STRING=arm64

      Thank you

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @vcasado Do you use an arm64 build of that library?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      V 1 Reply Last reply
      0
      • V vcasado

        Hello,

        I am trying to implement the Tiny AES library for a proyect (Mobile Android and iOS) and when I try to compile, I get this errors:

        Undefined symbols for architecture arm64:
          "AES_ECB_encrypt(unsigned char*, unsigned char const*, unsigned char*, unsigned int)", referenced from:
              BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
          "AES_init(unsigned char)", referenced from:
              BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
        ld: symbol(s) not found for architecture arm64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        

        The app has been working fine, this errors have appeared from the Tiny AES Lib import.
        I have searched that it could be a wrong CMake config, but I have the -DCMAKE_OSX_ARCHITECTURES:STRING=arm64

        Thank you

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        @vcasado

        add this in your cmakefile
        set(CMAKE_VERBOSE_MAKEFILE ON)
        to check if the lib of Tiny AES library is added to your build.

        1 Reply Last reply
        0
        • jsulmJ jsulm

          @vcasado Do you use an arm64 build of that library?

          V Offline
          V Offline
          vcasado
          wrote on last edited by
          #4

          @jsulm The library is provided as source https://github.com/kokke/tiny-AES-c
          And I am not using its CMakeLists.txt, I have imported in my src/ and inc/ folders the .h .hpp and .c files and added to my CMakeLists.txt as other sources.

          SGaistS 1 Reply Last reply
          0
          • V vcasado

            @jsulm The library is provided as source https://github.com/kokke/tiny-AES-c
            And I am not using its CMakeLists.txt, I have imported in my src/ and inc/ folders the .h .hpp and .c files and added to my CMakeLists.txt as other sources.

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @vcasado hi,

            Then please show your CMakeLists.txt content.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            V 1 Reply Last reply
            0
            • SGaistS SGaist

              @vcasado hi,

              Then please show your CMakeLists.txt content.

              V Offline
              V Offline
              vcasado
              wrote on last edited by vcasado
              #6

              @SGaist Hi,

              This is my CMakeLists.txt

              cmake_minimum_required(VERSION 3.16)
              
              project(BLETester VERSION 1.1 LANGUAGES CXX)
              
              set(CMAKE_CXX_STANDARD_REQUIRED ON)
              set(CMAKE_VERBOSE_MAKEFILE ON)
              
              find_package(Qt6 6.4 REQUIRED COMPONENTS Quick Bluetooth Positioning Location Widgets)
              
              qt_standard_project_setup()
              
              qt_add_executable(BLETester
                  main.cpp
                  mainwindow.cpp
                  bleinterface.cpp
                  mainwindow.h
                  bleinterface.h
                  characteristicinfo.cpp characteristicinfo.h
                  aes.c aes.h aes.hpp
              )
              
              set_target_properties(BLETester PROPERTIES
                  MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
                  MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
                  MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
                  MACOSX_BUNDLE TRUE
                  WIN32_EXECUTABLE TRUE
              )
              
              if (APPLE)
                  if (IOS)
                      set_target_properties(BLETester PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist")
                  endif()
              endif()
              
              target_link_libraries(BLETester
                  PRIVATE
                      Qt::Bluetooth
                      Qt::Core
                      Qt::Gui
                      Qt::Qml
                      Qt::Quick
                      Qt::Positioning
                      Qt::Location
                      Qt::Widgets
              )
              
              install(TARGETS BLETester
                  BUNDLE DESTINATION .
                  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
                  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
              )
              
              

              And included in bleinterface.h:

              #include "aes.hpp"
              

              And used in bleinterface.cpp:

              AES_init(0);
              AES_ECB_encrypt(in_Buffer, key, output_Buffer, value[2]);
              

              Thank you.

              JoeCFDJ JonBJ 2 Replies Last reply
              0
              • V vcasado

                @SGaist Hi,

                This is my CMakeLists.txt

                cmake_minimum_required(VERSION 3.16)
                
                project(BLETester VERSION 1.1 LANGUAGES CXX)
                
                set(CMAKE_CXX_STANDARD_REQUIRED ON)
                set(CMAKE_VERBOSE_MAKEFILE ON)
                
                find_package(Qt6 6.4 REQUIRED COMPONENTS Quick Bluetooth Positioning Location Widgets)
                
                qt_standard_project_setup()
                
                qt_add_executable(BLETester
                    main.cpp
                    mainwindow.cpp
                    bleinterface.cpp
                    mainwindow.h
                    bleinterface.h
                    characteristicinfo.cpp characteristicinfo.h
                    aes.c aes.h aes.hpp
                )
                
                set_target_properties(BLETester PROPERTIES
                    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
                    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
                    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
                    MACOSX_BUNDLE TRUE
                    WIN32_EXECUTABLE TRUE
                )
                
                if (APPLE)
                    if (IOS)
                        set_target_properties(BLETester PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist")
                    endif()
                endif()
                
                target_link_libraries(BLETester
                    PRIVATE
                        Qt::Bluetooth
                        Qt::Core
                        Qt::Gui
                        Qt::Qml
                        Qt::Quick
                        Qt::Positioning
                        Qt::Location
                        Qt::Widgets
                )
                
                install(TARGETS BLETester
                    BUNDLE DESTINATION .
                    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
                    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
                )
                
                

                And included in bleinterface.h:

                #include "aes.hpp"
                

                And used in bleinterface.cpp:

                AES_init(0);
                AES_ECB_encrypt(in_Buffer, key, output_Buffer, value[2]);
                

                Thank you.

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by JoeCFD
                #7

                @vcasado said in Undefined symbols for arm64:

                aes.h aes.hpp

                are aes.h and aes.hpp same? It is rare to define two files like that.

                V 1 Reply Last reply
                0
                • JoeCFDJ JoeCFD

                  @vcasado said in Undefined symbols for arm64:

                  aes.h aes.hpp

                  are aes.h and aes.hpp same? It is rare to define two files like that.

                  V Offline
                  V Offline
                  vcasado
                  wrote on last edited by
                  #8

                  @JoeCFD No, the .hpp is like a wrapper that contains:

                  #ifndef _AES_HPP_
                  #define _AES_HPP_
                  
                  #ifndef __cplusplus
                  #error Do not include the hpp header in a c project!
                  #endif //__cplusplus
                  
                  extern "C" {
                  #include "aes.h"
                  }
                  
                  #endif //_AES_HPP_
                  

                  But in the CMakeLists.txt, the .h is included so it does not report that file not found when compiling

                  JonBJ 1 Reply Last reply
                  0
                  • V vcasado

                    @JoeCFD No, the .hpp is like a wrapper that contains:

                    #ifndef _AES_HPP_
                    #define _AES_HPP_
                    
                    #ifndef __cplusplus
                    #error Do not include the hpp header in a c project!
                    #endif //__cplusplus
                    
                    extern "C" {
                    #include "aes.h"
                    }
                    
                    #endif //_AES_HPP_
                    

                    But in the CMakeLists.txt, the .h is included so it does not report that file not found when compiling

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @vcasado
                    I know nothing about this, but are you sure the 2 undefined references with those parameters are really supposed to be in Tiny AES's library aes.h? When I look at e.g. https://morioh.com/p/67a35723557d or https://github.com/kokke/tiny-AES-c/blob/master/aes.h I do not see either of them?

                    V 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @vcasado
                      I know nothing about this, but are you sure the 2 undefined references with those parameters are really supposed to be in Tiny AES's library aes.h? When I look at e.g. https://morioh.com/p/67a35723557d or https://github.com/kokke/tiny-AES-c/blob/master/aes.h I do not see either of them?

                      V Offline
                      V Offline
                      vcasado
                      wrote on last edited by
                      #10

                      @JonB You are right, now the usage in bleinterface.cpp is:

                          struct AES_ctx ctx;
                          AES_init_ctx(&ctx, key);
                      
                          for (int i = 0; i < 4; ++i)
                          {
                              AES_ECB_encrypt(&ctx, in_Buffer + (i * 16));
                          }
                      

                      And the error is:

                      Undefined symbols for architecture arm64:
                        "_AES_ECB_encrypt", referenced from:
                            BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
                        "_AES_init_ctx", referenced from:
                            BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
                      ld: symbol(s) not found for architecture arm64
                      clang: error: linker command failed with exit code 1 (use -v to see invocation)
                      
                      JonBJ 1 Reply Last reply
                      0
                      • V vcasado

                        @JonB You are right, now the usage in bleinterface.cpp is:

                            struct AES_ctx ctx;
                            AES_init_ctx(&ctx, key);
                        
                            for (int i = 0; i < 4; ++i)
                            {
                                AES_ECB_encrypt(&ctx, in_Buffer + (i * 16));
                            }
                        

                        And the error is:

                        Undefined symbols for architecture arm64:
                          "_AES_ECB_encrypt", referenced from:
                              BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
                          "_AES_init_ctx", referenced from:
                              BLEInterface::onCharacteristicChanged(QLowEnergyCharacteristic const&, QByteArray const&) in bleinterface.o
                        ld: symbol(s) not found for architecture arm64
                        clang: error: linker command failed with exit code 1 (use -v to see invocation)
                        
                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #11

                        @vcasado
                        I also know nothing about cmake :) Can you at least show the full linker command line it uses, let's see whether libaes.a is even there? Assuming it comes with a library not just source code you compile into yours. I also know nothing about Android/iOS building!

                        V 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @vcasado
                          I also know nothing about cmake :) Can you at least show the full linker command line it uses, let's see whether libaes.a is even there? Assuming it comes with a library not just source code you compile into yours. I also know nothing about Android/iOS building!

                          V Offline
                          V Offline
                          vcasado
                          wrote on last edited by
                          #12

                          @JonB There is no compiled library, that is why I am compiling it as it would be more sources of my project

                          SGaistS 1 Reply Last reply
                          0
                          • V vcasado

                            @JonB There is no compiled library, that is why I am compiling it as it would be more sources of my project

                            SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            You have locked your project to C++ only. Remove that and rebuild.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            V 1 Reply Last reply
                            1
                            • SGaistS SGaist

                              You have locked your project to C++ only. Remove that and rebuild.

                              V Offline
                              V Offline
                              vcasado
                              wrote on last edited by
                              #14

                              @SGaist How?

                              1 Reply Last reply
                              0
                              • V vcasado

                                @SGaist Hi,

                                This is my CMakeLists.txt

                                cmake_minimum_required(VERSION 3.16)
                                
                                project(BLETester VERSION 1.1 LANGUAGES CXX)
                                
                                set(CMAKE_CXX_STANDARD_REQUIRED ON)
                                set(CMAKE_VERBOSE_MAKEFILE ON)
                                
                                find_package(Qt6 6.4 REQUIRED COMPONENTS Quick Bluetooth Positioning Location Widgets)
                                
                                qt_standard_project_setup()
                                
                                qt_add_executable(BLETester
                                    main.cpp
                                    mainwindow.cpp
                                    bleinterface.cpp
                                    mainwindow.h
                                    bleinterface.h
                                    characteristicinfo.cpp characteristicinfo.h
                                    aes.c aes.h aes.hpp
                                )
                                
                                set_target_properties(BLETester PROPERTIES
                                    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
                                    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
                                    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
                                    MACOSX_BUNDLE TRUE
                                    WIN32_EXECUTABLE TRUE
                                )
                                
                                if (APPLE)
                                    if (IOS)
                                        set_target_properties(BLETester PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist")
                                    endif()
                                endif()
                                
                                target_link_libraries(BLETester
                                    PRIVATE
                                        Qt::Bluetooth
                                        Qt::Core
                                        Qt::Gui
                                        Qt::Qml
                                        Qt::Quick
                                        Qt::Positioning
                                        Qt::Location
                                        Qt::Widgets
                                )
                                
                                install(TARGETS BLETester
                                    BUNDLE DESTINATION .
                                    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
                                    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
                                )
                                
                                

                                And included in bleinterface.h:

                                #include "aes.hpp"
                                

                                And used in bleinterface.cpp:

                                AES_init(0);
                                AES_ECB_encrypt(in_Buffer, key, output_Buffer, value[2]);
                                

                                Thank you.

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #15

                                @vcasado said in Undefined symbols for arm64:

                                project(BLETester VERSION 1.1 LANGUAGES CXX)

                                I'm purely guessing, but chage this? E.g. ... LANGUAGES CXX C?

                                V 1 Reply Last reply
                                0
                                • JonBJ JonB

                                  @vcasado said in Undefined symbols for arm64:

                                  project(BLETester VERSION 1.1 LANGUAGES CXX)

                                  I'm purely guessing, but chage this? E.g. ... LANGUAGES CXX C?

                                  V Offline
                                  V Offline
                                  vcasado
                                  wrote on last edited by
                                  #16

                                  @JonB said in Undefined symbols for arm64:

                                  @vcasado said in Undefined symbols for arm64:

                                  project(BLETester VERSION 1.1 LANGUAGES CXX)

                                  I'm purely guessing, but chage this? E.g. ... LANGUAGES CXX C?

                                  Fixed with this! Thank you!

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved