Aurel300 / ammer

Unified FFI for Haxe native extensions
https://aurel300.github.io/ammer/
MIT License
116 stars 15 forks source link

Put into `/tmp/ammer_${name}` and looks in `/tmp/ammer_libtypes` #57

Open 0b1kn00b opened 1 year ago

0b1kn00b commented 1 year ago

Unbuntu 22.10 Haxe 4.3.0 ammer-core-rewrite HEAD

I don't understand why the linker can't find string for one thing, but why is it looking in ammer_libtypes for lib.neko.o when it wrote it to ammer_aria2? It seems the call that should generate lib.neko.so in ammer_aria2 isn't working

-main Main
-cp src/main/haxe
-D ammer.buildPath=tmp
-D ammer.outputPath=.local/bertha/i/pkg/aria2/lib/gnu
--no-output
-L stx
-L ammer
-neko test.n

src/main/eu/ohmrun/ammer/include

package eu.ohmrun.aria2.include;
@:ammer.lib.includePath("../../../../../../../vendor/aria2/src/includes/aria2/")
@:ammer.lib.headers.include("aria2.h")
class Aria2 extends ammer.def.Library<"aria2"> {
  public static function libraryInit():Int;
}

Error

mkdir /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes
mkdir /mnt/dat/i/prj/haxe/dev/aria2/.local/bertha/i/pkg/aria2/lib/gnu
write /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes/lib.neko.c (121221 characters)
compile object /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes/lib.neko.c -> /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes/lib.neko.o
run cc [-fPIC,-o,/mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes/lib.neko.o,-c,/mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes/lib.neko.c]
link library /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes/lib.neko.o -> /mnt/dat/i/prj/haxe/dev/aria2/.local/bertha/i/pkg/aria2/lib/gnu/ammer_libtypes.ndll
run cc [-m64,-o,/mnt/dat/i/prj/haxe/dev/aria2/.local/bertha/i/pkg/aria2/lib/gnu/ammer_libtypes.ndll,-shared,-fPIC,/mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_libtypes/lib.neko.o,-lneko]
mkdir /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2
mkdir /mnt/dat/i/prj/haxe/dev/aria2/.local/bertha/i/pkg/aria2/lib/gnu
write /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.c (4665 characters)
compile object /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.c -> /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.o
run cc [-fPIC,-o,/mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.o,-c,/mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.c,-I,/mnt/dat/i/prj/haxe/dev/aria2/vendor/aria2/src/includes/aria2]
link library /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.o -> /mnt/dat/i/prj/haxe/dev/aria2/.local/bertha/i/pkg/aria2/lib/gnu/ammer_aria2.ndll
run cc [-m64,-o,/mnt/dat/i/prj/haxe/dev/aria2/.local/bertha/i/pkg/aria2/lib/gnu/ammer_aria2.ndll,-shared,-fPIC,/mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.o,-lneko,-laria2]
In file included from /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.c:116:
/mnt/dat/i/prj/haxe/dev/aria2/vendor/aria2/src/includes/aria2/aria2.h:38:10: fatal error: string: No such file or directory
   38 | #include <string>
      |          ^~~~~~~~
compilation terminated.
/usr/bin/ld: cannot find /mnt/dat/i/prj/haxe/dev/aria2/tmp/ammer_aria2/lib.neko.o: No such file or directory
/usr/bin/ld: cannot find -laria2: No such file or directory
collect2: error: ld returned 1 exit status
/mnt/dat/i/prj/haxe/published/stx_release/src/main/haxe/eu/ohmrun/pml/Module.hx:16: characters 33-64 : Warning : (WDeprecated) Usage of this field is deprecated
/mnt/dat/u/lib/haxe/tink_state/git/src/tink/state/Promised.hx:16: characters 21-34 : Warning : (WDeprecated) Use Promise.never() instea
0b1kn00b commented 1 year ago

It's possibly issues with the way the library is written. Closing for now.

Aurel300 commented 1 year ago

Looking at aria2.h, it is actually C++. There are some features here that I still need to implement, but compilation and linking should at least work if you add @:ammer.lib.language(Cpp)?

0b1kn00b commented 1 year ago

I've since gotten so far as getting a compile using that metadata. thanks for letting me know.