मैं बहुत Yesod के लिए नया हूँ और मैं मुसीबत के निर्माण Yesod स्थिर तो मैं Heroku को तैनात कर सकते हैं हो रही है।Heroku को Yesod नियोजित करना, निर्माण नहीं कर सकते स्थिर
मैं डिफ़ॉल्ट .cabal फ़ाइल को बदल दिया है स्थिर संकलन को प्रतिबिंबित करने के
if flag(production)
cpp-options: -DPRODUCTION
ghc-options: -Wall -threaded -O2 -static -optl-static
else
ghc-options: -Wall -threaded -O0
और यह नहीं रह गया है बनाता है।
Linking dist/build/personal-website/personal-website ...
/usr/lib/ghc-7.0.3/libHSrts_thr.a(Linker.thr_o): In function
`internal_dlopen':
Linker.c:(.text+0x407): warning: Using 'dlopen' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/ghc-7.0.3/unix-2.4.2.0/libHSunix-2.4.2.0.a(HsUnix.o): In
function `__hsunix_getpwent':
HsUnix.c:(.text+0xa1): warning: Using 'getpwent' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/ghc-7.0.3/unix-2.4.2.0/libHSunix-2.4.2.0.a(HsUnix.o): In
function `__hsunix_getpwnam_r':
HsUnix.c:(.text+0xb1): warning: Using 'getpwnam_r' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
/usr/lib/libpq.a(thread.o): In function `pqGetpwuid':
(.text+0x15): warning: Using 'getpwuid_r' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/libpq.a(ip.o): In function `pg_getaddrinfo_all':
(.text+0x31): warning: Using 'getaddrinfo' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/ghc-7.0.3/site-local/network-2.3.0.2/
libHSnetwork-2.3.0.2.a(BSD__63.o): In function `sD3z_info':
(.text+0xe4): warning: Using 'gethostbyname' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/ghc-7.0.3/site-local/network-2.3.0.2/
libHSnetwork-2.3.0.2.a(BSD__164.o): In function `sFKc_info':
(.text+0x12d): warning: Using 'getprotobyname' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/ghc-7.0.3/site-local/network-2.3.0.2/
libHSnetwork-2.3.0.2.a(BSD__155.o): In function `sFDs_info':
(.text+0x4c): warning: Using 'getservbyname' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/libpq.a(fe-misc.o): In function `pqSocketCheck':
(.text+0xa2d): undefined reference to `SSL_pending'
/usr/lib/libpq.a(fe-secure.o): In function `SSLerrmessage':
(.text+0x31): undefined reference to `ERR_get_error'
/usr/lib/libpq.a(fe-secure.o): In function `SSLerrmessage':
(.text+0x41): undefined reference to `ERR_reason_error_string'
/usr/lib/libpq.a(fe-secure.o): In function `initialize_SSL':
(.text+0x2f8): undefined reference to `SSL_check_private_key'
/usr/lib/libpq.a(fe-secure.o): In function `initialize_SSL':
(.text+0x3c0): undefined reference to `SSL_CTX_load_verify_locations'
(... snip ...)
तो मैं बस अभी -static
और बिना -optl-static
सब कुछ ठीक बनाता है लेकिन अनुप्रयोग क्रैश हो जाता है जब वह कोशिश करता है पर शुरू करने के लिए के साथ संकलन: मैं चेतावनी की एक पूरी गुच्छा और उसके बाद इस तरह अपरिभाषित संदर्भ उपस्थित धसान मिल Heroku।
2011-12-28T01:31:23+00:00 app[web.1]: ./dist/build/personal-website/
personal-website: /lib/libc.so.6: version `GLIBC_2.14' not found
(required by ./dist/build/personal-website/personal-website)
2011-12-28T01:31:23+00:00 app[web.1]: ./dist/build/personal-website/
personal-website: /lib/libc.so.6: version `GLIBC_2.14' not found
(required by /app/dist/build/personal-website/libgmp.so.10)
2011-12-28T01:31:25+00:00 heroku[web.1]: State changed from starting
to crashed
2011-12-28T01:31:25+00:00 heroku[web.1]: Process exited
ऐसा लगता है कि libc का संस्करण है कि मैं के खिलाफ संकलन कर रहा हूँ:
2011-12-28T01:20:51+00:00 heroku[web.1]: Starting process with command
`./dist/build/personal-website/personal-website -p 41083`
2011-12-28T01:20:51+00:00 app[web.1]: ./dist/build/personal-website/
personal-website: error while loading shared libraries: libgmp.so.10:
cannot open shared object file: No such file or directory
2011-12-28T01:20:52+00:00 heroku[web.1]: State changed from starting
to crashed
मैं के रूप में here में सुझाव दिया और फिर LD_LIBRARY_PATH को libgmp.so.10 जोड़ने की कोशिश की निम्न त्रुटि मिला अलग है। मैंने पुस्तकालयों के बैच में को libgmp के लिए भी libc जोड़ने का प्रयास किया, लेकिन यह परिणामस्वरूप सेगमेंटेशन गलती में होता है जब एप्लिकेशन हेरोोकू पक्ष पर शुरू होता है।
सबकुछ मेरे पीसी पर ठीक काम करता है। मैं ghc 7.0.3 के साथ 64 बिट archlinux चला रहा हूँ। The blog post on the official Yesod blog बहुत आसान देखा लेकिन मैं इस बिंदु पर stumped हूँ। क्या किसी के भी पास कोई सुझाव है? यदि इस बात को पर बिना स्थिर रूप से काम करने का कोई तरीका है, तो मैं भी इसके लिए खुला हूं।
संपादित
प्रति Employed Russians
जवाब मैं इसे ठीक करने के लिए निम्न किया था।
पहले परियोजना निर्देशिका के तहत एक नया निर्देशिका lib
बनाया है और इसे में लापता साझा पुस्तकालयों की नकल की। आप ldd path/to/executable
और heroku run ldd path/to/executable
चलाकर और आउटपुट की तुलना करके यह जानकारी प्राप्त कर सकते हैं।
मैं तो heroku config:add LD_LIBRARY_PATH=./lib
किया इसलिए जब आवेदन शुरू कर दिया है गतिशील लिंकर नई lib निर्देशिका में पुस्तकालयों के लिए दिखेगा।
अंत में मैं एक ubuntu 11.10 आभासी मशीन बनाई गई है और वहाँ से बनाया गया है और Heroku लिए तैनात किए गए, यह कोई पुराना पर्याप्त glibc कि यह Heroku मेजबान पर काम करता है।
संपादित करें: मैं के बाद से Yesod wiki
ठीक है, इसलिए मैंने अपने सिस्टम से 'libc.so.6' और 'libgmp.so.10' के साथ अपने हेरोकू बिल्ड में' ld-2.14.so' की प्रतिलिपि बनाई है और उसके लिए Heroku रन कमांड को बदल दिया है आपने निर्दिष्ट किया एप्लिकेशन अब चुपचाप दुर्घटनाग्रस्त हो जाता है (कम से कम उसकेोकू लॉग में क्रैश से कोई आउटपुट नहीं होता है, राज्य बस क्रैश होने से शुरू होता है)। यदि मैं 'heroku run चलाता हूं ./lib/ld-linux-x86-64.so.2 --list/path/to/execable' सभी लाइब्रेरी निर्भरता पूर्ण भर चुके हैं, _but_ अधिकांश सिस्टम लाइब्रेरी से संतुष्ट हैं। क्या मुझे अपने सिस्टम से एप्लिकेशन द्वारा उपयोग किए जाने वाले _all_ पुस्तकालयों की प्रतिलिपि बनाना है? – asm
आपको स्थिर रूप से निर्माण करने की आवश्यकता नहीं है; जो मैं समझता हूं, यहां तक कि '-स्टैटिक' और दोस्तों के बिना भी, जीएचसी आपके निष्पादन योग्य (जिसे आपको चाहिए, के साथ जीएचसी आरटीएस को बंडल करेगा, क्योंकि हेरोकू में शायद जीएचसी रनटाइम मुक्ति के रूप में उपलब्ध नहीं है), जब तक कि आप स्पष्ट रूप से संकलित नहीं होते 'गतिशील' ध्वज। डिफ़ॉल्ट रूप से, आरटीएस * द्वारा उपयोग की जाने वाली पुस्तकालयों को गतिशील रूप से पसंद किया जाता है, जो आपके मामले के लिए बुद्धिमान होगा। यह भी देखें: http://stackoverflow.com/questions/699908/making-small-haskell-executables –
मुझे पोस्टिंग के बाद से पता चला। ऐसा लगता है कि प्राथमिक समस्या यह तथ्य है कि मेरा 'libc' हेरोकू होस्ट्स पर क्या है, जैसा कि' नियोजित रूसी 'सुझाव दिया गया है। – asm