I want to study sqlite by reading its source code. I found sqlite-1.0.1 only contained 10,000+ lines code, maybe it is easy to read. But unfortunately, modern gcc cannot compile sqlite-1.0.1.
wget "https://www.sqlite.org/src/tarball/e8521fc1/SQLite-e8521fc1.tar.gz"
tar xzvf SQLite-e8521fc1.tar.gz
mkdir bld && cd bld
../SQLite-e8521fc1/configure --prefix=/opt/sqlite-1.0.1 --with-tcl=no
make
When I issued make, it reported
gcc -std=c89 -g -O2 -o lemon ../SQLite-e8521fc1/tool/lemon.c
In file included from ../SQLite-e8521fc1/tool/lemon.c:29:
/usr/lib/gcc/i386-redhat-linux/3.4.2/include/varargs.h:4:2: #error "GCC no longer implements <varargs.h>."
/usr/lib/gcc/i386-redhat-linux/3.4.2/include/varargs.h:5:2: #error "Revise your code to use <stdarg.h>."
I tried appending -std=c89 following gcc in Makefile, but it did not work.
I specially installed a old Fedora Core release 3 virtual machine to compile SQLite-1.0.1, but it looks like the gcc(gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)) within Fedora 3 is still too modern for the 18 years ago code.
I found a check in which <varargs.h> was replaced by <stdarg.h>, and the author said maybe he has used gcc to compile lemon.c in 1989.
Maybe a very old gcc or Linux (before 2000) can solve this problem, but how can I get that one?
I have modified the code of sqlite 1.0.1 and can now compile and run successfully on fedora 36 & MacOS 12.3. You can find this code on github. It can be compiled in docker as follows.(Note: You can also use gcc instead of clang)
docker pull fedora:36
docker run -dt --name f36 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined fedora:36
docker exec -it f36 bash
dnf update -y
dnf install -y ncurses git hostname clang diffutils readline-devel tcl-devel gdbm-devel
mkdir ~/src && cd ~/src
git clone https://github.com/ruomeng0x/sqlite.git
cd ~/src/sqlite
git checkout badcc1d968fdb7cf0ff5d89468248468b8329f4e
mkdir ../build && cd ../build
CC=clang CFLAGS="-std=c89" bash ../sqlite/configure
make
Related
I use a cross-compiled Qt setup on a CentOS host. Developing Qt applications and executing them remotely on the Raspberry Pi works fine. But I got the following error when I try to debug the application:
I use the standard GDB from the official Raspberry Pi toolchain (tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gdb).
So what is wrong? Why does the GDB needs Python scripting when I use C++?
I usually build GDB from source, so you can configure it to include Python support:
First some dependencies:
yum install -y texinfo gcc gcc-c++ make python3-devel wget
Then build and install GDB itself:
target=arm-linux-gnueabihf
version=9.1
# Download and extract
cd /tmp
[ -e gdb-$version.tar.xz ] || wget https://ftp.gnu.org/gnu/gdb/gdb-$version.tar.xz
rm -rf gdb-$version
tar xf gdb-$version.tar.xz
mkdir -p gdb-$version/build
cd gdb-$version/build
# Get the Python executable and library directory
[ -z "${PYTHON}" ] && export PYTHON=python3
PYTHON_LIBDIR=$("${PYTHON}" -c \
"import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
# Configure GDB
../configure \
--prefix="$HOME/.local" \
--target=$target \
--with-python="${PYTHON}" \
LDFLAGS="-L${PYTHON_LIBDIR}"
# Build and install GDB
make -j$(nproc)
make -C gdb install
GDB will be installed in ~/.local/bin, so add it to your path if you haven't already.
You can run this command in your terminal to install gdb
sudo apt-get install gdb
I followed the following steps given on the OpenWrt website to setup the OpenWrt build system.
sudo apt-get update
sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev
git clone https://github.com/openwrt/openwrt.git
git clone -b chaos_calmer git://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
I made the necessary changes in the configuration file and ran the make command. It gives the following error: make: *** [world] Error 1
Any solutions?
use following command options to know the exact error you are getting
make -j1 V=s
Sometimes due to slow internet speed(while fetching package source code for openwrt) or due to less RAM availability or wrong configuration leads to this error. Post the error message block you are getting, to understand more about the problem.
Please, follow up the following prerequisities:
https://wiki.openwrt.org/doc/howto/buildroot.exigence
Take a look especially at the table "Table of known prerequisites and their corresponding packages".
You have to install version7 of gcc and g++ so Try this:
sudo apt install gcc-7 g++-7 build-essential
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
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
I downloaded nginx from it's site for linux(I use ubuntu 10.4).I extracted nginx-1.0.6.tar.gz and there was a configure file in that directory. So I entered "./configure" command in shell. It seemed to be configured right.After I entered "make" command ,It said this error:
make -f objs/Makefile
make[1]: Entering directory `/usr/local/nginx'
cd ./auto/lib/pcre/ \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: ./configure: not found
make[1]: *** [auto/lib/pcre//Makefile] Error 127
make[1]: Leaving directory `/usr/local/nginx'
make: *** [build] Error 2
what should I do now?
you have to install Dependencies .
generally these will be enough
libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
so you can first install them
sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
and then compile .. also make sure you run the make command as root.
The ./configure program of nginx wants to find either the shared libs to build nginx dynamicaly linked or the sources of openssl prce and zlib respectivly.
The obove mentioned error occurs when you invoke ../nginx/configure with the wrong options.
--with-pcre=/path/to/lib # where libpcre.a resides
--with-openssl=/path/to/lib # where libssl.a resides
--with-zlib=/path/to/lib # where libz.a resides
is wrong especially when ld.so has no idea about these libs
If you build a statically linked version of nginx
try instead
--with-pcre=/path/to/src/of/pcre
--with-openssl=/path/to/src/of/openssl
--with-zlib=/path/to/src/of/zlib
e.g.
--with-pcre=../pcre-8.36 --with-openssl=../openssl-1.0.2 --with-zlib=../zlib-1.2.8
Download PCRE from source
Unzip it (do not install)
Copy this path to configure (from Downloads folder)
./configure --with-pcre=/home/USER/DOWNLOADS/pcre-8.37/
Enter your nginx install directory - I solved this error by editing objs/Makefile and removing -Wall and -Werror params so it looks like this (second line):
CC = gcc
CFLAGS = -pipe -O -W -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -g
Also, running your ./configure should initiate a long procedure of verifications to ensure
that your system contains all the necessary components. If the configuration fails for any reason, check
less objs/autoconf.err
for more details. Any errors at configuration are usually based on missing dependencies for your configuration.
You didn't configure it right. Use these commands (in the nginx directory):
./configure --with-pcre=./auto/lib/pcre/ --with-zlib=./auto/lib/zlib/
./configure
make
sudo make install
Look for Ubuntu installation at http://wiki.nginx.org/Install.
Look for ubuntu/ centos installation at https://nodevine.com/library/installing-multiple-virtual-hosts-on-nginx-on-ubuntu-12-04-and-cent-os-6
We can now add the repository to install the latest version of nginx:
sudo add-apt-repository ppa:nginx/stable
Note: If this command still does not work (normally on 12.10), run the following command:
sudo apt-get install software-properties-common
This will add the repository to Ubuntu and fetches the repository's key. This is to verify that the packages have not been interfered with since they have been built.
Step Three - Updating the Repositories
After adding a new repository, you will need to update the list:
sudo apt-get update
Install nginx
To install nginx or update the version you already have installed, run the following command:
sudo apt-get install nginx
Check That Nginx is Running
You can check to see that nginx is running by either going to your VPS' IP address/domain, or typing in:
service nginx status
This will tell you whether nginx is currently running.
with a vps debian wheezy
I have to install a lot of tools in order to install nginx 1.2.9 :
apt-get install libpcre3 libpcre3-dev
apt-get install --reinstall zlibc zlib1g zlib1g-dev
apt-get install make
apt-get install sudo
Exact duplicate:
/usr/bin/ld: cannot find -lfreetype qt
Hi, I'm writing a cross-platform Qt application for a graduate project.
I've been working with Qt 4.3, but just recently upgraded to 4.5.
On my Windows machine, it works great. No problems. However, on my Linux machine, things aren't quite so nice.
I'm using the Qt creator and it goes through the compiling process making all the object files. But then it makes a call to:
g++ -Wl, -rpath, (all the .o files here) -L/media/HOME/Qt-Linux-4.5/qt/lib -lQtGui -L/media/HOME/Qt-Linux-4.5/qt/lib -L/usr/X11R6/lib -pthread -lfreetype -lgobject-2.0 -lrt -lglib-2.0 -ldl -lpthread
It gives me the error:
/usr/bin/ld: cannot find -lfreetype
collect2: ld returned 1 exit status
Now, I can locate libfreetype.so.6 and libfreetype.so.6.3.18 in my /usr/lib folders. I've tried running this inserting -L/usr/lib, but that didn't work. I've tried ln -s /usr/lib/libfreetype.so.6.3.18 libfreetype.so, I've tried editing the ld.so.conf file.
I'm trying this on an eeepc with Eeebuntu, if that helps.
Help!! I've been trying to get this to work for two days. I don't know what else I can do. Any suggestions?
Thanks much!
Brent
You missing dev librart, install libfreetypeX-dev, in debian lenny it would be apt-get install libfreetype6-dev
sudo apt-get install libfreetype6-dev
I've tried ln -s /usr/lib/libfreetype.so.6.3.18 libfreetype.so
Never do things like that unless you want to break your system and learn how to fix it
These I had to install on Kubuntu 9.04 64 bit in order to get a simple test app to build:
sudo apt-get install libfreetype6-dev
sudo apt-get install libavahi-gobject-dev
sudo apt-get install libSM-dev
sudo apt-get install libXrender-dev
sudo apt-get install libfontconfig-dev
sudo apt-get install libXext-dev
Edit: To get OpenGL to build I also had to install libgl1-mesa-dev and freeglut3-dev.
Edit2: Audio required libphonon-dev.
Thanks a lot! Installing the dev libraries got it to work. there were about five more libraries I had to install as well, but once I got them all, everything compiles just fine. Thanks a lot everyone!
When you did your ln -s /usr/lib/libfreetype.so.6.3.18 libfreetype.so, did you make sure that the libfreetype.so symlink ended up in /usr/lib too? To be sure, run ls -l /usr/lib/libfreetype.so and make sure it says what you expect it to.