简体   繁体   English

编译源代码并作为cron作业运行

[英]Compile source and run as cron job

I would like to compile some C++ code from source and then run a Python wrapper on my web hosting server as a cron job. 我想从源代码编译一些C ++代码 ,然后在Web托管服务器上运行Python包装程序作为cron作业。 I compiled it on my Mac, uploaded onto the server and, unsurprisingly, the server running Linux complained saying: 我在Mac上编译了该文件,然后将其上传到服务器上,毫不奇怪,运行Linux的服务器抱怨说:

OSError: [Errno 8] Exec format error

I do not have the rights to run g++ sptree.cpp tsne.cpp -o bh_tsne -O2 on the server. g++ sptree.cpp tsne.cpp -o bh_tsne -O2在服务器上运行g++ sptree.cpp tsne.cpp -o bh_tsne -O2 Is there a way for me to obtain a compiled binary that would be compatible with whatever OS (Linux) the server is running on? 我是否有办法获得与服务器运行的任何OS(Linux)兼容的已编译二进制文件? Thanks! 谢谢!

This is essentially the reason people moved to java, which is platform independent. 从本质上讲,这就是人们转向独立于平台的Java的原因。

For C++, you need the specific link libraries for the target machine. 对于C ++,您需要目标计算机的特定链接库。 Some compilers have the option of choosing the linker objects by flag (or setting) and allowing someone to "script" the final executable output. 一些编译器可以选择通过标志(或设置)选择链接器对象,并允许某人“脚本化”最终的可执行输出。 I cant say if the Mac does... 我不能说Mac是否可以...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM