Skip to content

Conversation

@mxcl
Copy link
Member

@mxcl mxcl commented Feb 1, 2024

My attempt at #147

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. request labels Feb 1, 2024
@mxcl
Copy link
Member Author

mxcl commented Feb 1, 2024

This fails, but I'm hoping dosu bot has a clue

@mxcl
Copy link
Member Author

mxcl commented Feb 2, 2024

oh ok, it didn't build successfully for me on my local machine. I'll have to look into that… could be the pkgx docker image doesn't have the pre-reqs installed? That would be an oopsie.

Still, nice! It built. Tests fail. Which begs the question: how do you test this?

@jhheider
Copy link
Contributor

jhheider commented Feb 2, 2024

how do you test this?

right. i think the answer is something like this:

test:
dependencies:
gnu.org/gcc: '*'
env:
linux/x86-64:
ARCH: x86_64
linux/aarch64:
ARCH: aarch64
script:
# Putting ourselves in the LD_LIBRARY_PATH breaks literally everything else...
- export LD_LIBRARY_PATH="$(echo LD_LIBRARY_PATH | tr ':' '\n' | grep -v {{prefix}} | tr '\n' ':')"
- gcc -o test1 test.c -fPIC -pie
- ./test1
- |
gcc \
-nostdinc \
-nostdlib \
-I{{deps.gnu.org/gcc.prefix}}/lib/gcc/$ARCH-unknown-linux-gnu/{{deps.gnu.org/gcc.version}}/include \
-Wl,--rpath="{{prefix}}/lib" \
-Wl,--dynamic-linker={{prefix}}/bin/ld.so \
-std=c11 \
-o test2 \
-v \
$CFLAGS \
{{prefix}}/lib/crti.o \
{{prefix}}/lib/crt1.o \
{{prefix}}/lib/crtn.o \
test.c \
-fPIC \
-pie
- test "$(./test2)" = "gnu_get_libc_version() = {{version.marketing}}"

@mxcl
Copy link
Member Author

mxcl commented Feb 3, 2024

k the local build issues are due to us building into macOS mounted volume and the case insensitive filesystem.

Ref openrisc/or1k-glibc#10

Which is annoying. What we need I guess is the inverse: everything is in a persistent linux docker volume and somehow we make it mounted locally so you can easily browse it.

Or something

@mxcl
Copy link
Member Author

mxcl commented Feb 5, 2024

Running in a local docker container I can get it all built, actually using it is problematic.

The resulting binary we create segfaults in some of the glibc runtime code that starts the executable. Tracing it with ChatGPT I ended up trying to run bin/ld.so manually, which also segfaults. Not sure if that is the key here or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants