I am trying to link Open Source Routing Machine (OSRM) code with a basic command-line application in XCode and run the code provided in Example.cpp (from osrm-master directory) as the main function. I am able to link header files from OSRM 'include' as well as all other required libraries, so within the code, there are no identified errors. However, when I run the project, I get the following error:
Undefined symbols for architecture x86_64: "osrm::OSRM::OSRM(osrm::engine::EngineConfig&)", referenced from: _main in main.o "osrm::OSRM::~OSRM()", referenced from: _main in main.o "osrm::OSRM::Route(osrm::engine::api::RouteParameters const&, osrm::util::json::Object&) const", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64
Why might this be and how could I approach solving this error? Is there a way you could recommend to link OSRM file system into my application? I don't want to link the library itself (libosrm.a), but the actual source code files.
Related
I am working on a flutter project. My project includes tflite and amplify packages. it works fine with android but whenever I try to build it in Xcode I am getting this following errors:
Undefined symbols for architecture arm64:
"OBJC_CLASS$_FlutterStandardTypedData", referenced from:
objc-class-ref in tflite(TflitePlugin.o)
enter code here
"_FlutterMethodNotImplemented", referenced from:
-[TflitePlugin handleMethodCall:result:] in tflite(TflitePlugin.o)
"OBJC_CLASS$_FlutterMethodChannel", referenced from:
objc-class-ref in tflite(TflitePlugin.o)
"OBJC_METACLASS$_FlutterAppDelegate", referenced from:
OBJC_METACLASS$_AppDelegate in AppDelegate.o
"OBJC_CLASS$_FlutterAppDelegate", referenced from:
OBJC_CLASS$_AppDelegate in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help me with this. I have been stuck with this issue for more than a week now. Thank you.
I have added a snippet from Xcode which shows the current settings for Architectures. There are past suggestions to add arm64 as a Valid architectures. However, as you see there is no option for that. I added arm64 in excluded architectures as shown in the picture. It didn't work for me.
I'm trying to compile the typescript, tsx, and python parsers for use with neovim, but when I run gcc -o parser.so -shared src/parser.c -Os -I./src as instructed by the tree-sitter tracking issue I get:
Undefined symbols for architecture x86_64:
"_tree_sitter_tsx_external_scanner_create", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_deserialize", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_destroy", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_scan", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
"_tree_sitter_tsx_external_scanner_serialize", referenced from:
_tree_sitter_tsx.language in parser-eb4e9b.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've run the npm build steps, and tried the make file in build, but I'm not able to get the final .so files.
the error undefined symbol: tree_sitter_parsername_external_scanner_create also appears, when there is a mismatch between parser name and function names
// grammar.js
name: 'parsername',
// scanner.cc
void *tree_sitter_oldparsername_external_scanner_create() {
return new Scanner();
}
quickfix: replace name in scanner source
sed -i -E 's|(tree_sitter)_oldparsername_|\1_parsername_|g' src/scanner.*
Some grammars have external scanners - hand written C/C++ source files that are by convention called scanner.c or scanner.cc, which need to be compiled along with parser.c.
I use zxing lib in my OS X application. I've included zxing-objc to my project and simply copy-pasted code from zxing demo (zxing-root/objc/examples/demo) to the separate ViewController class. When trying to compile project, I get the following linker errors:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_QTCaptureDevice", referenced from:
objc-class-ref in ScanViewController.o
"_OBJC_CLASS_$_ZXCapture", referenced from:
objc-class-ref in ScanViewController.o
"_QTMediaTypeMuxed", referenced from:
-[ScanViewController performVideoSourceScan] in ScanViewController.o
"_QTMediaTypeVideo", referenced from:
-[ScanViewController performVideoSourceScan] in ScanViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've carefully checked all code and compared my project properties (including c++ compiler options) to demo project properties, and everything is done right.
You need to add the necessary frameworks to your app target. You can look in the sample app for an example. Select the target in Xcode, select Build Phases, and open the Link With Libraries entry. You'll see that it includes both QuartzCore and zxing-objc-framework. It sounds like you don't have those in your project.
I have been forced to return to an old bugbear lately: compiling a fortran script to run under Matlab on Mac. I have managed to compile the example c file to mex but the Fortran file refuses unless I use -c and the object of my desire, kt3d.for, throws up a whole list of fun but all linked to the same error (I guess).
I'm running Matlab R2011b on OSX 10.7.5 with XCode 4.6.1.
I've patched Matlab according http://www.mathworks.se/support/solutions/en/data/1-FR6LXJ/
Got a Fortran compiler running according to https://sites.google.com/site/dwhipp/tutorials/mac_compilers
I altered the mex file to call bash rather than sh but still no joy. Getting tired of having to boot up my old XP machine every time I want to run a kriging package so I would really like to compile these things for OSX.
Below is the error, it looks like an architecture issue but I cant figure out how to fix it.
>> mex kt3d.for
Undefined symbols for architecture x86_64:
"_chknam_", referenced from:
_readparm_ in kt3d.o
"_cova3_", referenced from:
_kt3d_ in kt3d.o
"_ktsol_", referenced from:
_kt3d_ in kt3d.o
"_mexfunction_", referenced from:
-exported_symbol[s_list] command line option
"_picksup_", referenced from:
_kt3d_ in kt3d.o
"_setrot_", referenced from:
_kt3d_ in kt3d.o
"_setsupr_", referenced from:
_kt3d_ in kt3d.o
"_srchsupr_", referenced from:
_kt3d_ in kt3d.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
mex: link of ' "kt3d.mexmaci64"' failed.
Error using mex (line 206)
Unable to complete successfully.
I believe those symbols are found in GSLIB. Assuming you have this installed and somewhere that your compiler can find it, you may need to add something like "-lgslib" to your mex command to get it to link the library for you.
I'm using Qt4.8 on OSX Leopard and instead of qmake+QtCreator I want to compile a very simple project using CMake on OSX to understand how to do a package.
While the very same project compiles and links smoothly under Linux, under my OSX box, this is the error message I always get in the linking phase:
ld warning: in /Library/Frameworks//QtGui.framework/QtGui, file is not of required architecture
ld warning: in /Library/Frameworks//QtCore.framework/QtCore, file is not of required architecture
Undefined symbols:
"QWidget::mousePressEvent(QMouseEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QObject::childEvent(QChildEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QWidget::actionEvent(QActionEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QCoreApplication::translate(char const*, char const*, char const*, QCoreApplication::Encoding)", referenced from:
etcetera etcetera.
This happens for every project I want to compile with cmake.
Any idea of what's going on?
Check what architecture (i386,x86_64) is being used by cmake (CMAKE_OSX_ARCHITECTURES). Try suggesting the architecture to cmake:
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64