Conda Build fails packaging C++ project - c++

I'm trying to create a recipe for the library here: https://github.com/hyrise/sql-parser
I'm building for OSX 10.13.
My build.sh looks like this:
#!/bin/bash
make VERBOSE=1
make DESTDIR="$PREFIX" install
I've also set up my SDK as per here: https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html#macos-sdk
I can build the project fine outside of conda build, however conda build fails with the below issue:
x86_64-apple-darwin13.4.0-clang++ -std=c++1z -Wall -Werror -O3 -fPIC -c -o src/SQLParser.o src/SQLParser.cpp
In file included from src/SQLParser.cpp:2:
In file included from src/SQLParser.h:4:
In file included from src/SQLParserResult.h:4:
In file included from src/sql/SQLStatement.h:4:
In file included from /Users/j/miniconda3/envs/p37/conda-bld/sql-parser_1583094509703/_build_env/bin/../include/c++/v1/vector:265:
In file included from /Users/j/miniconda3/envs/p37/conda-bld/sql-parser_1583094509703/_build_env/bin/../include/c++/v1/iosfwd:90:
/Users/j/miniconda3/envs/p37/conda-bld/sql-parser_1583094509703/_build_env/bin/../include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
^~~~~~~~~
1 error generated.
make: *** [Makefile:66: src/SQLParser.o] Error 1
I can see wchar.h is in that dir
JMBA:v1 j$ ls -l /Users/j/miniconda3/envs/p37/conda-bld/sql-parser_1583094509703/_build_env/bin/../include/c++/v1 | grep wchar
-rw-rw-r-- 41 j staff 6272 28 Oct 2018 cwchar
-rw-rw-r-- 41 j staff 8080 28 Oct 2018 wchar.h
Any help on this would be appreciated.

You need to find a way to get -I$BUILD_PREFIX/include to the invocation of g++ / gcc

Related

'fatal error: 'wchar.h' file not found' error with the new macos 11.3 update

I'm totally new to c++ (just started learning from scratch yersterday).
Today I had this macos update to 11.3 and now when I run my c++ code in clion I get this error,
====================[ Build | untitled | Debug ]================================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/nibin/CLionProjects/untitled/cmake-build-debug --target untitled -- -j 6
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk' [-Wmissing-sysroot]
In file included from /Users/nibin/CLionProjects/untitled/main.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:37:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:214:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:95:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
^~~~~~~~~
1 error generated.
make[3]: *** [CMakeFiles/untitled.dir/main.cpp.o] Error 1
make[2]: *** [CMakeFiles/untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled.dir/rule] Error 2
make: *** [untitled] Error 2
I scoured the internet but didn't understand a word. I did try some of it and got this in my terminal,
➜ ~ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
➜ ~ xcrun --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
➜ ~ sudo xcode-select --switch /Library/Developer/CommandLineTools/
Password:
➜ ~ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
I already have xcode tools and its up to date. I tried one of the solutions which was to change the path but still didn't work. So I just brought back the files to its original location,
➜ ~ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
➜ ~ xcrun --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
There was another solution which I tried and got an error,
➜ ~ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
The file /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg does not exist.
I opened the /Library/Developer/CommandLineTools/ and I got this,
➜ ~ cd /Library/Developer/CommandLineTools
➜ CommandLineTools ls
Library SDKs usr
Some solutions involving clearing the cache "Delete any old CMakeCache.txt in current project and dependencies and rebuild solves the problem." Sorry if this sounds dumb but I'm don't quite understand it. Does it mean we have to delete the entire file CMakeCache.txt or is it just the contents.
"We suppose that Tools | CMake | Reset Cache and Reload project should help in this case."
(https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000919219-Clion-can-t-compile-because-of-wchar-h-not-found-after-updated-Mojave-in-mac-)
That worked for me

Why is g++ linked to clang, not clang++, by the mac developer tools?

I was just trying to explain to someone the difference between compiled and interpreted code, when I was greeted with a
main.cpp:1:10: fatal error: 'iostream' file not found
when calling g++ main.cpp for a simple hello world c++ file.
I looked into this a bit and found ...
JM:Desktop user$ which g++
/usr/local/bin/g++
JM:Desktop user$ ls -al /usr/local/bin/g++
lrwxr-xr-x 1 user admin 47 4 Dez 2018 /usr/local/bin/g++ -> /Library/Developer/CommandLineTools/usr/bin/c++
JM:Desktop user$ ls -al /Library/Developer/CommandLineTools/usr/bin/c++
lrwxr-xr-x 1 root wheel 5 3 Feb 20:29 /Library/Developer/CommandLineTools/usr/bin/c++ -> clang
...that g++ is linked to clang and not clang++ and I therefore call the C-compiler.
I just deleted the Developer tools and installed them again - same thing.
Is this normal or did something mess up my system? Does it make any sense? What am I missing?
Thanks for the help!
It may actually be Homebrew's fault somehow...
JM:Desktop user$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
/usr/local/bin is added by Homebrew.
'C++' for example links correctly to clang++ but it is in /usr/bin:
JM:Desktop user$ which c++
/usr/bin/c++
...and so is /usr/bin/g++.
I solved it by just deleting /user/local/bin/g++. The links are still strange.

codelite unittest++/UnitTest++.h: no such file or directory

I am trying to do unit testing with C++/Codelite. I have UnitTest++ plugin installed from codelite-plugins package (Ubuntu 18.04). I can also see this:
$ ls -la /usr/include | grep Unit
drwxr-xr-x 3 root root 4096 Mar 2 11:47 UnitTest++
$ sudo dpkg -l | grep unittest++
ii libunittest++-dev 2.0.0-2 amd64 unit testing framework for c++, static library and headers
ii libunittest++2:amd64 2.0.0-2 amd64 unit testing framework for c++, runtime library
So I create a test project in Codelite and I add this:
#include <unittest++/UnitTest++.h> // This line and main are auto-created
TEST(SanityTest)
{
CHECK_EQUAL(1, 1);
}
int main(int argc, char **argv)
{
return UnitTest::RunAllTests();
}
Now I would expect test results after I press CTRL+F5. But when I do, I only get a popup window saying there are no tests:
I also noticed that when I go to Build > Build Project I get an error message:
fatal error: unittest++/UnitTest++.h: No such file or directory
I also found THIS ANSWER and tried different variation of console commands as per answer/comments there, but I always get the same no such file or directory error.
Any idea what I am missing?
EDIT:
Build log as per Stephen's Newell request:
/bin/sh -c '/usr/bin/make -j8 -e -f Makefile'
----------Building project:[ Test - Debug ]----------
make[1]: Entering directory '/home/callmebob/Documents/workspace-codelite/cpp/Test'
/usr/bin/g++ -c "/home/callmebob/Documents/workspace-codelite/cpp/Test/main.cpp" -g -o Debug/main.cpp.o -I. -I/usr/include/unittest++
/home/callmebob/Documents/workspace-codelite/cpp/Test/main.cpp:1:10: fatal error: unittest++/UnitTest++.h: No such file or directory
#include "unittest++/UnitTest++.h"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Test.mk:95: recipe for target 'Debug/main.cpp.o' failed
make[1]: *** [Debug/main.cpp.o] Error 1
make[1]: Leaving directory '/home/callmebob/Documents/workspace-codelite/cpp/Test'
Makefile:4: recipe for target 'All' failed
make: *** [All] Error 2
====2 errors, 0 warnings====
Also if I right-click the project, go to Settings > Compiler, I can see:
Included Paths = /usr/include/unittest++
Based on your ls output, it looks like you should change your first line to this:
#include <UnitTest++/UnitTest++.h>
I'm not sure why the answer you linked to worked with a lowercase directory name; the examples in the project documentation all use the mixed-case directory name.

"string.h" not found message in building qt app for iOS

I've recently updated Xcode to version 10.0 and after that when I try to build version for iOS I've the following problem.
1:04:17: Running steps for project Diasteca...
11:04:17: Starting: "/Users/belladellifabio/Qt/5.11.1/ios/bin/qmake" /Users/belladellifabio/Desktop/QtProjects/Diasteca/mqtt_test/mqtt_test.pro -spec macx-ios-clang CONFIG+=iphoneos CONFIG+=device CONFIG+=qml_debug
Project MESSAGE: This project is using private headers and will therefore be tied to this specific Qt module build version.
Project MESSAGE: Running this project against other versions of the Qt modules may crash at any arbitrary point.
Project MESSAGE: This is not a bug, but a result of using Qt internals. You have been warned!
11:04:18: The process "/Users/belladellifabio/Qt/5.11.1/ios/bin/qmake" exited normally.
11:04:18: Starting: "/usr/bin/make" qmake_all
make: Nothing to be done for `qmake_all'.
11:04:18: The process "/usr/bin/make" exited normally.
11:04:18: Starting: "/usr/bin/make"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -fPIC -std=gnu++11 -arch arm64 -arch x86_64 -Xarch_arm64 -miphoneos-version-min=12.0 -Xarch_arm64 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk -Xarch_x86_64 -mios-simulator-version-min=12.0 -Xarch_x86_64 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk -fobjc-nonfragile-abi -fobjc-legacy-dispatch -fembed-bitcode-marker -Wall -W -DQT_COMPILER_SUPPORTS_SSE2 -DMQTT_TEST_LIBRARY -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../Diasteca/mqtt_test -I. -I../../../../Qt/5.11.1/ios/mkspecs/common/uikit -I../../../../Qt/5.11.1/ios/include -I../../../../Qt/5.11.1/ios/include/QtNetwork -I../../../../Qt/5.11.1/ios/include/QtCore/5.11.1 -I../../../../Qt/5.11.1/ios/include/QtCore/5.11.1/QtCore -I../../../../Qt/5.11.1/ios/include/QtCore -I. -I../../../../Qt/5.11.1/ios/mkspecs/macx-ios-clang -o qmqttclient.o ../../Diasteca/mqtt_test/qmqttclient.cpp
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk' [-Wmissing-sysroot]
In file included from ../../Diasteca/mqtt_test/qmqttclient.cpp:30:
In file included from ../../Diasteca/mqtt_test/qmqttclient.h:33:
In file included from ../../Diasteca/mqtt_test/qmqttglobal.h:33:
In file included from ../../../../Qt/5.11.1/ios/include/QtCore/qglobal.h:47:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:202:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
Probably the real problem is not the file not found error, but is connected to the fact that qty tries to build the app using an SDK that is no more installed on the system. Is this a qt problem? How could I specify the version of iOS SDK to use to build the app? Is it possible?
Finally, I've found and delete .qmake.cache and .qmake.stash files. I've restart QtCreator and now it seems to work.
Qt stores SDK information somewhere deep in the build output and the .pro.user file.
Remove the user file (you might want to backup your user file in case you have custom build steps), the complete (shadow) build tree and modify your .pro file so that there is no such line as QMAKE_MAC_SDK = macosx10.13.
Then call qmake and build your project again, the inconsistency should be gone.
This occurs when the iOS SDK that Qt is expecting is different than the iOS SDK that you have installed. For instance Qt 5.13.1 expects iPhoneOS13.1.sdk but my Xcode currently has iPhoneOS13.2.sdk:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
$ ls -l
total 0
drwxrwxr-x 7 root wheel 224 Nov 5 2019 iPhoneOS.sdk
lrwxr-xr-x 1 root wheel 12 Jan 15 2020 iPhoneOS13.2.sdk -> iPhoneOS.sdk
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
$ ls -l
total 0
drwxrwxr-x 8 root wheel 256 Jul 22 14:14 iPhoneSimulator.sdk
lrwxr-xr-x 1 root wheel 19 Jan 15 2020 iPhoneSimulator13.2.sdk -> iPhoneSimulator.sdk
To remedy this, we can get Qt to use the iPhoneOS13.2.sdk:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
$ ls -l
total 0
drwxrwxr-x 7 root wheel 224 Nov 5 2019 iPhoneOS.sdk
lrwxr-xr-x 1 root wheel 12 Jan 15 2020 iPhoneOS13.2.sdk -> iPhoneOS.sdk
$ sudo ln -s iPhoneOS.sdk iPhoneOS13.1.sdk
$ ls -l
total 0
drwxrwxr-x 8 root wheel 256 Jul 22 14:20 iPhoneOS.sdk
lrwxr-xr-x 1 root wheel 12 Jul 22 14:20 iPhoneOS13.1.sdk -> iPhoneOS.sdk
lrwxr-xr-x 1 root wheel 12 Jan 15 2020 iPhoneOS13.2.sdk -> iPhoneOS.sdk
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
$ ls -l
total 0
drwxrwxr-x 8 root wheel 256 Jul 22 14:14 iPhoneSimulator.sdk
lrwxr-xr-x 1 root wheel 19 Jan 15 2020 iPhoneSimulator13.2.sdk -> iPhoneSimulator.sdk
$ sudo ln -s iPhoneSimulator.sdk iPhoneSimulator13.1.sdk
$ ls -l
total 0
drwxrwxr-x 8 root wheel 256 Jul 22 14:14 iPhoneSimulator.sdk
lrwxr-xr-x 1 root wheel 19 Jul 22 14:39 iPhoneSimulator13.1.sdk -> iPhoneSimulator.sdk
lrwxr-xr-x 1 root wheel 19 Jan 15 2020 iPhoneSimulator13.2.sdk -> iPhoneSimulator.sdk
I met a similar problem, because my xcode project was created by different XCode SDK, and it's generated by CMake, so I deleted the cache and solved the problem.

Building boost library

I'm trying to build boost library under Arch Linux
$ uname -a
Linux wincode 2.6.37-ARCH #1 SMP PREEMPT Fri Feb 25 07:53:43 CET 2011 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 5200+ AuthenticAMD GNU/Linux
$ python --version
Python 3.2
$ ls /usr/include/python
python2.7/ python3.2mu/
$ ls /usr/lib/python
python2.6/ python2.7/ python3.1/ python3.2/
I'm building it using aur-repo. The auto-compile script could be found here.
Now I get:
./boost/python/*:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.
at almost any file from boost.python library. So something is wrong with python and boost can't find it. At the end of the compiling I got:
...failed updating 336 targets...
...skipped 48 targets...
...updated 13264 targets...
Any help?
Quick google search comes up with http://lists.boost.org/boost-build/2006/04/13457.php.
Basically, add your python include directory to the include search paths.