Open samhorsfield96 opened 2 years ago
Hi @samhorsfield96. Try changing the /path/to/seq/lib
to the specific path where the Seq shared libs are installed on your system. e.g. For me it is /home/mhenders/.seq/lib/seq
. You could also consider setting the LD_LIBRARY_PATH variable (see here for a brief discussion).
You may also need to try it without the -no-pie
option, as shown here.
Hi @markhend, thanks for such a speedy response. I am already linking directly to the seq lib directory (I changed it in the example just for readability). I am also already adding the seq lib directory to the LD_LIBRARY_PATH variable, and still run into the same issues.
I did try without -no-pie
however I run into the below error:
/usr/bin/ld: foo.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
@samhorsfield96 I have been running the examples again and seeing the same issues as you - lots of 'multiple definition of' errors. I'm using Ubuntu (WSL) as well. Let us dig in a bit more to see if we can determine the root cause. Thank you.
@samhorsfield96, I haven't determined root cause yet. I got a little closer. Perhaps this might help you.
$ seqc build -o foo.o foo.seq --relocation-model=pic
$ gcc -shared -L/home/mhenders/.seq/lib/seq -o libfoo.so foo.o -lseqrt -lomp
$ gcc -o foo -L/home/mhenders/.seq/lib/seq -lseqrt -L. -lfoo foo.c
/usr/bin/ld: /tmp/ccXc1N7d.o: in function `main':
foo.c:(.text+0xe): undefined reference to `foo'
collect2: error: ld returned 1 exit status
@markhend unfortunately I run into the same issue as you
/tmp/ccBJNODw.o: In function `main':
foo.c:(.text+0xa): undefined reference to `foo'
collect2: error: ld returned 1 exit status
@markhend compiling with the -c
flag gets rid of the multiple definition errors, however foo
is an object and not an executable
$ seqc build -o foo.o foo.seq
$ gcc -shared -L/path/to/seq/lib -o libfoo.so foo.o -no-pie -lseqrt -lomp
$ gcc -o foo -lfoo -c foo.c
$ ./foo
-bash: ./foo: cannot execute binary file: Exec format error
Hi,
I'm following the "Calling Seq from C/C++" example using the latest seq-lang release (v0.11.0) and generate a shared object, but when linking to the executable I get the following errors:
Calling ldd on the shared object file gives me
Would you be able to help with this if possible, please? I'm running this using Ubuntu 18.04 via WSL with gcc v 7.5.0 just for reference.