ld: symbol(s) not found for architecture arm64

798 views
Skip to first unread message

Darius

unread,
Apr 6, 2023, 3:26:38 PM4/6/23
to ns-3-users
I am unable to build the project on my M1 Mac. I get the following errors when building. 

$ git clone https://gitlab.com/nsnam/ns-3-dev.git
Cloning into 'ns-3-dev'...
remote: Enumerating objects: 190524, done.
remote: Counting objects: 100% (347/347), done.
remote: Compressing objects: 100% (175/175), done.
remote: Total 190524 (delta 178), reused 316 (delta 172), pack-reused 190177
Receiving objects: 100% (190524/190524), 158.42 MiB | 10.74 MiB/s, done.
Resolving deltas: 100% (159572/159572), done.
balboa:workspace$ cd ns-3-dev
balboa:ns-3-dev (master)$ git checkout -b ns-3.38-release ns-3.38
Switched to a new branch 'ns-3.38-release'
balboa:ns-3-dev (ns-3.38-release)$ ./ns3 configure --enable-examples --enable-tests
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- The C compiler identification is AppleClang 14.0.3.14030022
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- CCache is enabled.
-- Using default output directory /Users/balboa/workspace/ns-3-dev/build
-- Proceeding without cmake-format
-- Performing Test MISSING_OSTREAM_NULLPTR_OPERATOR
-- Performing Test MISSING_OSTREAM_NULLPTR_OPERATOR - Failed
-- Performing Test FILESYSTEM_LIBRARY_IS_LINKED
-- Performing Test FILESYSTEM_LIBRARY_IS_LINKED - Success
-- find_external_library: SQLite3 was found.
-- Some or all of the gtk libraries were not found. (missing: GTK3_GTK_LIBRARY GTK3_GTK_INCLUDE_DIR GTK3_GLIBCONFIG_INCLUDE_DIR GTK3_GDK_INCLUDE_DIR GTK3_GDKCONFIG_INCLUDE_DIR GTK3_GDK_LIBRARY)
-- GTK3 was not found. Continuing without it.
-- LibXML2 was found.
-- Python: an incompatible version of Python was found, python bindings will be disabled
-- Visualizer requires Python bindings
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0")
-- GSL was not found. Continuing without it.
-- docs: doxygen documentation not enabled due to missing dependencies: doxygen dia
-- Failed to locate sphinx-build executable (missing: SPHINX_EXECUTABLE)
-- docs: sphinx documentation not enabled due to missing dependencies: Sphinx
-- Performing Test HAVE_UINT128_T
-- Performing Test HAVE_UINT128_T - Failed
-- Performing Test HAVE___UINT128_T
-- Performing Test HAVE___UINT128_T - Success
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for dirent.h
-- Looking for dirent.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for netpacket/packet.h
-- Looking for netpacket/packet.h - not found
-- Looking for getenv
-- Looking for getenv - found
-- Platform doesn't support TAP and EMU features. Continuing without them.
-- Precompiled headers were enabled.
-- Processing src/antenna
-- Processing src/aodv
-- Processing src/applications
-- Processing src/bridge
-- Processing src/brite
-- find_external_library: brite was not found. Missing headers: "Brite.h" and missing libraries: "brite".
-- Skipping src/brite
-- Processing src/buildings
-- Processing src/click
-- find_external_library: click was not found. Missing headers: "simclick.h" and missing libraries: "nsclick click".
-- Skipping src/click
-- Processing src/config-store
-- Processing src/core
-- Looking for include files boost/units/quantity.hpp, boost/units/systems/si.hpp
-- Looking for include files boost/units/quantity.hpp, boost/units/systems/si.hpp - found
-- Boost Units have been found.
-- Processing src/csma
-- Processing src/csma-layout
-- Processing src/dsdv
-- Processing src/dsr
-- Processing src/energy
-- Processing src/flow-monitor
-- Processing src/internet
-- Processing src/internet-apps
-- Processing src/lr-wpan
-- Processing src/lte
-- Processing src/mesh
-- Processing src/mobility
-- Processing src/netanim
-- Processing src/network
-- Processing src/nix-vector-routing
-- Processing src/olsr
-- Processing src/openflow
-- find_external_library: openflow was not found. Missing headers: "openflow.h" and missing libraries: "openflow".
-- Skipping src/openflow
-- Processing src/point-to-point
-- Processing src/point-to-point-layout
-- Processing src/propagation
-- Processing src/sixlowpan
-- Processing src/spectrum
-- Processing src/stats
-- Processing src/test
-- Processing src/topology-read
-- Processing src/traffic-control
-- Processing src/uan
-- Processing src/virtual-net-device
-- Processing src/wave
-- Processing src/wifi
-- Processing src/wimax
-- ---- Summary of ns-3 settings:
Build profile                 : default
Build directory               : /Users/balboa/workspace/ns-3-dev/build
Build with runtime asserts    : ON
Build with runtime logging    : ON
Build version embedding       : OFF (not requested)
BRITE Integration             : OFF (missing dependency)
DES Metrics event collection  : OFF (not requested)
DPDK NetDevice                : OFF (not requested)
Emulation FdNetDevice         : OFF (not requested)
Examples                      : ON
File descriptor NetDevice     : OFF (missing dependency)
GNU Scientific Library (GSL)  : OFF (missing dependency)
GtkConfigStore                : OFF (missing dependency)
LibXml2 support               : ON
MPI Support                   : OFF (not requested)
ns-3 Click Integration        : OFF (missing dependency)
ns-3 OpenFlow Integration     : OFF (missing dependency)
Netmap emulation FdNetDevice  : OFF (not requested)
PyViz visualizer              : OFF (missing dependency)
Python Bindings               : OFF (not requested)
SQLite support                : ON
Eigen3 support                : ON
Tap Bridge                    : OFF (not requested)
Tap FdNetDevice               : OFF (not requested)
Tests                         : ON


Modules configured to be built:
antenna                   aodv                      applications
bridge                    buildings                 config-store
core                      csma                      csma-layout
dsdv                      dsr                       energy
flow-monitor              internet                  internet-apps
lr-wpan                   lte                       mesh
mobility                  netanim                   network
nix-vector-routing        olsr                      point-to-point
point-to-point-layout     propagation               sixlowpan
spectrum                  stats                     test
topology-read             traffic-control           uan
virtual-net-device        wave                      wifi
wimax

Modules that cannot be built:
brite                     click                     fd-net-device
mpi                       openflow                  tap-bridge
visualizer


-- Configuring done (7.3s)
-- Generating done (0.4s)
-- Build files have been written to: /Users/balboa/workspace/ns-3-dev/cmake-cache
Finished executing the following commands:
mkdir cmake-cache
cd cmake-cache; /opt/homebrew/bin/cmake -DCMAKE_BUILD_TYPE=default -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=OFF -DNS3_NATIVE_OPTIMIZATIONS=OFF -DNS3_EXAMPLES=ON -DNS3_TESTS=ON -G Ninja .. ; cd ..
balboa:ns-3-dev (ns-3.38-release)$ ./ns3 build
[0/2] Re-checking globbed directories...
[1112/1874] Linking CXX shared library /Users/balboa/workspace/ns-3-dev/build/lib/libns3.38-stats-default.dylib
FAILED: /Users/balboa/workspace/ns-3-dev/build/lib/libns3.38-stats-default.dylib
: && /Library/Developer/CommandLineTools/usr/bin/c++ -O2 -g -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -dynamiclib -Wl,-headerpad_max_install_names  -o /Users/balboa/workspace/ns-3-dev/build/lib/libns3.38-stats-default.dylib -install_name @rpath/libns3.38-stats-default.dylib src/stats/CMakeFiles/libstats-obj.dir/model/sqlite-data-output.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/sqlite-output.cc.o src/stats/CMakeFiles/libstats-obj.dir/helper/file-helper.cc.o src/stats/CMakeFiles/libstats-obj.dir/helper/gnuplot-helper.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/boolean-probe.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/basic-data-calculators.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/data-calculator.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/data-collection-object.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/data-collector.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/data-output-interface.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/double-probe.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/file-aggregator.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/get-wildcard-matches.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/gnuplot-aggregator.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/gnuplot.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/histogram.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/omnet-data-output.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/probe.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/time-data-calculators.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/time-probe.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/time-series-adaptor.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/uinteger-16-probe.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/uinteger-32-probe.cc.o src/stats/CMakeFiles/libstats-obj.dir/model/uinteger-8-probe.cc.o -F/Library/Frameworks  -L/Users/balboa/workspace/ns-3-dev/build/lib -Wl,-rpath,/Users/balboa/workspace/ns-3-dev/build/lib  /Users/balboa/workspace/ns-3-dev/build/lib/libns3.38-core-default.dylib  -Xlinker -framework -Xlinker sqlite3 && :
ld: warning: ignoring file /Library/Frameworks/sqlite3.framework/sqlite3, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_sqlite3_bind_double", referenced from:
      bool ns3::SQLiteOutput::Bind<ns3::Time>(sqlite3_stmt*, int, ns3::Time const&) const in sqlite-output.cc.o
      bool ns3::SQLiteOutput::Bind<double>(sqlite3_stmt*, int, double const&) const in sqlite-output.cc.o
  "_sqlite3_bind_int", referenced from:
      bool ns3::SQLiteOutput::Bind<unsigned int>(sqlite3_stmt*, int, unsigned int const&) const in sqlite-output.cc.o
      bool ns3::SQLiteOutput::Bind<unsigned short>(sqlite3_stmt*, int, unsigned short const&) const in sqlite-output.cc.o
      bool ns3::SQLiteOutput::Bind<unsigned char>(sqlite3_stmt*, int, unsigned char const&) const in sqlite-output.cc.o
      bool ns3::SQLiteOutput::Bind<int>(sqlite3_stmt*, int, int const&) const in sqlite-output.cc.o
  "_sqlite3_bind_int64", referenced from:
      bool ns3::SQLiteOutput::Bind<long>(sqlite3_stmt*, int, long const&) const in sqlite-output.cc.o
      bool ns3::SQLiteOutput::Bind<long long>(sqlite3_stmt*, int, long long const&) const in sqlite-output.cc.o
  "_sqlite3_bind_text", referenced from:
      bool ns3::SQLiteOutput::Bind<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>(sqlite3_stmt*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const in sqlite-output.cc.o
  "_sqlite3_close_v2", referenced from:
      ns3::SQLiteOutput::~SQLiteOutput() in sqlite-output.cc.o
  "_sqlite3_column_double", referenced from:
      double ns3::SQLiteOutput::RetrieveColumn<double>(sqlite3_stmt*, int) const in sqlite-output.cc.o
  "_sqlite3_column_int", referenced from:
      int ns3::SQLiteOutput::RetrieveColumn<int>(sqlite3_stmt*, int) const in sqlite-output.cc.o
      unsigned int ns3::SQLiteOutput::RetrieveColumn<unsigned int>(sqlite3_stmt*, int) const in sqlite-output.cc.o
  "_sqlite3_errmsg", referenced from:
      ns3::SQLiteOutput::CheckError(sqlite3*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, bool) in sqlite-output.cc.o
      ns3::SQLiteOutput::Error(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in sqlite-output.cc.o
  "_sqlite3_finalize", referenced from:
      ns3::SQLiteOutput::SpinExec(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in sqlite-output.cc.o
      ns3::SQLiteOutput::SpinExec(sqlite3*, sqlite3_stmt*) in sqlite-output.cc.o
      ns3::SQLiteOutput::WaitExec(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const in sqlite-output.cc.o
      ns3::SQLiteOutput::WaitExec(sqlite3*, sqlite3_stmt*) const in sqlite-output.cc.o
      ns3::SQLiteOutput::SpinFinalize(sqlite3_stmt*) in sqlite-output.cc.o
  "_sqlite3_open", referenced from:
      ns3::SQLiteOutput::SQLiteOutput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in sqlite-output.cc.o
  "_sqlite3_prepare_v2", referenced from:
      ns3::SQLiteOutput::SpinExec(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in sqlite-output.cc.o
      ns3::SQLiteOutput::WaitExec(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const in sqlite-output.cc.o
      ns3::SQLiteOutput::WaitPrepare(sqlite3_stmt**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const in sqlite-output.cc.o
      ns3::SQLiteOutput::WaitPrepare(sqlite3*, sqlite3_stmt**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const in sqlite-output.cc.o
      ns3::SQLiteOutput::SpinPrepare(sqlite3_stmt**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const in sqlite-output.cc.o
      ns3::SQLiteOutput::SpinPrepare(sqlite3*, sqlite3_stmt**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in sqlite-output.cc.o
  "_sqlite3_reset", referenced from:
      ns3::SQLiteOutput::SpinReset(sqlite3_stmt*) in sqlite-output.cc.o
  "_sqlite3_step", referenced from:
      ns3::SQLiteOutput::SpinExec(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in sqlite-output.cc.o
      ns3::SQLiteOutput::SpinExec(sqlite3*, sqlite3_stmt*) in sqlite-output.cc.o
      ns3::SQLiteOutput::WaitExec(sqlite3*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const in sqlite-output.cc.o
      ns3::SQLiteOutput::WaitExec(sqlite3*, sqlite3_stmt*) const in sqlite-output.cc.o
      ns3::SQLiteOutput::SpinStep(sqlite3_stmt*) in sqlite-output.cc.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[1120/1874] Building CXX object src/test/CMakeFiles/libtest.dir/ns3wifi/wifi-ac-mapping-test-suite.cc.o
ninja: build stopped: subcommand failed.
Finished executing the following commands:
cd cmake-cache; /opt/homebrew/bin/cmake --build . -j 9 ; cd ..

Darius

unread,
Apr 6, 2023, 3:36:42 PM4/6/23
to ns-3-users

I am using Xcode cammand line tools version:

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 14.3.0.0.1.1679647830
volume: /
location: /
install-time: 1680408158


With Clang version:
$ clang -v
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I am using macOS version 13.3 (22E252)

I have sqlite3 installed via homebrew with version 3.39.5

Gabriel Ferreira

unread,
Apr 6, 2023, 3:58:26 PM4/6/23
to ns-3-users
It is apparently picking up the wrong sqlite3 library. 

See the line
  • ld: warning: ignoring file /Library/Frameworks/sqlite3.framework/sqlite3, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Why would Apple ship x64 libraries in an ARM computer? Probably because of emulation or cross-compilation capability for older Macs with Intel.
No idea how to fix that other than brute forcing a library search then test each of them individually, but we don't have support for that (at least yet).

Darius

unread,
Apr 6, 2023, 4:45:12 PM4/6/23
to ns-3-users
I removed the sqlite3.framework located at /Library/Frameworks/sqlite3.framework/sqlite3. After removing this framework I am able to build ns3 on my M1 Mac. 

I think this framework was not one that is provided by Apple but one that I had on my machine that might have been migrated with the Apple Migration Assistant when I moved from an intel based Mac to an M1 machine. 

Reply all
Reply to author
Forward
0 new messages