gnustep / libobjc2

Objective-C runtime library intended for use with Clang.
http://www.gnustep.org/
MIT License
434 stars 118 forks source link

Ubuntu 14.04 build from scratch, undefined reference to `id_catchall' #76

Closed kb1ooo closed 5 years ago

kb1ooo commented 5 years ago

Trying to build a GNUstep environment from scratch on Ubuntu 14.04 and I'm following the script for 14.04/15.04 here. Running into an undefined error for an extern "C" global when building the tests. Output while building is below:

  [ 13%] Linking C executable CXXExceptions_legacy
cd /home/mvaillant/dev/gnustep/libobjc2/build/Test && /home/mvaillant/local/bin/cmake -E cmake_link_script CMakeFiles/CXXExceptions_legacy.dir/link.txt --verbose=1
/home/mvaillant/dev/gnustep/llvm/build/bin/clang  -Xclang -fexceptions -Xclang -fobjc-exceptions  -rdynamic   CMakeFiles/CXXExceptions_legacy.dir/CXXException.m.o CMakeFiles/CXXExceptions_legacy.dir/CXXException.cc.o CMakeFiles/test_runtime_legacy.dir/Test.m.o  -o CXXExceptions_legacy -Wl,-rpath,/home/mvaillant/dev/gnustep/libobjc2/build ../libobjc.so.4.6 -lstdc++ -lm 
CMakeFiles/CXXExceptions_legacy.dir/CXXException.cc.o: In function `catchall':
CXXException.cc:(.text+0x6b): undefined reference to `id_catchall'
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Test/CXXExceptions_legacy] Error 1

I've noticed that the 16.04 script is significantly different, in particular it doesn't build the tests. I got through the build and install (not sure if it's working properly) avoiding the tests but it does seem that the 14.04 script is out of date (e.g. the svn for core doesn't appear to exist, I had to pull the git repos like with the 16.04 script)?

kb1ooo commented 5 years ago

As a follow up, I tried the test code here, the gui poped up but when I clicked "All Done", I get the following error:

GUITest: /home/mvaillant/dev/gnustep/libobjc2/protocol.h:85: struct objc_protocol_method_description *protocol_method_at_index(struct objc_protocol_method_description_list *, int): Assertion `l->size >= sizeof(struct objc_protocol_method_description)' failed.
Aborted (core dumped)

The modified script that I used to install GNUstep on 14.04 is below (sorry I can't use a pastebin from work)

#!/bin/bash

BUILD_DIR=`dirname $(readlink -f ${BASH_SOURCE[0]})`
echo ${BUILD_DIR}

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install build-essential git subversion ninja cmake libffi-dev libxml2-dev \
libgnutls-dev libicu-dev libblocksruntime-dev libkqueue-dev libpthread-workqueue-dev autoconf libtool \
libjpeg-dev libtiff-dev libffi-dev libcairo-dev libx11-dev:i386 libxt-dev libXft-dev

sudo apt-get -y install python-dev libncurses5-dev doxygen swig libedit-dev

cd ${BUILD_DIR} 
git clone https://github.com/nickhutchinson/libdispatch.git
#svn co http://svn.gna.org/svn/gnustep/modules/core
git clone https://github.com/gnustep/libobjc2
git clone https://github.com/gnustep/tools-make.git
git clone https://github.com/gnustep/libs-base.git
git clone https://github.com/gnustep/libs-gui.git
git clone https://github.com/gnustep/libs-back.git
git clone https://github.com/gnustep/libs-xcode.git
git clone https://github.com/gnustep/tools-buildtool.git

# OBTAIN, COMPILE, INSTALL THE LATEST LLVM/clang. (Doing apt-get install clang instead may or may not work.)
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
cd ${BUILD_DIR}/llvm
rm -rf build
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE:STRING=Release ..    # If you don't choose Release, it defaults to Debug which takes lots more space
make -j8   # 8=your number of build CPUs
#echo "export PATH=\$PATH:~/llvm/build/bin" >> ~/.bashrc
#echo "export CC=clang"  >> ~/.bashrc
#echo "export CXX=clang++" >> ~/.bashrc
export PATH=$PATH:${BUILD_DIR}/llvm/build/bin
#. ~/.bashrc

export CC=clang
export CXX=clang++

clang -v
clang++ -v

cd ${BUILD_DIR}/libobjc2
rm -rf build
mkdir build
cd build
cmake .. -DTESTS=OFF
make -j8
sudo -E make install

cd ${BUILD_DIR}/tools-make
./configure --enable-debug-by-default --with-layout=gnustep --enable-objc-nonfragile-abi
make VERBOSE=1 && sudo -E make install VERBOSE=1

. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh

sudo /sbin/ldconfig

cd ${BUILD_DIR}/libs-base
./configure
make -j8
sudo -E make install

cd ${BUILD_DIR}/libdispatch
rm -rf libdispatch-build
mkdir libdispatch-build && cd libdispatch-build
../configure
make
sudo make install
sudo ldconfig

cd ${BUILD_DIR}/libs-gui
./configure
make -j8
sudo -E make install

cd ${BUILD_DIR}/libs-back
./configure
make -j8
sudo -E make install

cd ${BUILD_DIR}/libs-xcode
make
make install GNUSTEP_INSTALLATION_DOMAIN=USER

cd ${BUILD_DIR}/tools-buildtool
make
make install GNUSTEP_INSTALLATION_DOMAIN=USER

echo "Install is done. Open a new terminal or type source ~/.bashrc"
davidchisnall commented 5 years ago

Fixed. This was a bug in the test.