concorde with Apple Silicon M1 - c

I am trying to install concorde linked with QSOPT following these instructions. Regarding QSOPT, I dowloaded files from section Intel MacOS 10.6 (64-Bit). But, as I have Apple M1 chip, it does not work. I think that the problem is in the arm64 architecture in terms of QS, however with other more commercial software for Intel processor, I do not face any issue thanks to Rosetta.
The error I am facing when I run
./configure --host=darwin --with-qsopt=fullpath/QS
is
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [concorde] Error 1
Cross-posted on Stack Exchange - Operation Research

Thanks to the support of Bill Cook, it is now available a version of qsopt.a for the M1 Apple Chip on the QSOPT download page. This perfectly worked for me by run
./configure --host=darwin --with-qsopt=fullpath/QS

Related

Installing Tensorflow Lite with CMake

I am trying to install Tensorflow Lite on Raspberry Pi Zero W. I followed the steps from the official website (https://www.tensorflow.org/lite/guide/build_cmake_arm). But I get the following error message:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /home/pi/toolchains/arm-rpi-linux-gnueabihf/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc
-- Check for working C compiler: /home/pi/toolchains/arm-rpi-linux-gnueabihf/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/home/pi/toolchains/arm-rpi-linux-gnueabihf/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/pi/Project/cmake-3.16.0/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_ed1a3/fast && /usr/bin/make -f CMakeFiles/cmTC_ed1a3.dir/build.make CMakeFiles/cmTC_ed1a3.dir/build
make[1]: Entering directory '/home/pi/Project/cmake-3.16.0/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_ed1a3.dir/testCCompiler.c.o
/home/pi/toolchains/arm-rpi-linux-gnueabihf/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc -march=armv6 -mfpu=vfp -funsafe-math-optimizations -o CMakeFiles/cmTC_ed1a3.dir/testCCompiler.c.o -c /home/pi/Project/cmake-3.16.0/CMakeFiles/CMakeTmp/testCCompiler.c
/home/pi/toolchains/arm-rpi-linux-gnueabihf/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc: 1: /home/pi/toolchains/arm-rpi-linux-gnueabihf/x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc: Syntax error: ")" unexpected
make[1]: *** [CMakeFiles/cmTC_ed1a3.dir/build.make:66: CMakeFiles/cmTC_ed1a3.dir/testCCompiler.c.o] Error 2
make[1]: Leaving directory '/home/pi/Project/cmake-3.16.0/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_ed1a3/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:44 (project)
Configuring incomplete, errors occurred!
See also "/home/pi/Project/cmake-3.16.0/CMakeFiles/CMakeOutput.log".
See also "/home/pi/Project/cmake-3.16.0/CMakeFiles/CMakeError.log".
Does anyone know how to fix the problem?
I ran into the same problem like you!
The instructions given at https://www.tensorflow.org/lite/guide/build_cmake_arm?hl=en are not intended to be executed on the Raspberry Pi (at least the last ones).
Let me share, what I'll figured out.
Short answer:
you're trying to run a cross-compile of TensorFlow Lite for an ARM made for x86 platform on an ARM system (your Raspberry Pi). What you're trying to do actually needs to be done on an x86 platform.
(on the top of the tutorial page is a hint: "following instructions have been tested on Ubuntu 16.04.3 64-bit PC (AMD64)" which reveals that the commands have been run on x86)
Some details:
The message ‘Syntax error: "(" unexpected’ probably comes from a shell. Why is a shell trying to execute your binary? Because the kernel tried and gave up. Why did the kernel fail to run the program? Because the executable is not in a supported format -> meant to be run on x86 but was executed on ARM.
https://unix.stackexchange.com/questions/336436/syntax-error-unexpected-when-execute-a-compiled-c-program
With older TensorFlow versions it was possible to compile TF lite on the Raspberry Pi itself via the
./tensorflow-2.4.1/tensorflow/lite/tools/make/download_dependencies.sh /and build_aarch64_lib.sh scripts.
However, this scripts got removed in version 2.8 (or even with an earlier version before). See note in the Readme of the Git: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tools/make/README.md
Using Python for inference
Unfortunately I have no real solution how to compile / built TensorFlow Lite on the Raspberry itself. I personally ended up using Python (only needed inference) and followed this Tutorial:
https://qengineering.eu/install-tensorflow-2.7-on-raspberry-64-os.html

Issues with compiling ARM binary for STM on Apple MAC book

I am trying to compile a project on Mac but I am getting lots of errors. It compiles fine on Linux. I reference the toolkit included with STM workshop.
When running cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../../tools/toolchain/nucleo_f746zg.cmake from /build/debug, I get the following output..
/var/folders/fg/ldkpxwvn45v5y854s4zsw_b00000gn/T//ccBDWJKO.s:404: Error: selected processor does not support `dsb' in ARM mode
/var/folders/fg/ldkpxwvn45v5y854s4zsw_b00000gn/T//ccBDWJKO.s:407: Error: selected processor does not support `isb' in ARM mode
make[2]: *** [platform/nucleo-f746zg/CMakeFiles/alesi-platform-nucleo-f746zg.dir/osal/freertos/os_context.c.obj] Error 1
make[1]: *** [platform/nucleo-f746zg/CMakeFiles/alesi-platform-nucleo-f746zg.dir/all] Error 2
make: *** [all] Error
Does anyone have advice for this? How can I compile the code for ARM?
I am running ARM GNU tools and using arm-none-eabi-g++ and arm-none-eabi-gcc compilers.
The STM32 family of microcontrollers is based on Cortex cores, they're not able to run ARM instructions set, they use Thumb-1 and Thumb-2.
For the STM32F4 family I use flags like -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16.
The readme.txt from gcc-arm-embedded can give you some hints on how to select the most appropriate flags for your target architecture.
If you are a beginner just install a ready made IDE with toolchain. Google for openSTM32. It is an eclipse + plugins + toolchain.
It will save you many days of googling and configuring

Issue compiling with f77 on OSX 10.11

I have been trying to run this model, written some decades ago by someone else. I've built the libraries, but when I try to actually run the program, I get the following error:
f77 -o mimics1.5 ../source/*.o trunk_hght_f.f
trunk_hght_f.f:
trunk_hght_func:
Undefined symbols for architecture x86_64:
"MAIN__", referenced from:
-u command line option
(maybe you meant: _MAIN__)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am on MacOSX 10.11, and which f77 gives /usr/local/bin/f77 and f77 -v gives back:
Cynthias-MacBook-Pro-2:input_dir cynthiag$ f77 -v
/usr/local/bin/f77 script based on f2c:
f2c (Fortran to C Translator) version 20100827.
Should f77 be in /usr/bin/instead?
ld seems to be the problem, so I followed instruction from HERE to try to solve it, but it looks like my XCode is up to date, that my libraries are built and linked (as far as I can tell), and I even reinstalled binutils to make sure ld was in teh right place, but no success.
which ld gives : /usr/bin/ld and ld -v gives:
Cynthias-MacBook-Pro-2:input_dir cynthiag$ ld -v
#(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
LTO support using: LLVM version 7.3.0
I am new to fortran, so I probably messed up when setting up f77, but I've been stuck on this problem for a few days now, so any help would be greatly appreciated!
In the end, it seem like the solution for me was just to use gfortran instead of f77. This involved carefully switching all the mentions to f77 in the model (i.e. in all the Makefiles) and replacing them by gfortran.
A clean install of the libraries was then necessary, since apparently a library compiled in f77 will not be compatible with gfortran.
Finally, the model was calling on some executable without ./ which caused the model to failed.
Unfortunately, I can't give an explanation as to why f77 was failing, but gfortran was a lot easier to set up than f77/f2c and worked great, so it's probably the way to go.

OpenSSL ecc function with macos xcode?

I am trying to use the function EC_KEY_new_by_curve_name(NID_secp256k1) present in openssl. However, when I compile, I get the following error:
undefined symbols for architecture x86_64:
"_EC_KEY_new_by_curve_name", referenced from:
CKey::CKey() in bitcoin.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 have been hinted that macos openssl is not compile with the ECC extensions. Is the problem? If so, how do I correct it?
If you're using the OpenSSL library that comes with MacOS SDK, then it should automatically have 64-bit support built in.
Looking at the first hit on Google, I'm wondering if you are just not including the correct library in your XCode project. Did you get -lcrypto into the project settings, or forget to add libCrypto.dylib to your list of libraries in the project?
On my SnowLeopard (10.6) machine, I see the symbols are defined in libCrypto:
[/usr/lib]:; nm -arch x86_64 libcrypto.0.9.8.dylib | egrep -i new_by_curve
00000000000a4ac0 T _EC_GROUP_new_by_curve_name
00000000000ab540 T _EC_KEY_new_by_curve_name

MacRuby 0.10 HotCocoa unsupported file format which is not the architecture being linked (i386)

I've installed MacRuby (via rvm):
$ ruby -v
MacRuby 0.10 (ruby 1.9.2) [universal-darwin10.0, x86_64]
And LLVM (via homebrew):
$ llvmc --version
Low Level Virtual Machine (http://llvm.org/):
llvm version 2.9
Optimized build.
Built Jun 3 2011 (10:06:35).
Host: x86_64-apple-darwin10
Host CPU: corei7
Registered Targets:
(none)
When I run rake, I get an error:
$ rake
(in /Users/briankierstead/dev/kci/macruby/hourz)
ld: warning: in /Library/Frameworks//MacRuby.framework/MacRuby, file was built for
unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_macruby_main", referenced from:
_main in ccvGpB6J.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/qm/qm1gYJL6Fa4uPhnq239pak+++TI/-Tmp-//ccS18qN4.out (No such file or directory)
I don't want to run xcode4, which allows you specify x86_64 as the output.
How can I resolve this issue? It looks like somewhere in the chain, 32-bit is being specified. I've tried compiling with flags, and running rake as:
env UNIVERSAL=1 UNIVERSAL_ARCH="x86_64" ENABLE_OPTIMIZED=1
and
RC_ARCHS=x86_64 rake
But none of these makes a difference. I get the same error.
I'm on Snow Leopard - 10.6.7.
Using hotcocoa from this repo solves the problem. The published version is outdated and ignores architecture.
Not ideal, but at least it works until the published version catches up.
Thanks goes to #watson1978
This worked, but gave rise to another error: LSOpenURLsWithRole() failed with error -10810
I had to install BridgeSupport and then everything worked fine.

Resources