glibc diff -> nptl solution

Auke Kok sofar at foo-projects.org
Tue Dec 27 03:46:29 UTC 2005


Florin Braescu wrote:

>Pe data de Lun 26 Dec 2005 14:33, Auke Kok a scris:
>  
>
>>Hi everyone,
>>
>>since I'm planning on release in 1.6.0 WITH nptl I need it to be merged
>>in moonbase - attached is a reviewed version of glibc's BUILD which
>>allows people to manually switch thread type.Uage:
>>
>># FORCE_THREADS=nptl lin -c glibc
>>
>>once done you should do a full rebuild of course - especially gcc FIRST
>>and then the rest. I need this patch to be reviewed asap so I can get on
>>with the rest of the ISO's I'm working on (i686 AND x86_64).
>>
>>    
>>
>
>  Hey Sofar. You're like Santa this year :). I have revised a bit the BUILD 
>file you proposed and i found a small syntax error and a configure option 
>which must be used only in one branch (the --without--thread one). However i 
>have fixed those two.
>
thanks - I didn't spot that

> I'm not so happy with the selection mechanism choosed. 
>Maybe a CONFIGURE option to set the FORCE_THREADS may be more appropiate.
>Here is attached the BUILD file.
>  
>

I do *NOT* want to do that at all - think of all the people who will 
just push "y" when asked if they want to switch to nptl - those people 
are better off using old linuxthreads. For those who know about this 
option - the switch is relatively easy.

Good documentation is more important - I'd rather add a message 
describing the switch to the glibc module, mailing list and forums etc.

Auke



>
>  Yours,
>
>     Florin
>  
>
>------------------------------------------------------------------------
>
>(
>
>  if [ -n "$FORCE_THREADS" ]; then
>    if [ "$FORCE_THREADS" != "nptl" -a "$FORCE_THREADS" != "linuxthreads" ]; then
>      message "${PROBLEM_COLOR}Bad thread architecture: \"$FORCE_THREADS\", must be"
>      message "\"nptl\" or \"linuxthreads\"${DEFAULT_COLOR}"
>      exit 1
>    fi
>    if ! query "Force thread type to $FORCE_THREADS ?" n ; then
>      message "${PROBLEM_COLOR}If you don't know what you're doing, then I don't know either!"
>      message "Don't set FORCE_THREADS and try again!${DEFAULT_COLOR}"
>      exit 1
>    fi
>  fi
>
>  case $(getconf GNU_LIBPTHREAD_VERSION) in
>    NPTL*)   THREADS=${FORCE_THREADS:-nptl}         ;;
>    linux*)  THREADS=${FORCE_THREADS:-linuxthreads} 
>             OPTS=${OPTS}"--without-__thread"       ;;
>    *)
>    	message "${PROBLEM_COLOR}Cannot detect threading type of your glibc - this is very bad"
>	message "Please fix your glibc library before continuing.${DEFAULT_COLOR}"
>	exit 1
>  esac
>
>  add_priv_user nscd:nscd
>
>  if [ -n "$MAKES" ] && [ "$MAKES" -gt 1 ] ; then
>    sedit "s/# PARALLELMFLAGS = -j 4/PARALLELMFLAGS = -j $MAKES/" Makefile.in
>  fi
>
>  # Don't allow too much damage
>  unset CFLAGS CXXFLAGS CPPFLAGS LD_LIBRARY_PATH
>  export CC=gcc
>
>  # Don't fully strip libc
>  if [[ "$LDFLAGS" == *-s* ]] ; then
>    STRIP=y
>  fi
>  unset LDFLAGS 
>
>  INSTALL_ROOT=$SOURCE_DIRECTORY/glibcroot &&
>  mkdir -p $INSTALL_ROOT &&
>  cd $INSTALL_ROOT
>
>  if module_installed kernel-headers-2.6 ; then
>     KERNEL_HEADERS="/usr/include"
>  else
>     KERNEL_HEADERS="/usr/src/linux/include"
>  fi
>
>  ../configure --host=$BUILD                     \
>               --build=$BUILD                    \
>               --enable-add-ons=${THREADS}       \
>               --with-elf                        \
>               --with-headers=${KERNEL_HEADERS}  \
>               --with-gd=no                      \
>               --without-cvs                     \
>               --enable-shared                   \
>               --infodir=/usr/share/info         \
>               --mandir=/usr/share/man           \
>               --prefix=/usr                     \
>               $OPTS                            &&
>  # explicitly exit here since the following code unsets $?
>  make || exit 1
>
>  # Preserve the old glibc temporarily
>  RT=/lib/librt.so.1
>  PTHREAD=/lib/libpthread.so.0
>  NSS=/lib/libnss_files.so.2
>  UTIL=/lib/libutil.so.1
>  NSL=/lib/libnsl.so.1
>  CRYPT=/lib/libcrypt.so.1
>  
>  case "`arch`" in
>    alpha)
>	  GLIBC=/lib/libc.so.6.1
>	  DL=/lib/libdl.so.2.1
>	  M=/lib/libm.so.6.1
>	  ;;
>     ppc)
>	  LD=/lib/ld.so.1
>	  DL=/lib/libdl.so.2
>	  ;;
>     sparc64)
>	  DL=/lib/libdl.so.2
>	  ;;
>     *)
>	  DL=/lib/libdl.so.2
>	  ;;
>  esac
>
>  cp $LD /lib/ld-lunar.so               &&
>  cp $GLIBC /lib/libc-lunar.so          &&
>  cp $DL /lib/libdl-lunar.so            &&
>  cp $M /lib/libm-lunar.so              &&
>  cp $RT /lib/librt-lunar.so            &&
>  cp $PTHREAD /lib/libpthread-lunar.so  &&
>  cp $NSS /lib/libnss_files-lunar.so    &&
>  cp $UTIL /lib/libutil-lunar.so        &&
>  cp $NSL /lib/libnsl-lunar.so          &&
>  cp $CRYPT /lib/libcrypt-lunar.so      &&
>
>  # Setup links for libraries
>  sln /lib/ld-lunar.so $LD               &&
>  sln /lib/libc-lunar.so $GLIBC          &&
>  sln /lib/libdl-lunar.so $DL            &&
>  sln /lib/libm-lunar.so $M              &&
>  sln /lib/librt-lunar.so $RT            &&
>  sln /lib/libpthread-lunar.so $PTHREAD  &&
>  sln /lib/libnss_files-lunar.so $NSS    &&
>  sln /lib/libutil-lunar.so $UTIL        &&
>  sln /lib/libnsl-lunar.so $NSL          &&
>  sln /lib/libcrypt-lunar.so $CRYPT      &&
>
>  # clean hack to make sure gnu/stubs.h gets refreshed
>  rm -f /usr/include/gnu/stubs.h  &&
>  # This removes the old glibc
>  prepare_install                 &&
>
>  # And now we install the new
>  make install                    &&
>
>  # Now optionally perform debug symbol stripping only
>  if [ "$STRIP" == "y" ] ; then
>    for FN in ld-$VERSION.so  \
>        lib{anl,BrokenLocale,c,crypt,dl,m,nsl,util,pthread,resolv}-$VERSION.so  \
>	libnss_{compat,files,hesiod,nis,nisplus}-$VERSION.so  \
>	lib{memusage,pcprofile,SegFault,thread_db-1.0}.so 
>    do
>      strip -S /lib/$FN
>    done
>    for FN in "/usr/lib/gconv/*.so"
>    do
>      strip -S $FN
>    done
>  fi  &&
>  
>  # Added a symlink for ash and others
>  ln -sf /usr/lib/libbsd-compat.a /usr/lib/libbsd.a  &&
>
>  # Rebuild the ld cache
>  rm -f /etc/ld.so.cache 2>/dev/null  &&
>  ldconfig                            &&
>
>  # Remove the temporary libc
>  rm /lib/{ld,lib{c,dl,m,rt,pthread,nss_files,util,nsl,crypt}}-lunar.so  &&
>
>  if [ ! -e /etc/nscd.conf ] ; then
>    install -m0644 $SCRIPT_DIRECTORY/nscd.conf /etc/
>  fi                             &&
>
>  # Generate locale info
>  unset   LD_PRELOAD             &&
>  if  [  -z  "$GLIBC_LOCALES"  ];  then
>    make localedata/install-locales || exit 1
>  else
>    for  LOCALE  in  $GLIBC_LOCALES;  do
>      INPUTFILE=`echo  $LOCALE  |  cut  -d /  -f1`
>        CHARMAP=`echo  $LOCALE  |  cut  -d /  -f2`
>      mkdir  -p  /usr/lib/locale/$INPUTFILE
>      echo "localedef  -i  $INPUTFILE  -f  $CHARMAP  $INPUTFILE"
>            localedef  -i  $INPUTFILE  -f  $CHARMAP  $INPUTFILE
>    done
>    true
>  fi
>  
>) > $C_FIFO 2>&1  &&  ldconfig
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Lunar-dev mailing list
>Lunar-dev at lunar-linux.org
>http://foo-projects.org/mailman/listinfo/lunar-dev
>



More information about the Lunar-dev mailing list