I'm trying to build a STM32 project on MacBook M1 with CMake and arm-none-eabi-gcc.
These are my CMake codes:
cmake_minimum_required(VERSION 3.0.0)
project(Embedded VERSION 0.1.0)
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
add_compile_options(-g -mcpu=cortex-m4 -O2 -Wall -Werror -Wmissing-prototypes -mlittle-endian -fsingle-precision-constant -Wdouble-promotion)
add_executable(Embedded main.c)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
How can I make CMake generate -march instead if -arch?
Related
I am new with CDO, and wanted to use it to merge several netcdf files on the time variable with
cdo mergetime pr_Amon_IITM-ESM_historical_r1i1p1f1_gn_199001-199912.nc pr_Amon_IITM-ESM_historical_r1i1p1f1_gn_201001-201412.nc output.nc
I just installed CDO on Mac following the instructions given here: https://thiagodossantos.com/post/1-mac-science-software/.
I have Version 1.9.9 and it seems to work fine, however it can't open any .nc file I have tried so far.
This is the error message I got:
cdo mergetime: Open failed on >pr_Amon_IITM-ESM_historical_r1i1p1f1_gn_199001-199912.nc<
No such file or directory
This is the Version I am using:
Climate Data Operators version 1.9.9 (https://mpimet.mpg.de/cdo)
System: x86_64-apple-darwin20.1.0
CXX Compiler: /opt/local/bin/g++-mp-10 -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -pthread
CXX version : g++-mp-10 (MacPorts gcc10 10.2.0_4) 10.2.0
C Compiler: /opt/local/bin/gcc-mp-10 -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -pthread -pthread
C version : gcc-mp-10 (MacPorts gcc10 10.2.0_4) 10.2.0
F77 Compiler: gfortran -pipe -Os -m64
F77 version : GNU Fortran (MacPorts gcc10 10.2.0_4) 10.2.0
Features: 8GB 4threads C++14 Fortran PTHREADS HDF5 NC4/HDF5 OPeNDAP SZ UDUNITS2 PROJ CURL FFTW3 SSE3
Libraries: HDF5/1.12.0 proj/5.2.0 curl/7.74.0
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
CDI library version : 1.9.9
ecCodes library version : 2.19.1
NetCDF library version : 4.7.4 of Jan 28 2021 10:09:27 $
hdf5 library version : 1.12.0
exse library version : 1.4.1
FILE library version : 1.9.1
I've also tried to reinstall it, but it didn't help. Any help is much appreciated!
P.S: I am also new with stack overflow, so please excuse me if I didn't ask the question correctly.
I was experiencing a similar problem, and I fixed it by closing that .nc by calling nc_close("file")-file after performing my calculations.
I'm writing a QML application using Qt 5.7 on Ubuntu 14.04. I prefer to use an editor other than Qt Creator, so it makes it slightly cumbersome to launch Qt Creator and switch to it just to press Ctrl-R each time I want to run. I'd like to compile and launch my app from the command line.
Following this answer and then this answer I was able to install qmake and make it the default:
sudo apt-get install qt5-qmake
sudo apt-get install qt5-default
Following this answer I am copying the qmake build command listed by Qt Creator in the Project tab and successfully building the make file:
qmake qt-client.pro -r -spec linux-g++
However, when I run make (on my already-working-in-Qt-Creator code) I get:
phrogz#Slub:~/Code/rb3jay/qt-client$ make
g++ -c -pipe -O2 -std=c++0x -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I. -I/usr/include/qt5 -I/usr/include/qt5/QtQuick -I/usr/include/qt5/QtQml -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:6:36: error: ‘AA_EnableHighDpiScaling’ is not a member of ‘Qt’
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
^
make: *** [main.o] Error 1
I'm guessing that perhaps the version of Qt being picked up by qmake or g++ is not the 5.7 version Qt Creator is using, since AA_EnableHighDpiScaling was added in Qt 5.6.
The full generated Makefile includes
99 references to /usr/include/qt5 and 179 references to /usr/lib/x86_64-linux-gnu/qt5. Qt 5.7 is installed in /home/phrogz/Qt5.7.0. Obviously I need to modify something in the qmake command to get this pointing elsewhere.
How can I get this to work? Do I need to somehow remove an older version of qt libraries installed by Ubuntu? Point some configuration to the version of Qt 5.7 that's now installed (by the Qt Installer) in my home directory? Replace existing/old Qt directories with symlinks?
Or you can use CMake:
cmake_minimum_required (VERSION 2.8.11)
project(myproject)
find_package(Qt5 5.7.0 REQUIRED COMPONENTS
Core
Quick
Widgets
)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(${PROJECT_NAME}
main.cpp
)
target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Quick
Qt5::Widgets
)
I asked this question on the Qt forums, but they seem to be pretty quiet these days.
I'm running the relatively new Qt Creator 2.6.2 (with Qt 5.0.1). When I try to build the debugger helper, I get the following error:
Building helper(s) with toolchain 'GCC (x86 64bit)'... Building helper
'GDB helper' in
/Developer/Applications/Qt/5.0.1/clang_64//qtc-debugging-helper/
Running /Developer/Applications/Qt/5.0.1/clang_64/bin/qmake -spec
macx-clang dumper.pro -nocache CONFIG+=x86_64 ...
Running /usr/bin/make all -k ... Error running '/usr/bin/make all -k'
in /Developer/Applications/Qt/5.0.1/clang_64//qtc-debugging-helper/:
The process returned exit code 2: clang++ -c -pipe
-mmacosx-version-min=10.6 -O2 -Wall -W -fPIC -DUSE_QT_CORE=1 -DUSE_QT_GUI=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../mkspecs/macx-clang -I. -I../include -I../include/QtWidgets -I../lib/QtWidgets.framework/Versions/5/Headers -I../include/QtGui -I../lib/QtGui.framework/Versions/5/Headers -I../include/QtCore -I../lib/QtCore.framework/Versions/5/Headers -I. -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -o dumper.o dumper.cpp make: clang++: No such file or directory make: *
[dumper.o] Error 1 make: Target `all' not remade because of errors.
Build failed.
So, I see that it's looking for a file called "clang++" which I evidently don't have. Can someone explain to me what the workaround for this is? I'm accustomed to just using the pre-built install packages for Qt.
Thanks.
You need to install command line tools package for Xcode which includes 'clang++' compiler.
You can find them here under Looking for additional developer tools? link.
I have Qt Creator installed on my Windows 7 machine and my target is an OMAP3 Embedded Linux board. I downloaded the target toolchain, Sourcery-G++ Lite for Windows, and also installed MinGW ( http://www.mingw.org/ ) on my Windows Machine. In QT Creator I added the CodeSourcery toolchain as a 'Manual' toolchain as shown in the image below. Then, I tried to build the demo Qt App 'analogclock' using this toolchain by editing 'Build Settings' under 'Projects' for the 'analogclock' demo app. But the toolchain is not available here under Build Settings as shown in the second image.
How can I achieve building this demo app, or any Qt app, from Qt Creator using the Code Sourcery Toolchain in the Build Options? I absolutely must use Windows to accomplish this ( cannot use Linux VM... ).
I believe it may have to do with building the Qt library for the target but am not sure if that is true or how to do that on Windows. I greatly appreciate your help and insight.
EDIT: New Information - need help configuring Qt Creator:
I've used the CodeSourcery toolchain to build the Qt 4.8 library with no error and I have the .so files in the /lib directory after following http://c2143.blogspot.com/?view=classic. Now I am trying to hook in the CodeSourcery compiler and built Qt 4.8 to Qt Creator so I can build an example app for the target board.
I read the following articles:
http://doc.qt.nokia.com/qtcreator-2.4/creator-project-qmake.html
http://doc.qt.nokia.com/qtcreator-2.4/creator-tool-chains.html
describing how to add a Qt version new toolchain to Qt Creator. Please see the images attached for how I've configured Qt Creator. I am using Qt Creator 2.4.1.
I'm getting an error without much information pasted below... Any thoughts on this or my configuration?
09:51:07: Running build steps for project analogclock...
09:51:07: Configuration unchanged, skipping qmake step.
09:51:07: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
arm-none-linux-gnueabi-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mthumb -mfpu=neon -mfloat-abi=softfp -Wa,-mimplicit-it=thumb -O2 -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I"..\qt-4.8-src\include\QtCore" -I"..\qt-4.8-src\include\QtNetwork" -I"..\qt-4.8-src\include\QtGui" -I"..\qt-4.8-src\include" -I"." -I"c:\QtSDK\Examples\4.7\widgets\analogclock" -I"." -I"..\qt-4.8-src\mkspecs\default" -o analogclock.obj c:\QtSDK\Examples\4.7\widgets\analogclock\analogclock.cpp
arm-none-linux-gnueabi-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mthumb -mfpu=neon -mfloat-abi=softfp -Wa,-mimplicit-it=thumb -O2 -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I"..\qt-4.8-src\include\QtCore" -I"..\qt-4.8-src\include\QtNetwork" -I"..\qt-4.8-src\include\QtGui" -I"..\qt-4.8-src\include" -I"." -I"c:\QtSDK\Examples\4.7\widgets\analogclock" -I"." -I"..\qt-4.8-src\mkspecs\default" -o main.obj c:\QtSDK\Examples*\4.7\widgets\analogclock\main.cpp
C:\Users\pclass\Desktop\qt_creator_toolchain\qt-4.8-src\bin\moc.exe -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I"..\qt-4.8-src\include\QtCore" -I"..\qt-4.8-src\include\QtNetwork" -I"..\qt-4.8-src\include\QtGui" -I"..\qt-4.8-src\include" -I"." -I"c:\QtSDK\Examples\4.7\widgets\analogclock" -I"." -I"..\qt-4.8-src\mkspecs\default" c:\QtSDK\Examples\4.7\widgets\analogclock\analogclock.h -o moc_analogclock.cpp
mingw32-make.exe: *** [moc_analogclock.cpp] Error -1073741515
09:51:09: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project analogclock (target: Desktop)
When executing build step 'Make'
You need the Qt library for the target first. You can build it with CodeSourcery toolchain. Then, some tools(qmake, moc...) and library are available.
I added mingw to the path and then did a build and it succeeded. If I do a ‘file’ command on the example it gives me the following, which looks promising. Now to try it on the board.
$ file analogclock
analogclock: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
I am unable to build sqlcipher on Windows with following these steps.
install Win32 OpenSSL v0.9.8m
install TclTk
rename MINGWPATH/bin/tclsh84.exe to tclsh.exe
cd sqlcipher
$ ./configure --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I../OpenSSL/include /c/Windows/System32/libeay32.dll"
$ make
$ make dll
$ make install
At the link stage, gcc gives this error:
libtool: link: gcc -g -O2 -DSQLITE_OS_WIN=1 -I. -I./src -I./ext/rtree -D_HAVE_SQ
LITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_E
XTENSION=1 -DHAVE_READLINE=0 -o .libs/sqlite3.exe ./src/shell.c ./.libs/libsqli
te3.a -lpthread -L/usr/local/lib
./.libs/libsqlite3.a(func.o): In function `sqlite3RegisterBuiltinFunctions':
c:\sqlcipher/./src/func.c:1439: **undefined reference to `sqlcipher_exportFunc**'
collect2: ld çıkış durumu 1 ile döndü
make: *** [sqlite3.exe] Error 1
You forget to define SQLITE_TEMP_STORE as document has specified.
I can confirm it's working smoothly on Ubuntu 12.04 LTS , with latest source on github:
In short for dynamic linking:
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2" LDFLAGS="-lcrypto"