GithubHelp home page GithubHelp logo

musl-prepo's Introduction

Musl Libc with Program Repository Support

This git repository contains a copy of musl libc (forked from musl-libc@cfdfd5ea with modifications to output to a Program Repository.

Build musl-libc with the Program Repository Compiler

First create the llvm-prepo container, then install the tools on which the build depends:

sudo apt-get update
sudo apt-get install -y git python

Clone the musl-prepo project via:

git clone https://github.com/SNSystems/musl-prepo

Then configure and build musl-prepo:

./configure --disable-shared --prefix=~/musl
make -j $(nproc)

Finally, install musl-prepo.

make install

Musl Libc

musl, pronounced like the word "mussel", is an MIT-licensed implementation of the standard C library targetting the Linux syscall API, suitable for use in a wide range of deployment environments. musl offers efficient static and dynamic linking support, lightweight code and low runtime overhead, strong fail-safe guarantees under correct usage, and correctness in the sense of standards conformance and safety. musl is built on the principle that these goals are best achieved through simple code that is easy to understand and maintain.

The 1.1 release series for musl features coverage for all interfaces defined in ISO C99 and POSIX 2008 base, along with a number of non-standardized interfaces for compatibility with Linux, BSD, and glibc functionality.

For basic installation instructions, see the included INSTALL file. Information on full musl-targeted compiler toolchains, system bootstrapping, and Linux distributions built on musl can be found on the project website.

musl-prepo's People

Contributors

richfelker avatar rofl0r avatar amonakov avatar fabled avatar paulhuggett avatar smaeul avatar gustedt avatar michaelforney avatar awilfox avatar maggieyingyi avatar kraj avatar armcc avatar alexdowad avatar ncopa avatar jlama avatar maskray avatar kaniini avatar dtzwill avatar doughdemon avatar pikhq avatar nto avatar hauke avatar niklata avatar shizmob avatar beevvy avatar ddevault avatar pattop avatar jow- avatar arkamar avatar midipix avatar

Watchers

Phil Camp avatar  avatar  avatar  avatar

musl-prepo's Issues

rld link on hello.cpp fails with undefined __libc_realloc and free symbols

We now have a docker image which contains prepo versions of libc, libunwind, libcxxabi, and libcxx.

I’ve trying to extend the hello-rld project to use C++ iostreams to do the “hello world” thing. This requires linking a very significant qunatity of these newly compiled libraries. Work is (currently) in a separate, libcxx, branch.

Recall that rld does not yet support static archives, so the makefile must unpack the various libraries and link the necessary object files directly.

I’m seeing two undefined symbols.

   __libc_realloc
   free

I can’t find __libc_realloc or free anywhere in musl libc.

pstore-write unittest `BasicLoggerTimeFixture.EpochInPST` failed.

Build and run the pstore-write project using musl-libc, the unittest BasicLoggerTimeFixture.EpochInPST failed with the following error:

[ RUN      ] BasicLoggerTimeFixture.EpochInPST
/home/maggie/github/llvm-project-prepo/pstore/unittests/core/test_basic_logger.cpp:175: Failure
      Expected: "1969-12-31T16:00:00-0800"
To be equal to: buffer_.data ()
      Which is: "1969-12-31T17:00:00-0700"
[  FAILED  ] BasicLoggerTimeFixture.EpochInPST (0 ms)

The repo compiler does not support weak_alias

Compile the test.c using the glibc, musl-libc ELF libc library, and musl-libc REPO2ELF libc_elf library.

$ cat test.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main( void )
  {
    setenv( "TZ", "PST8PDT", 1 );
    tzset();
    printf( "  timezone: %ld\n", timezone );
    return 0;
  }

case 1: use glibc library.

$ clang test.c -o glibc
$ ./glibc
  timezone: 28800

Build and run are fine.

case 2: use musl-libc ELF libc library

$ clang -nostdinc -nostdinc++ -nostdlib -nodefaultlibs -static -fno-exceptions -fno-rtti --sysroot /home/maggie/musl -isystem /home/maggie/LLVM/include/c++/v1  -isystem /home/maggie/musl/include /home/maggie/musl/lib/crt1.o test.c -lc  -Wl,-Map=elf.log -o musl-libc
$ ./musl-libc
  timezone: 28800

Build and run are fine.

case 3: use the musl-libc REPO2ELF libc_elf library

$ clang -nostdinc -nostdinc++ -nostdlib -nodefaultlibs -static -fno-exceptions -fno-rtti --sysroot /home/maggie/musl -isystem /home/maggie/LLVM/include/c++/v1  -isystem /home/maggie/musl/include /home/maggie/musl/lib/crt1_asm.t.o /home/maggie/musl/lib/crt1.t.o test.c -lc_elf -Wl,-Map=repo.log -o musl-libc-repo
$ ./musl-libc-repo
  timezone: 0

Build is fine but timezone is wrong. It is caused by the repo compile which doesn't support alias properly.

The timezone is defined as weak alias of __timezone.

weak_alias(__timezone, timezone);

If we print the __timezone using the musl-libc REPO2ELF libc_elf library, we get the correct value 28800.

Install the database and ticket files as an archive for rld

Currently, the musl-prepo install doesn’t include any of the repo-related binary files which the rld needs. These files include the database and the ticket files.

The task involves to create a second archive file containing these as part of the install.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.