How to use libtool to create a dylib for iOS simulator? - ios-simulator

My goal is to create a dylib using libtool. I'm on macOS, so it's not GNU libtool.
I tried to run libtool -dynamic -o foo.dylib *.o -syslibroot $(xcrun --show-sdk-path --sdk iphonesimulator), but got a bunch errors saying
ld: warning: building for macOS, but linking in object file (foo.o)
built for iOS Simulator
(Yes, the .o file is targeted at simulator.)
It seems by default libtool creates the dylib for macOS, but I couldn't find where to specify the platform. libtool doesn't accepct -target or -platform_version.
So, how can I use libtool to create a dylib for iOS simulator? Thanks!

Related

QT "Could not find the Qt platform plugin "xcb" "

I installed QT-everywhere 5.15 open-source for academic reasons, but I have failed to run a program.
Firstly, I compiled the necessary source files with make and installed the QT Creator, then I selected qmake for running programs inside it. When I tried to run an example program, I encounter this error:
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/usr/lib/x86-64-linux-gnu"
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc.
The program has unexpectedly finished.
The process was ended forcefully.
Then I looked into /usr/lib/x86-64-linux-gnu for finding the xcb plugin and set LD_LIBRARY_PATH=/usr/lib/x86-64-linux-gnu, but again the same error appeared.
What should I do to solve this problem?
1. Install requirements:
sudo apt install make g++ pkg-config libgl1-mesa-dev libxcb*-dev libfontconfig1-dev libxkbcommon-x11-dev python libgtk-3-dev
python is optional for QtQuick.
libgtk-3-dev optional if you want the GTK native theme for QtWidgets.
2. Configure:
./configure -opensource -confirm-license -nomake tests -nomake examples -prefix /path/to/install/dir
3. Compile:
make -j $(nproc)
make install

R package with Rcpp and CMake (Windows)

I'm using CMake as a build tool to create C++ shared library with Rcpp. To trigger CMake while invoking R CMD INSTALL command the top configure script need to look something like this:
rm -rf _builds
cmake -H. -B_builds
cmake --build _builds
...
Such approach works nicely on Linux and Mac OS, but not on Windows machine.
What version of CMake expected in configure:
windows native cmake
cygwin cmake
What generator do I need to use:
Unix Makefiles (cygwin)
MSYS Makefiles (native)
MinGW Makefiles (native)
SSCCE
https://github.com/forexample/rcpp-test
Leave all Makefile files (Makefile.win for windows) empty:
all:
Put CMake build instructions into configure (configure.win for windows):
cmake -H. -B_builds
cmake --build _builds
Such approach works nice for me on Linux, Mac and Windows (native cmake with Visual Studio generator). Note that it's probably not compatible with cran and windows build need to be tuned to compile different architectures (see R_ARCH) but it works locally and fit my needs.
Example

QT 4.8.5 compile error in CentOS 5.X

I have download the Qt-everywhere-4.8.5.tar.gz from Qt official website. And In the CentOS 5.X, it's GCC version is 4.1.2. So I have compiled the gcc-4.7.2 from source code and installed it in $HOME/software/, then in the install directory, there are bin and lib and lib64, and I have add the path into LD_LIBRARY_PATH.
Then, I uncompressed the qt source code, configure it with
./configure -prefix $HOME/softwares/ -nomake demos -nomake examples
Then, make it. there is an error:
/home/user/Downloads/qt-everywhere-opensource-src-4.8.5/bin/lrelease:assistant_cs.ts -qm assistant_cs.qm
/home/user/Downloads/qt-everywhere-opensource-src-4.8.5/bin/lrelease: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/user/Downloads/qt-everywhere-opensource-src-4.8.5/bin/lrelease)
/home/user/Downloads/qt-everywhere-opensource-src-4.8.5/bin/lrelease: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /home/user/Downloads/qt-everywhere-opensource-src-4.8.5/bin/lrelease)
gmake[1]: *** [assistant_cs.qm] Error 1
And, I have found the libstdc++.so.6 in $HOME/softwares/lib64, and I have add the path into LD_LIBRARY_PATH, why the make command just use the system's library, not use the provided one? I have no root privileges, so I can't link the system's library with my home gcc's library. Could you give me some advice, please? Thanks.

Undefined reference to QIconvCodec during Qt embedded make?

I'm trying to configure my Qt for Embedded Linux with a virtual framebuffer according to these instructions. From the Qt for Embedded source folder, I'm trying:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make
I get the following error which prevents me from doing make install:
.obj/release-shared-emb-x86/qtextcodec.o: In function `setup()':
qtextcodec.cpp:(.text+0x23cc): undefined reference to `QIconvCodec::QIconvCodec()'
collect2: ld returned 1 exit status
make[1]: *** [../../lib/libQtCore.so.4.8.4] Error 1
make[1]: Leaving directory `/home/cstjean/qt/src/corelib'
make: *** [sub-corelib-all-ordered] Error 2
If I do:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make -no-iconv
sudo make install -no-iconv
...This works. But when I go into QtCreator, Tools > Options > Build & Run > Qt Versions, I try to select qmake for Qt Embedded (for me it's in /home/cstjean/qt/bin/qmake) and it tells me:
Qt version is not properly installed, please run make install
I've tried googling this like crazy. There are a lot of suggestions to download various libraries, which I've tried to no avail, but perhaps I'm missing something because this is a pretty fresh installation of Ubuntu I'm using.
Thanks.
I solved this problem by installing Gnome and starting over from scratch for my Qt Embedded for Linux installation.
I googled gnome for ubuntu 12.04 and found these instructions. You'll have to see which version of Ubuntu you have and search for that of course. You can see which version you have by typing into a command line:
lsb_release -a
Once I had gnome installed, I restarted my computer and signed in using Gnome.
Then I completely uninstalled and removed all traces of Qt Embedded:
cd yourQtEmbeddedDir
sudo make uninstall
cd ..
rm -r yourQtEmbeddedDir sourceFileTarYouHadDownloaded.tar.gz
I redownloaded the source file tar for Qt Embedded for Linux (from here) and proceeded to install according to these instructions after extracting the source files from the tar:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make
sudo make install
Now, if you tell QtCreator about qmake from this installation, then QtCreator will no longer complain about a bad installation! Ta da!
Note: If you're attempting to the do the Virtual Framebuffer business too, then this is not the end of the road. You need to have Qt for X11 installed as well in order to compile qvfb.
Long story short: You need Gnome if you're trying to install Qt Embedded for Linux with a Virtual Framebuffer on Ubuntu!

compile/install gcc 4.1.2 on solaris 10 having gcc 3.4.3 already

I'm facing some issues on compiling gcc on solaris 10.
I downloaded the source code from "ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.1.2/" and tried to compile it, by using configure and then make.
But the make stops at line mentioned below.
perl ../.././fastjar/../contrib/texi2pod.pl -D fastjar > fastjar.pod
I'hv checked perl is already installed but it has stuck at this point for more than 12hrs.
gcc version already installed is 3.4.3
perl version is 5.8.4
The above problem is solved as i used ksh shell to build/configure it, but i ran into another problem i.e. the gcc which i got after this build says
warning: visibility attribute not supported in this configuration; ignored
This visibility feature is required as i don't want to export all of my function in my shared libraries.
According to this link the waring is due to objdump which it says is not present in my $PATH. But i checked it is in $PATH variable.
Thanks
Here is how i solved this problem:
Installed gnu binutils version 2.18 using gcc 3.4.3(available in solaris by default).
cd gcc_source_dir
mkdir objdir && cd objdir
../configure --with-gnu-as --with-as=/binutils_2_18/bin/as --with-gnu-ld --with-ld=/binutils_2_18/bin/ld --prefix=$PREFIX --enable-threads=posix --enable-checking=release --with-system-zlib --enable-shared --disable-symvers --enable-languages=c,c++
gmake
gmake install

Resources