emar archiver tool.

399 views
Skip to first unread message

Bram Stolk

unread,
Dec 23, 2013, 6:38:23 PM12/23/13
to emscripte...@googlegroups.com
emHello,

I found that emscripten comes with an archiver tool, called emar.
During final stage when I create my .js code, pulling in an archive with '-l' does not seem to work for me.
The symbols that reside in the archive are not found.

This is what I do:
With em++ -c I create .o files containing byte code.
With emar I combine .o bytecode files into an archive libfoo.a
Then I build my js with em++ main.cpp -lfoo
-> symbol not found.

If, for the last step, I remove the -lfoo, and supply the .o files directly on the command line, the .js code is successfully generated.

So in short: combining objects into an archive works fine when building native binary from source.
But it fails when building javascript using emscripten compiler.

Did anyone else hit this same issue?
Any idea why this is?

Thanks,

 Bram

Bram Stolk

unread,
Dec 23, 2013, 11:24:05 PM12/23/13
to emscripte...@googlegroups.com
I thought I would add that...

...putting libfoo.a on the command line, instead of -lfoo, makes the unresolved symbol go away, btw.

   bram

Alon Zakai

unread,
Dec 23, 2013, 11:57:35 PM12/23/13
to emscripte...@googlegroups.com
I think -lfoo syntax makes it use the library search path, so perhaps you need -I. to tell it to look in the current directory.

- Alon



--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Bruce Mitchener

unread,
Dec 24, 2013, 12:20:42 AM12/24/13
to emscripte...@googlegroups.com
On Tue, Dec 24, 2013 at 11:57 AM, Alon Zakai <alonm...@gmail.com> wrote:
I think -lfoo syntax makes it use the library search path, so perhaps you need -I. to tell it to look in the current directory.

-L no?

 - Bruce
 

Bram Stolk

unread,
Dec 24, 2013, 5:38:05 AM12/24/13
to emscripte...@googlegroups.com
Thanks,

-L. fixes it indeed.

I was thrown off because I did not get a 'cannot find libfoo' which I would expect, instead just the missing symbols.

  Bram

Alon Zakai

unread,
Dec 24, 2013, 1:36:20 PM12/24/13
to emscripte...@googlegroups.com
I added a warning for that on the incoming branch now.

- Alon



Mark Callow

unread,
Dec 25, 2013, 9:32:24 PM12/25/13
to emscripte...@googlegroups.com

On 2013/12/24 8:38, Bram Stolk wrote:
I found that emscripten comes with an archiver tool, called emar.

Why does Emscripten need its own archiver tool?

Regards

    -Mark

--
注意:この電子メールには、株式会社エイチアイの機密情報が含まれている場合が有ります。正式なメール受信者では無い場合はメール複製、 再配信または情報の使用を固く禁じております。エラー、手違いでこのメールを受け取られましたら削除を行い配信者にご連絡をお願いいたし ます.

NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.

Alon Zakai

unread,
Dec 26, 2013, 1:29:23 PM12/26/13
to emscripte...@googlegroups.com
It's just a tiny python wrapper around llvm-ar. It lets projects with build systems using ar work as they expect to work, archives are created, they just contain LLVM bitcode instead of native code. Then finally we link those archives and build to JS.

- Alon



--
Reply all
Reply to author
Forward
0 new messages