ranlib Error using Alire and GNAT with ASFML - ada

i am learning how to use Alire using the Ada binding to SFML which is ASFML. So far I have downloaded
and installed ASFML using Alire and have successfully imported it into my test project. When I go to compile it, it does compile and bind but gets stuck on the Linker phase.
Here is the error:
gprbuild -d -PC:\Users\Amynu\testproj\testproj.gpr -XASFML_BUILD_MODE=optimize -XASFML_CONTRACTS=enabled -XASFML_STYLE_CHECKS=enabled -XASFML_RUNTIME_CHECKS=enabled -XASFML_COMPILE_CHECKS=enabled -XOS=Windows_NT -XTESTPROJ_BUILD_MODE=optimize -XTESTPROJ_CONTRACTS=disabled -XTESTPROJ_STYLE_CHECKS=disabled -XTESTPROJ_RUNTIME_CHECKS=disabled -XTESTPROJ_COMPILE_CHECKS=disabled
Compile
[Ada] testproj.adb
Bind
[gprbind] testproj.bexch
[Ada] testproj.ali
Link
[link] testproj.adb
c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\testproj\alire\cache\dependencies\asfml_2.5.2_b775db19\lib\libasfml.a: error adding symbols: archive has no index; run ranlib to add one
collect2.exe: error: ld returned 1 exit status
gprbuild: link of testproj.adb failed
I have absolutely no idea what a "ranlib" is, I searched Alire but it's not a known crate or a library. I tried various options in Alire such as
alr with libranlib
and
alr get ranlib
To no avail. Is it an option within GNAT's command line? I did look into the GPR file for the project and that all looks alright. One the GPR's being auto generated by Alire when I build the project with
alr init --bin testproj
alr cd testproj
alr with libasfml
alr build
I did a Google search and found a lot of solutions connected to Unix and IBM(?) something about ranlib being outdated as most compilers use "rm" now? I couldn't find a solution to GNAT flagging the same error.
Am I just using an outdated audio library?
Thanks in advance for any help :)

Thank you guys! That solved the problem. Now I am stuck with a loads of "undefined references to..." I actually went through all the source files and got rid of all the warnings by addIng Constant to most variable names. I am guessing it's looking for a dependency that is missing?
Build Libraries [gprlib] asfml.lexch [link library] libasfml.dll c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\testproj\alire\cache\dependencies\asfml_2.5.2_b775db19\obj\sf-audio-music.o:sf-audio-music.adb:(.text+0x32): undefined reference to `sfMusic_createFromFile'
And about 15 lines under that with the same error type. After looking into it, I had a look a the lines of code the error were referring to and found the errors are referencing what look like external files? Is their a part of ASFML that didn't download with the library?

I scoured the code for the first linker error and found line it's referring to.
with Interfaces.C.Strings;
package body Sf.Audio.Music is
use Interfaces.C.Strings;
--//////////////////////////////////////////////////////////
--/ Create a new music and load it from a file
--/
--/ #param Filename Path of the music file to open
--/
--/ #return A new sfMusic object (NULL if failed)
--/
--//////////////////////////////////////////////////////////
function CreateFromFile (Filename : String) return sfMusic_Ptr is
function Internal (Filename : chars_ptr) return sfMusic_Ptr;
pragma Import (C, Internal, "sfMusic_createFromFile");
Temp : chars_ptr := New_String (Filename);
R : sfMusic_Ptr := Internal (Temp);
begin
Free (Temp);
return R;
end CreateFromFile;
I cannot find the file it's trying to reference anywhere in the ASFML library. Was it left out?
So far, I have managed to successfully build ASFML in Alire with
alr get asfml
cd asfml
alr build asfml
This worked fine. Then I successfully imported into my project with
cd myproj
alr myproj with asfml
Again, do problems. Then I attempted to build it (after correcting the ranlib error) and I got the same load of linker errors. I don't understand why, as I successfully built the asfml library before I imported it wit Alire. Is it just a file I am missing, or do I have to explicitly tell the linker where the asfml file is?
Some of the errors.
Compile
[Ada] alicegame.adb
Build Libraries
[gprlib] asfml.lexch
[link library] libasfml.dll
c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\alicegame\alire\cache\dependencies\asfml_2.5.2_b775db19\obj\sf-audio-music.o:sf-audio-music.adb:(.text+0x32): undefined reference to `sfMusic_createFromFile'
c:/gnat/2021/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.1/ld.exe: C:\Users\Amynu\alicegame\alire\cache\dependencies\asfml_2.5.2_b775db19\obj\sf-audio-soundbuffer.o:sf-audio-soundbuffer.adb:(.text+0x22): undefined reference to `sfSoundBuffer_createFromFile'

Related

Fail to link to standard library of Ocaml-java (or Cafesterol)

I am a new user of Ocaml-java (or Cafesterol) which compiles primtive Ocaml program to executable jar that is allowed run on JVM. However when I try to compile a test program into executable jar I got error info as follow:
>java -jar ~/ocaml-project/ocamljava-bin-1.4/bin/ocamljava.jar -standalone regexdna.ml -o regexdna.jar
File "regexdna.ml", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Str referenced from regexdna.cmj
Unix referenced from regexdna.cmj
It seems module Str and Unix is missing from Ocaml-java. However, str.jar and unix.jar do exist under ~/ocaml-project/ocamljava-bin-1.4/lib/others/ when I install Ocaml-java, and within these jars we do have Str.class and Unix.class. (I suppose this directory is on the path of the standard library of Ocaml-java, so it should be included in default search path)
Can any Ocaml-java user tell me how Ocaml-java search for dependency libraries?
Quoting Xavier Clerc on this :
Well it should work, but you have to pass explicitly the referenced
library (just as in vanilla OCaml). Leading in your case to:
$ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar ~/opt/ocamljava-2.0-early-access9/lib/ocamljava.jar str.cmja regexdna.ml
Note that I am using the latest ocamljava preview.

Error while running make autoannotate sundance_apps 4.3.7

I am trying to install opinionfinder and I getting stuck when i am trying to make autoannotate for sundance apps.
The error log I get is huge and it has all undefined reference errors.
The first line says in function 'my_init_sundance(sunstr,sunstr)' and a list of undefined reference errors.
Anyway i can solve it?
Thanks in advance.
Before trying to compile autoannotate you must make sure Sundance compiled successfully. Check that your sundance-4.37/bin contains: aslog nlp prepro
In order for Sundance to compile on my 64 bit machine I had to edit the Makefile files in both src and include and add -m32 to the CFLAGS variable (or the NormalCC). Also down after the shared_lib_linux: target. Since I am on OSX I also had to add -dynamic flat to NormalOpts and LIBS.

Closure Templates through IKVM?

Google Closure works GREAT without the Java Runtime Environment by using IKVM
In case that ever goes away, the simplified steps to convert it to an exe are:
Download and extract (but nothing to install) Closure Compiler and IKVM
Move compiler.jar to the IKVM bin folder
ikvmc -target:exe -fileversion:2012.09.17 .\compiler.jar (with the jar's release date). Note: I get a few warnings about ANT libraries.
Copy these dependencies from the ikvm bin directory to the closure directory:
IKVM.OpenJDK.Core.dll
IKVM.OpenJDK.Jdbc.dll
IKVM.OpenJDK.Misc.dll
IKVM.OpenJDK.SwingAWT.dll
IKVM.OpenJDK.Text.dll
IKVM.OpenJDK.Util.dll
XML.API.dll
IKVM.Runtime.dll
Then you can move the compiler.jar and new compiler.exe back to your closure directory. Fredrik recommends this powershell version of execution because of the ability to specify ascii encoding overriding unicode (half the bytes):
.\compiler.exe --js .\jquery-1.4.2.js --warning_level QUIET | out-file -encoding ascii .\jquery.min.js
==============================
However, I do not have the same luck with the Closure Templates's SoyToJsSrcCompiler.jar. I get warnings from ikvmc -target:exe -fileversion:2011.12.22 .\SoyToJsSrcCompiler.jar as with compiler.jar.
warning IKVMC0105: Unable to compile class "com.google.template.soy.jssrc.internal.GenerateSoyUtilsEscapingDirectiveCode"
(missing class "org.apache.tools.ant.Task")
warning IKVMC0100: Class "com.google.inject.internal.asm.util.$TraceClassVisitor" not found
warning IKVMC0111: Emitted java.lang.NoClassDefFoundError in "com.google.inject.internal.cglib.core.$DebuggingClassWriter$1.run()Ljava.lang.Object;"
("com.google.inject.internal.asm.util.$TraceClassVisitor")
warning IKVMC0100: Class "com.google.template.soy.jssrc.internal.GenerateSoyUtilsEscapingDirectiveCode" not found
The resulting SoyToJsSrcCompiler.exe with no command-line arguments works to show the help page, but supplying a .soy file gives:
Exception in thread "main" cli.System.MethodAccessException:
com.google.inject.assistedinject.FactoryProvider2.getBindingFromNewInjector(java.lang.reflect.Method, System.Object[], AssistData) at
com.google.inject.assistedinject.FactoryProvider2$$FastClassByGuice$$9dcdf6d7.invoke() at
com.google.inject.internal.cglib.reflect.$FastMethod.invoke(FastMethod.java:53) at
com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:56) at
com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:90) at
com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:107) at
com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:76) at
com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73) at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031) at
com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:88) at
com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:150) at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40) at
com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53) at
com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:11 6) at
com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:11 0) at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024) at
com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor. java:110) at
com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:78) at
com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:171) at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:111) at
com.google.inject.Guice.createInjector(Guice.java:95) at
com.google.inject.Guice.createInjector(Guice.java:72) at
com.google.template.soy.MainClassUtils.createInjector(MainClassUtils.java:212) at
com.google.template.soy.SoyToJsSrcCompiler.execMain(SoyToJsSrcCompiler.java:223) at
com.google.template.soy.SoyToJsSrcCompiler.main(SoyToJsSrcCompiler.java:205)
Anyone know how to get this to work?
The exception can be an bug in IKVM. Which version do you use? Test the latest version.
warning IKVMC0100: Class "com.google.template.soy.jssrc.internal.GenerateSoyUtilsEscapingDirectiveCode" not found
Another problem can be that you have not compile all needed jar files for SoyToJsSrcCompiler.jar. In which jar file is this missing class file? Take a look in the wiki to see how you compile multiple jar files.
The next problem can be that there is the same package in different jar files. It there are only package visible for some mthods this will not work for .NET. You can test a sharedclassloader. See the wiki for details.

illegal text reloc to non_lazy_ptr error while building in xcode 4 with libav* libraries

I'm trying to build a simple application that uses ffmpeg's libav* libraries in xcode 4 and getting the following error:
ld: illegal text reloc to non_lazy_ptr from /ffmpeg/temp/ffmpeg-0.8/builduni/lib/libavcodec.a(ac3.o) in _ff_ac3_bit_alloc_calc_psd for architecture i386
I've already tried to run ranlib -c libavcodec.a to fix this problem, but nothing happend.
One more thing: my libav* libraries are fat binaries (i386 + x86_64).
Any ideas what can it be?
I have the same error. Finally, I got the solution at
http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html
just add other link flag:
-read_only_relocs suppress
* EXPLANATION * The two assembly commands load the absolutes address of _trail into R15. Doing so is fine if _trail is ultimately
in the same linkage unit. _trail is in libmodule.dylib. For this to
work, at runtime the dynamic loader (dyld) would have to rewrite the
two instructions. Normally dyld only updates data pointers. One work
around is to make libdyalog an archive (e.g. libdyalog.a) and link
that with pere.s. Then all the code would be in the same linkage unit,
so there would be no need for runtime text relocs. The runtime (dyld)
does support text relocs (updating instructions) for i386, but you
need to link with -read_only_relocs suppress.

Compc (Actionscript Library Compiler) Doesn't Fail Unless I Delete the File First?

Here's the scenario: I run compc on a source directory to recompile an already existing library after some changes, which completes successfully. Then I remove the library (the .swc file) and re-compile, which causes many errors to be thrown.
Nothing changed in the interim - clearly this should have either succeeded both times or failed both times.
libs/pv3ddebug $ compc -library-path+=.. -source-path=./src -compiler.optimize -include-sources+=./src -output ../pv3ddebug.swc
Loading configuration file /Users/bill/flex_sdk_3/frameworks/flex-config.xml
/Users/bill/lg/vision/libs/pv3ddebug.swc (152944 bytes)
/libs/pv3ddebug $ rm ../pv3ddebug.swc
/libs/pv3ddebug $ compc -library-path+=.. -source-path=./src -compiler.optimize -include-sources+=./src -output ../pv3ddebug.swc
Loading configuration file /Users/bill/flex_sdk_3/frameworks/flex-config.xml
/Users/bill/lg/vision/libs/pv3ddebug/src/com/phenomblue/pv3ddebug/PV3DDebug.as(45): col: 34 Error: Type was not found or was not a compile-time constant: AdvancedView.
public function PV3DDebug(view:AdvancedView)
^
... more errors follow
I think I've found out why the errors are happening, and can correct them, but I'm disturbed that the first compile didn't fail.
I have a theory:
Library A, which pv3ddebug depends on, was correct
pv3ddebug was compiled successfully (and it correctly)
Library A was brought into a state that would fail to compile with pv3ddebug
pv3ddebug was compiled successfully, incorrectly, because compc didn't notice that A was updated to a failing state
deleting pv3ddebug and then recompiling caused compc to try and compile with the new A, and so the compilation failed.
My questions to you: is step 4 a bug? Is this caching behavior I should have expected, or can change with a compiler switch? Is there something going on that my theory doesn't explain?
You could try -incremental=false. This is supposed to be the default for the command line compiler, but what you're describing sounds like it's enabled.

Resources