compiling readline

335 views
Skip to first unread message

r0l...@freemail.hu

unread,
Mar 3, 2016, 6:00:07 AM3/3/16
to emscripten-discuss
Hi All,

I'd like to compile my own project using emscripten but first I need to compile its dependencies of which one is readline. Building readline (6.3) natively from source goes fine and even configuring it with emconfigure went fine. However, 'emmake make' results in the error you can see in the attached screenshot. Do you happen to know why? As far as I could see it in the source, sa_handler would be such a member of the struct that points to a function of type SigHandler. Any help is appreciated:)



Thanks&regards,
r0ller

Alon Zakai

unread,
Mar 3, 2016, 12:44:32 PM3/3/16
to emscripten-discuss
Looks like a clang frontend issue, so I would look for discussions of people building that project with recent versions of clang - they would hit the same issue with or without emscripten.

The errors themselves look odd, no idea why that wouldn't work if the same code compiles with gcc. Only guess is clang's default C version might be newer than gcc's, and you need to tell it to use an older one?

--
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/d/optout.

r0l...@freemail.hu

unread,
Mar 3, 2016, 4:17:56 PM3/3/16
to emscripten-discuss
Hi Alon,

Thanks for the hint! Although, I compiled readline with clang (the one built for emscripten) without any issues:( Need to look further...

Regards,
r0ller
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

Alon Zakai

unread,
Mar 3, 2016, 5:18:12 PM3/3/16
to emscripten-discuss
Interesting. Perhaps it is caused somehow by out libc headers? That's another theory.

I would run with EMCC_DEBUG=1 in the env to see the full clang command that emcc emits. You can then narrow things down by removing arguments until you see which causes the issue.

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/d/optout.

--
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.

r0l...@freemail.hu

unread,
Mar 4, 2016, 8:07:26 AM3/4/16
to emscripten-discuss
Hi Alon,

Thanks again for the hint! Although, I went through the options, I haven't found anything that could lead to such a failure. So afterwards I started checking the configure file to tweak configuration in a way that it bypasses that critical piece of code and also googled a bit and what I found was how readline is built for chromium: https://chromium.googlesource.com/webports/+/master/ports/readline/build.sh

So simply (hiding my dir. structure not to complicate matters here) issuing 'export bash_cv_signal_vintage=posix;./emconfigure ./configure --disable-shared' results in such a config.h after which '/emmake make' does the job:)

One question remains though: where do I find the .bc files? There aren't any in the build directory but it's full of object files (.o) as usual and I also got the a.out, a.out.js files. As far as I understood the guide which says "The normal approach is to build the libraries to bitcode and then compile library and main program bitcode together to JavaScript.", I need those bitcode files to be able to issue "emcc project.bc libstuff.bc -o final.js" in the end, right?

Thanks&regards,
r0ller



2016. március 3., csütörtök 23:18:12 UTC+1 időpontban Alon Zakai a következőt írta:
Interesting. Perhaps it is caused somehow by out libc headers? That's another theory.

I would run with EMCC_DEBUG=1 in the env to see the full clang command that emcc emits. You can then narrow things down by removing arguments until you see which causes the issue.
On Thu, Mar 3, 2016 at 1:17 PM, <r0l...@freemail.hu> wrote:
Hi Alon,

Thanks for the hint! Although, I compiled readline with clang (the one built for emscripten) without any issues:( Need to look further...

Regards,
r0ller

2016. március 3., csütörtök 18:44:32 UTC+1 időpontban Alon Zakai a következőt írta:
Looks like a clang frontend issue, so I would look for discussions of people building that project with recent versions of clang - they would hit the same issue with or without emscripten.

The errors themselves look odd, no idea why that wouldn't work if the same code compiles with gcc. Only guess is clang's default C version might be newer than gcc's, and you need to tell it to use an older one?
On Thu, Mar 3, 2016 at 3:00 AM, <r0l...@freemail.hu> wrote:
Hi All,

I'd like to compile my own project using emscripten but first I need to compile its dependencies of which one is readline. Building readline (6.3) natively from source goes fine and even configuring it with emconfigure went fine. However, 'emmake make' results in the error you can see in the attached screenshot. Do you happen to know why? As far as I could see it in the source, sa_handler would be such a member of the struct that points to a function of type SigHandler. Any help is appreciated:)



Thanks&regards,
r0ller

--
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-discuss+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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-discuss+unsub...@googlegroups.com.

Alon Zakai

unread,
Mar 4, 2016, 2:12:27 PM3/4/16
to emscripten-discuss
The .o files should contain bitcode if emcc emitted them. Try to run "file" on them, or view in an editor.

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/d/optout.

--
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/d/optout.

--
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.

r0l...@freemail.hu

unread,
Mar 4, 2016, 2:38:35 PM3/4/16
to emscripten-discuss
Hi Alon,

Thanks again! Does it mean that the .bc files that the guide ( http://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#using-libraries ) refers to are ordinary object files? Can I simply use them when linking everything together instead of the .bc-s as being used in the example 'emcc project.bc libstuff.bc -o final.js'?

Regards,
r0ller
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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-discuss+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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-discuss+unsub...@googlegroups.com.

r0l...@freemail.hu

unread,
Mar 4, 2016, 2:50:53 PM3/4/16
to emscripten-discuss
Ok, I guess I found the answer at a different section of the guide (https://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#integrating-with-a-build-system): "The file output from make might have a different suffix: .a for a static library archive, .so for a shared library, .o or .bc for object files (these file extensions are the same as gcc would use for the different types). Irrespective of the file extension, these files contain linked LLVM bitcode that emcc can compile into JavaScript in the final step."

And indeed, issuing 'file readline.o' results in: LLVM IR bitcode:)

Regards,
r0ller

Alon Zakai

unread,
Mar 4, 2016, 3:24:37 PM3/4/16
to emscripten-discuss
Yes, exactly. We support multiple suffixes so more build systems can work. But all of them should contain LLVM bitcode, for emcc.

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/d/optout.

--
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/d/optout.

--
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/d/optout.

--
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.
Reply all
Reply to author
Forward
0 new messages