Hello, today I will tell you how to update your old gcc to a new llvm6.
Programm:
- Install Freebsd
- Freebsd setting
- Install some packages
- Compile libs
- Fix source
- Compile source
The first thing we should start with is the installation of freebsd.
- Go to official site freebsd and download this .iso
- Then, we need install this disk image. I used a VirtualBox.
- Now, we create a machine and all steps will be in pictures.
- Then, start the virtual machine and presses "install".
- After choose your encoding, I left by the standard.
- Enter the name of the machine, I wrote "llvm6".
- Choose (UFS), if you are an advanced user, you can choose (ZFS).
- Then "Entire Disk" - > "MBR" ("Finish" and "Commit").
- After installation, enter the password (my password is "dev" and repeat).
- Select network interface. (IPv4 -> "Yes", DHCP -> "Yes", IPv6 -> "No").
- Skip, by pressing "ENTER".
- Choose your region and time zone. Then we choose "Set Date" twice.
- Press "ENTER" and skip twice. After, we are asked if we want to create another user. We answer "No".
- Manual Configuration -> "No", Complete -> "Reboot".
- Go to the settings and turn off the drive -> "Remove".
First step it is open access for root users.
- Write this in command line "ee /etc/ssh/sshd_config".
- Then found line "#PermitRootLogin no" and change to "PermitRootLogin yes".
- Save changes (ESC -> ENTER -> ENTER).
- Restart SSHD (service sshd restart).
- Then we need to know your local ip. Press ("WIN + R" -> cmd -> ipconfig)
- And last step. For SFTP connection I use WinSCP and PuTTY for ssh.
- pkg update
- pkg upgrade
- pkg install gmake
- pkg install subversion
- pkg install clang-devel
- Upload source. I choose VINCHENZOO files and upload to /root/ (although this is not important).
CXX = g++
replace it with
CXX = clang++-devel
and
ifeq ($(GCC_VERSION), 4)
CFLAGS = -Wall -O2 -pipe -mtune=i686 -fno-exceptions -fno-rtti
else
CFLAGS = -Wall -O2 -pipe -mcpu=i686 -fno-exceptions -fno-rtti
endif
replace it with
CFLAGS = -Wall -Ofast -D_THREAD_SAFE -pipe -msse2 -mssse3 -m32 -fno-exceptions -std=c++17 -stdlib=libc++ -I../include
After write:
gmake clean
gmake dep
gmake -j20
and we have this error:
./../../common/stl.h:12:10: fatal error: 'ext/functional' file not found
#include <ext/functional>
^~~~~~~~~~~~~~~~
1 error generated.
to fix it, go to /common/stl.h and delete 3 line.
#ifdef __GNUC__
#include <ext/functional>
#endif
Then compile again (gmake -j20). If successful, then in the folder lib there will be libgame.a
CC= clang-devel
After write:
gmake clean
gmake -j20
If successful, then in the folder lib there will be liblua.a & liblualib.a
CXX = g++
replace it with
CXX = clang++-devel
and
ifeq ($(GCC_VERSION), 4)
CFLAGS = -Wall -O2 -pipe -mtune=i686 -fno-exceptions -fno-rtti
else
CFLAGS = -Wall -O2 -pipe -mcpu=i686 -fno-exceptions -fno-rtti
endif
replace it with
CFLAGS = -Wall -Ofast -D_THREAD_SAFE -pipe -msse2 -mssse3 -m32 -fno-exceptions -std=c++17 -stdlib=libc++
After write:
gmake clean
gmake dep
gmake -j20
If successful, then there will be libpoly.a
CXX = g++
replace it with
CXX = clang++-devel
and
ifeq ($(GCC_VERSION), 4)
CFLAGS = -Wall -O2 -pipe -mtune=i686 -fno-exceptions -fno-rtti
else
CFLAGS = -Wall -O2 -pipe -mcpu=i686 -fno-exceptions -fno-rtti
endif
replace it with
CFLAGS = -Wall -Ofast -D_THREAD_SAFE -pipe -msse2 -mssse3 -m32 -fno-exceptions -std=c++17 -stdlib=libc++
After write:
gmake clean
gmake dep
gmake -j20
If successful, then there will be libserverkey.a
CXX = g++
replace it with
CXX = clang++-devel
and
CFLAGS = $(IFLAGS) -Wall -O2 -pipe -mtune=i686 -D_THREAD_SAFE -fno-exceptions
replace it with
CFLAGS = $(IFLAGS) -Wall -Ofast -D_THREAD_SAFE -pipe -msse2 -mssse3 -m32 -fno-exceptions -std=c++17 -stdlib=libc++
After write:
gmake clean
gmake dep
gmake -j20
If successful, then there will be libsql.a
In this lib very much needs to be corrected. So I suggest just delete old files and upload my (./some files/libthecore).
gmake clean
gmake dep
gmake -j20
If successful, then there will be libthecore.a
-
First we download boost from official site choose the latest version (now it is 1.65.1) and click to boost_1_65_1.tar.gz
-
Delete (rm -rf boost) folder "boost".
-
Upload to server and unpack (tar -xf boost_1_65_1.tar.gz).
-
Go to ./boost_1_65_1 and move(mv boost ../) folder to ../
-
Then delete folder(rm -rf boost_1_65_1) "boost_1_65_1" and archive(rm -rf boost_1_65_1.tar.gz) "boost_1_65_1.tar.gz". Boost lib no need to compile, so we finished with it.
-
Second step cryptopp lib choose Source code (tar.gz)
-
Delete (rm -rf cryptopp) folder "cryptopp".
-
Upload to server and unpack (tar -xf cryptopp-CRYPTOPP_5_6_5.tar.gz).
-
In ./cryptopp-CRYPTOPP_5_6_5/GNUmakefile we found:
.PHONY: all
and add above
СС = clang-devel
CXX = clang++-devel -std=c++17
ok, now need disable sha asm & disable vmac asm. Open sha.cpp looking for a line:
#if defined(CRYPTOPP_DISABLE_SHA_ASM)
and add above
#define CRYPTOPP_DISABLE_SHA_ASM
Open vmac.cpp looking for a line:
#if defined(CRYPTOPP_DISABLE_VMAC_ASM)
and add above
#define CRYPTOPP_DISABLE_VMAC_ASM
Open sha.h looking for a line:
#if defined(CRYPTOPP_LLVM_CLANG_VERSION) && (CRYPTOPP_LLVM_CLANG_VERSION < 30400)
# define CRYPTOPP_DISABLE_SHA_ASM
#endif
and replace it with
#define CRYPTOPP_DISABLE_SHA_ASM
gmake clean
gmake -j20
After compile move(mv libcryptopp.a ../../lib) to lib folder and rename cryptopp-CRYPTOPP_5_6_5 to cryptopp