Compiling Boost 1.54 XCode5 for device - fatal error: error in backend: symbol '___umodsi3' can not be undefined in a subtraction expression - c++

I have been able to successfully compile boost 1.54 for the iOS 7.0 simulator using XCode 5, but when trying to compile for device getting this strange clang failure:
darwin.compile.c++ bin.v2/libs/atomic/build/darwin-7.0~iphone/release/architecture-arm/link-static/macosx-version-iphone-7.0/target-os-iphone/threading-multi/lockpool.o
fatal error: error in backend: symbol '___umodsi3' can not be undefined in a subtraction expression
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: arm-apple-darwin12.5.0
Thread model: posix
Here are my user-config.jam settings:
using clang : : : <cxxflags>"-std=c++11 -stdlib=libc++" <linkflags>"-stdlib=libc++" ;
using darwin : 7.0~iphone
: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
: <striper> <root>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
<compileflags>"-arch armv7"
<compileflags>"-arch armv7s"
<compileflags>-mthumb
<compileflags>-fvisibility=hidden
<compileflags>-fvisibility-inlines-hidden
<compileflags>-std=c++11
<compileflags>-stdlib=libc++
<compileflags>-miphoneos-version-min=5.1
<compileflags>-D_LITTLE_ENDIAN
<compileflags>"-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk"
: <architecture>arm <target-os>iphone
;
using darwin : 7.0~iphonesim
: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
: <striper> <root>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
<compileflags>"-arch i386"
<compileflags>-fvisibility=hidden
<compileflags>-fvisibility-inlines-hidden
<compileflags>-std=c++11
<compileflags>-stdlib=libc++
<compileflags>-miphoneos-version-min=5.1
<compileflags>-D_LITTLE_ENDIAN
<compileflags>"-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk"
: <architecture>x86 <target-os>iphone
;
Detailed steps to reproduce:
1. Download and extract the latest sources for boost 1.54
2. Create a user-config.jam in user's home directory (w text above).
3. Run ./bootstrap.sh in the boost directory
4. Run
./b2 toolset=darwin-7.0~iphone architecture=arm target-os=iphone macosx-version=iphone-7.0 threading=multi linkflags=-stdlib=libc++ define=_LITTLE_ENDIAN link=static install
This will result in the error above.
For comparison, when compiling for the simulator with the following line:
./b2 toolset=darwin-7.0~iphonesim architecture=x86 target-os=iphone macosx-version=iphone-7.0 threading=multi linkflags=-stdlib=libc++ link=static install
This works fine and correctly generates the boost libraries for use with the simulator.
Would anyone have a suggestion as to what could be causing this? Is it a clang compiler problem or am I using the device compile incorrectly? I have been able to compile for device with XCode 4.x with no problem previously...
Thanks!
Daniel

I may have found the answer. Use
<compileflags>-mno-thumb
instead of:
<compileflags>-mthumb
Works for me now.

Related

Problem with clang compiler with libc++ on Ubuntu

I wrote a program (using coroutines), and tried to compile it with clang 9 on Ubuntu 18.04.4 LTS, but I get this error:
$ clang++-9 -stdlib=libc++ -std=c++2a coroutins_iterator.cpp
/usr/bin/ld: cannot find -lc++abi
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I compile my program? What is going wrong?
I installed libc++ with
sudo apt-get install libc++-dev
You installed the wrong version of libc++, it seems. From what I can tell libc++-dev refers to version 6, not 9, in the Ubuntu 18.08 repositories. For Clang 9 you would want to install the corresponding version of libc++:
sudo apt-get install libc++-9-dev
This should also install the matching version of libc++abi.

Pyfasttest installation failure on Mac OS: fatal error: 'random' file not found

ERROR MESSAGES:
src/pyfasttext.cpp:648:10: fatal error: 'random' file not found
#include .
^~~~~~~~ .
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
Have installed gcc and LLVM...
UK-xxxx:vercheng$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.40.1)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
tried this: https://github.com/vrasneur/pyfasttext/issues/24
didn't help
Thanks
First, install Cython in order to install fasttext by this command:
pip install Cython --install-option="--no-cython-compile"
Now install fasttext using this command:
pip install fasttext

clang compile failed on mariadb

system is CentOS(VirtualBox) x64
I had "yum install" and "yum check" cmake clang gcc libstdc++ and compat-libstdc++*
I had link cmake to clang
I had compile a "HelloWorld" program by clang successed
then,
I try to compile mariadb'code use : "cmake . -DBUILD_CONFIG=mysql_release".
I got error like this:
...
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/clang++" is not able to compile a simple test
program.
...
/usr/bin/ld: cannot find -lstdc++
...
How can I fix this problem? Thanks very much!
(Please forgive me for my poor English T_T)
Getting libstdc++-devel, etc. etc. c++ : # yum install gcc-c++

luarocks 'gcc-plugin.h' build error

I am trying to use torch together with the hdf5 package. I am trying to install it via luarocks install hdf5 but during the build phase I get an error regarding the gcc-plugin header. (gcc relies on clang backend). The complete error message is:
luarocks install --local hdf5
Installing https://luarocks.org/hdf5-2.0.0-1.src.rock...
Using https://luarocks.org/hdf5-2.0.0-1.src.rock... switching to 'build' mode
Warning: variable CFLAGS was not passed in build_variables
gcclua-config.h:1:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
^
1 error generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -c -o gcclua.o -Iplugin/include -fPIC -O2 -Wall -Wformat-security -I/usr/local/Cellar/lua/5.2.4_3/include gcclua.c
gcclua.c:7:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
^
1 error generated.
make[2]: *** [gcclua.o] Error 1
make[1]: *** [gcc] Error 2
make: *** [gcc-lua] Error 2
Just to give more information, I am relying on
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
xcrun: error: couldn't stat toolchain: '/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.11.xctoolchain' (errno=No such file or directory)
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Does anybody has maybe a hint how to fix this issue?
Every help is greatly appreciated!!!
In addition to gcc, you need the headers, which on Linux you can get with sudo apt-get install gcc-4.8-plugin-dev. If you're on a different OS or version of gcc, just substitute the appropriate package manager / gcc version number.
gcc-plugin.h is a part of GCC, so I think you'll really need to install gcc to get that. Clang provides a gcc-compatible front-end script but that merely presents a command-line driver with compatible flags.
You should be able to install GCC using Homebrew: https://apple.stackexchange.com/a/86588
I bet you tried to work on a CS287-16 class :). I have contacted the developer of this library who wasn't that easy to do something to solve the problem. Apparently he has no friends who have a Mac PC... As a workaround I could suggest you to use a Docker container with Linux in it to run Lua scripts. That's what I have ended up with...
Here's the Docker image I was talking about: https://github.com/aoboturov/cs287-16-lua. You could build it yourself and the just run as a Docker container :)

Installing gevent on Mavericks (Enthought Canopy python)

Has anyone had any luck building gevent 1.0 in Mavericks?
I've tried the following:
pip (as recommended on the gevent package index)
easy_install
compiling from source
I keep getting the same error when building 'gevent.core':
...
building 'gevent.core' extension
creating build/temp.macosx-10.6-i386-2.7/gevent
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.6.sdk
Please check your Xcode installation
gcc -DNDEBUG -g -O3 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -U__llvm__ -
DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CHECK_ENABLE=0 -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0
-DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.6-i386-2.7/libev -Ilibev -
I/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-
10.6-i386-2.7/gevent/gevent.core.o
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
In file included from gevent/gevent.core.c:17:
/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7/Python.h:33:10: fatal error:
'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
error: command 'gcc' failed with exit status 1
Seems to be a problem with XCode. I made sure I have the XCode (v. 5.0.2) command line tools installed with:
xcode-select --install
But that didn't seem to change anything. Apparently I'm not alone with this problem (a missing /Developer/SDKs/MacOSX10.6.sdk), but I'd like to stick with Enthought's Canopy version of python if I can (and have already spent too much time combing the Apple Developer site to try download MacOSX10.6.sdk directly).
Any suggestions that don't involve starting over with a macport'ed python? Thanks!
IIUC, Apple pulled a fast one on the latest XCode, such that gcc is no longer actually gcc, but is symlinked to clang, which is not compatible with standard Pythons, including Canopy's.
It should work better if you install Xcode 3.2.1 Developer Tools from https://developer.apple.com/downloads/index.action
For me the hint on gevent website helped:
pip install cython git+git://github.com/gevent/gevent.git#egg=gevent